Fork me on GitHub

Fail to call function themeheader()  Bottom

  • Ok, I've searched the forums for the last couple of hours and I can't figure this out at all. I've been reading André's tutorials on creating themes and have tried re-creating some of the ones on his site using his tutorials. However, I keep getting this dreaded error.

    My code can be found here (I don't like posting long bits of code on boards).

    If anyone could help, it'd be hugely appreciated. :D

    Many thanks in advance.

    I know (from searching) that this problem seems to come about a lot and if this has already been answered, then I'm sorry.
  • You have a syntax error in the first line:

    Code

    $thename = "Piers"

    It is missing a semi-colon at the end. There may be others, check your PHP syntax carefully...

    In general these errors are caused by syntax errors...

    (EDIT: There's another missing semi-colon just b4 the if statement in your themearticle() - echoing aint the way 2 go w/themes; C tha link B-low)

    P.S. See this post on how to write theme.php the "right" way:
    Theme Guide: Tips fo…g and starter theme

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Boy do I feel stupid! icon_redface I corrected that, and another very similar error, but I'm still getting that same error message. Is there anything else it could be?

    Just so people know, I'm using v0.726.
  • *READ* the error message you are getting or at the very least post it:

    Code

    Fatal error: Cannot redeclare themefooter()

    Means you have duplicate functions in there. You can only have one occurance of a function in any given PHP script.

    I would suggest writing the theme as outlined in my post to make the theme easier to edit and consider using an editor with syntax highlighting if you are not already....

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Thank you for pointing this out. Not sure why I had two functions there... Anyway, I am using an editor with syntax higlighting and I am still getting a "Call to undefined function" error. I'm not sure why this error is coming up, since the function is there.
  • The theme you made works fine if you remove *ALL OF THE DUPLICATE FUNCTIONS* and make the other corrections pointed out above...

    *READ* the *WHOLE* error message - it will tell you *EXACTLY* what is wrong...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • I have *READ* the *WHOLE* message and it reads as follows...

    Quote

    Fatal error: call to undefined function: themeheader() in /home/piers/html/PostNuke-0.726/html/header.php on line 188


    Bear in mind that file that I posted earlier has changed. Are you sure your not still reading the old version? Cos theres only one of each function there...
  • What "new" version? The code linked above still has duplicate functions, but if you make the two corrections outlined above and remove the duplicate functions from it, it works fine... You've obviously made a syntax error in your theme.php somewhere. Maybe you should try starting with the code linked above...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • K, for some reason, the code that I linked to hasnt changed. As you can see below, I have made the changes suggested. From what I can see, header.php is not "seeing" the function themeheader(), but it is clearly there.

    Code

    <?php
        $thename = "Piers";
        $bgcolor1 = "#cccccc";
        $bgcolor2 = "#666666";
        $bgcolor3 = "#999999";
        $bgcolor4 = "#aaaaaa";
        $sepcolor = "#000000";
        $textcolor1 = "#000000";
        $textcolor2 = "#000000";
        $postnuke_theme = true;
       
        themes_get_language();
       
        function OpenTable()
        {
            echo "<table><tr valign=\"top\"><td>\n";
        }
       
        function OpenTable2()
        {
            echo "<table><tr valign=\"top\"><td>\n";
        }
       
        function CloseTable()
        {
            echo "</td></tr></table>\n";
        }   
       
        function CloseTable2()
        {
            echo "</td></tr></table>\n";
        }
       
        function themeheader()
        {
            $slogan = pnConfigGetVar('slogan');
            $sitename = pnConfigGetVar('sitename');
            $banners = pnConfigGetVar('banners');

            echo "</head>\n"
            . "<body>\n"
            . "<table>\n"
       
            . "<tr valign=\"top\">\n"
            . "<td>\n"
            . "<a href=\"index.php\">$sitename</a><br>\n"
            . "$slogan</td>\n"
            . "</tr>\n"
            . "</table>\n";
            echo "<table>\n"
            . "<tr valign=\"top\">\n"
            . "<td>\n";
            blocks('left');
           
            echo "</td>\n"
            . "<td>\n";
            if ($GLOBALS['index'] == 1) {
                blocks('centre');
            }
        }

       
        function themefooter()
        {
            echo "</td>\n";
            if($GLOBALS['index'] == 1)
            {
                echo "<td>\n";
                blocks('right');
                echo "</td>\n";
            }
           
            echo "</tr>\n"
            . "</table>\n";
            echo "<table>\n"
            . "<tr valign=\"top\">\n"
            . "<td>\n";
            footmsg();
            echo "</td>\n"
            . "</tr>\n"
            . "</table>\n";
        }
       
        function themeindex($_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $info, $links, $preformat)
        {
            $anonymous = pnConfigGetVar('anonymous');
            $tipath = pnConfigGetVar('tipath');
           
            echo "<table>\n"
            . "<tr valign=\"top\">\n"
            . "<td>$preformat[catandtitle]<br />\n" . _POSTEDBY . ": $info[informant] " . _ON . " $info[longdatetime]</td>\n"
            . "</tr>\n"
            . "<tr valign=\"top\">\n"
            . "<td>\n" . "$preformat[searchtopic]\n" . "$info[hometext]\n" . "<br /><br />$preformat[notes]\n" . "</td>\n"
            . "</tr>\n"
            . "<tr valign=\"top\">\n"
            . "<td>\n"
            . "<tr valign=\"top\">\n"
            . "<td>($info[counter] " . _READS . ")</td>\n"
            . "<td>$preformat[more]</td>\n"
            . "</tr>\n"
            . "</table>\n"
            . "<br />\n";
        }
       
        function themearticle($_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $_deprecated, $info, $links, $preformat)
        {
            echo "<table>\n"
            . "<tr valign=\"top\">\n"
            . "<td>$preformat[catandtitle]<br />\n"
            . _POSTEDBY . ": $info[informant] " . _ON . " $info[briefdatetime]</td>\n"
            . "</tr>\n"
            . "<tr valign=\"top\">\n"
            . "<td>\n";
            if(pnSecAuthAction(0, 'Stories::Story', "$info[aid]:$info[cattitle]:$info[sid]", ACCESS_EDIT))
            {
                echo " [ <a href=\"admin.php?module=NS-AddStory&op=EditStory&sid=$info[sid]\">" . _EDIT . "</a> ]";
               
                if(pnSecAuthAction(0, 'Stories::Story', "$info[aid]:$info[cattitle]:$info[sid]", ACCESS_DELETE))
                {
                    echo " [ <a href=\"admin.php?module=NS-AddStory&op=RemoveStory&sid=$info[sid]\">" . _DELETE . "</a> ]";
                }
            }   
           
            echo "$preformat[searchtopic]\n" . "$preformat[fulltext]\n"
            . "</td>\n"
            . "</tr>\n"
            . "</table>\n";
        }   
       
       
        function themesidebox($block)
        {
            echo "<table>\n";
            if(!empty($block['title']))
            {
                echo "<tr valign=\"top\">\n"
                . "<td>$block[title]</td>\n"
                . "</tr>\n";
            }
           
            echo "<tr valign=\"top\"><td>$block[content]</td>\n"
            . "</tr>\n"
            . "</table>\n";
        }
    ?>
  • As I had said before - the error has nothing to do with themeheader - that message is caused by a syntax error somewhere in the file... You're not getting *any* parse error before the "Fatal" error?

    The attached theme works fine for me, don't know what else to suggest except to make sure your Admin-->Settings is actually pointing to this theme... Use this URL "admin.php?module=NS-Settings&op=main&theme=ExtraLite" to load a known working theme to view or change your settings (sub ExtraLite for a working theme)...

    --
    Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods

    Cape Cod Travel Info...
  • Yes and no. I finally got it working (again with some help from André), and the answer was that the file permissions were wrong. The reason that the file couldn't be found was because it wasn't possible to read it.

    Thanks for your help anyway.

This list is based on users active over the last 60 minutes.