Modifying the PHP-Nuke theme footer

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.

Tip What 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.

 

Site Info v2.2.2

Last SeenLast Seen
Server TrafficServer Traffic
  • Total: 343,817,506
  • Today: 51,629
Server InfoServer Info
  • Dec 10, 2017
  • 07:58 pm PST
 
 

Daily Inspiration