14.6. Modifying the PHP-Nuke theme footer

Here is a little unorthodox example of what you can achieve by modifying the theme footer:

Suppose you just wonder how you can make a new table to the right of each page (Section 14.6.1), perhaps because you want to put an advertisement table there. The standard way to do this would be to write a PHP-Nuke block (see Chapter 20), insert it in PHP-Nuke through the block management panel (see Section 9.4), position it in the right column, then define its relative position to the other blocks in the right column through the intuitive graphical arrows in the block table of the block management panel.

An alternative way is to edit your theme.php. There, in the function themefooter(), you should see an IF statement for the blocks(right):

if ($index == 1) {
    $tmpl_file = "themes/NukeNews/center_right.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
    blocks(right);
}

The $index variable controls whether the right column should be displayed at all (together with all the blocks that were positioned “right”). If it is equal to 1, the right column should be visible and a call to blocks(right) is made.

You can echo the HTML for the extra table cell after this IF block. This extra table cell will be visible in all pages and could contain a PHP-Nuke block with Google skyscraper ad (Section 20.7), or any other content of your choice. See Section 14.6.1 for the details.

TipWhat makes right blocks disappear...
 

...is the theme footer, as you can see from the code above! It is in the themefooter() function of theme.php in your theme folder where the value of $index is checked and blocks(right) is called to display the right blocks. If blocks(right) and the statements around it are called unconditionally, then the right blocks will never disappear, no matter what value $index has, and the method of Section 18.1.1 will not work. You will then have to adjust themefooter() in your theme manually. See also Disable right blocks in News Module.

14.6.1. How to insert an extra table to the right of the page

The themefooter() function in the theme.php file of your theme is the right place to modify if you want to insert an extra table cell to the right of your page:

Find the call to blocks(right) (see it in Section 14.6) and modify it by adding code as follows:

blocks(right);
    }
    echo "</td><td>&nbsp;</td>";
    echo "<td>Some text here.";
    // This is an extra table cell now
    $footer_message = "$foot1<br>$foot2<br>$foot3<br>$foot4";
    $tmpl_file = "themes/fiblack/footer.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "$r_file="".$thefile."";";
    eval($thefile);
    print $r_file;
}

Or, as a more elaborate variation that includes an external piece of code (in this case the Login block):

blocks(right);
    }
    echo "</td><td>&nbsp;</td>";
    echo "<td>Some text here.<br>";
    include("blocks/block-Login.php");
    $title = "Title Here";
    themesidebox($title,$content);
    // This is an extra table cell now
    $footer_message = "$foot1<br>$foot2<br>$foot3<br>$foot4";
    $tmpl_file = "themes/fiblack/footer.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "$r_file="".$thefile."";";
    eval($thefile);
    print $r_file;
}

In both cases, it is important that the inserted code is outside the IF statement that controls the call to blocks(right). See Insert a new table for more details.

14.6.2. The PHP-Nuke Copyright notice

The theme footer also is the place where the PHP-Nuke copyright notice comes in. You don't need to do anything for this, it is done automatically as follows (see PHP-Nuke Copyright and Logo):

The function themefooter() in theme.php contains a call to the footmsg() function, as in the following example from the Milo theme (file themes/Milo/theme.php):

    echo "</td>\n"
        ."</tr></table>\n"
        ."<table bgcolor=\"#000000\" width=\"750\" 
          cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\">\n"
        ."<tr>\n"
        ."<td width=\"750\" height=\"5\">
          <img src=\"themes/Milo/images/bottombar.gif\" width=\"750\" 
          height=\"5\" border=\"0\" alt=\"\"></td>\n"
        ."</tr>\n"
        ."<tr>\n" 
        ."<td width=\"100%\"><img src=\"themes/Milo/images/pixel.gif\" 
          width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>\n"
        ."</tr>\n" 
        ."</table>\n"
        ."<br>\n"
        ."<br>\n"
        ."<table width=\"750\" cellpadding=\"0\" cellspacing=\"0\" 
          border=\"0\" align=\"center\">\n"
        ."<tr align=\"center\">\n"
        ."<td width=\"100%\" colspan=\"3\">\n";
    footmsg();
    echo "</td>\n"
        ."</tr>\n"
        ."</table>\n";

footmsg, in turn, is defined in the footer.php file (located in the root directory, together with config.php, mainfile.php and the other important files). There, among some code that displays the computation time it took to display the page, we read:

    // DO NOT REMOVE THE FOLLOWING COPYRIGHT LINE. 
       YOU'RE NOT ALLOWED TO REMOVE NOR EDIT THIS.
    echo "$copyright<br>$totaltime<br>\n</font>\n";

So that's the place where the Copyright notice for PHP-Nuke comes from! Does that mean that, now that we have found it, we are entitled to edit or remove it? Absolutely NOT! In the INSTALL file that comes with the PHP-Nuke package, Franzisco Burzi, the author of PHP-Nuke explicitly forbids this:

##############################################################################
#                        I M P O R T A N T    N O T E                        #
##############################################################################
# IMPORTANT: I saw many sites that removes the copyright line in the footer  #
# of each page. YOU'RE NOT ALLOWED TO REMOVE NOR CHANGE/EDIT THAT NOTE. If I #
# still see this problem happening I'll need to take extreme measures that   #
# can include: to change the <application>PHP-Nuke</application> license, to encrypt some parts of the  #
# code, stop distributing it for free and in an extreme case stop developing #
# it. The decision is in your hands.                                         #
# If you do not agreed with this simple rule, delete all <application>PHP-Nuke</application> files      #
# rigth now and move away from it. Thanks.                                   #
##############################################################################

Still, even this simple and clear admonition from the author does not stop some folks to pose the same question in the forums again and again: Am I allowed to take the Copyright Notice away? The argument often presented is one that involves the Licence uder which PHP-Nuke is released, the GNU General Public Licence (GPL). If I am allowed to change the code under the GPL, the argument goes, and the Copyright Notice is generated by a function call to footmsg(), why not just change the code and delete that call in my theme? I can do this, right?

Wrong. In an article titled PHP-Nuke GPL Copyright Removal Question Finally Solved, MissS writes:

A while back, questions were raised as to whether or not the copyright notice at the bottom of PHPNuke created pages could be removed. Now there is an answer to this question, straight from the GNU people.

The GNU website states that if you have any questions concerning licensing, you can simply email them for clarification. That is exactly what I did and what follows is my email to them...

So MissS wrote to licensing@gnu.org on Sept. 19th, 2002 and asked:

I have a question about the GNU/GPL license. There is a program called PHP-Nuke that has been released under this license. (This program can be found at www.phpnuke.org) This program is a content management system that provides the structure for a website along with the means to administer that site.

What I would like to know is this: if I use this PHPNuke program to create my website, must the copyright notice (that is included at the bottom of each page that is created with PHPNuke) remain there in order to remain in compliance with this license? There is also a copyright notice within the source code files themselves.

Dave Turner's answer was clear, albeit somewhat lapidary:

Yes. See section 2c of the GPL for details.

MissS was also confused as to whether PHP-Nuke can be technically considered as what the GPL in its 2c section calls a program that “normally reads commands interactively when run” , in which case it must, among other things, “print or display an announcement including an appropriate copyright notice”:

This subject came up a while back at PHPNuke.org and no-one seemed to know the real

answer. I have spent quite sometime reading over your license and can't definitively figure out

this answer for myself. (I had questions such as: is the output from a program like this truly

considered interactive or not?)

Please let me know. I don't want to remove the copyright footers on the output pages if I am

not legally allowed to do so.

To which Dave Turner replied:

I think a web-based message board clearly reads commands interactively. So, if there is such a notice, you can't remove it. But you could alter its form, so long as it is still appropriate.

-Dave Turner

Free Software Licensing Guru

This is not legal advice. If you need legal advice, see a lawyer.

This pretty much says it all.