Fork me on GitHub

Help with controling left, right and center blocks  Bottom

  • Lately I have been working on controling what pages have left, right and/or center blocks. I have figured out how to get them to appear on all pages or none of the pages. However. I want the left and right to appear on all and have the center appear on most pages. I do not want the center block on the admin pages and PNphpBB for example.

    Here is the code I found....

    Code

    <?php

    $strip_head = false;
    $alternate_summary = false;

    $template = array (
    //Main theme template file names
           'main' => "theme.html",
           'summary' => "summary.html",
           //Alternating Summary article templates
           //'summary1' => "summary1.html",
           //'summary2' => "summary2.html",
           //
           'article' => "article.html",
           'leftblock' => "leftblock.html",
           'centerblock' => "centerblock.html",
           'rightblock' => "rightblock.html",
           //Nuclei blocks template file names (*optional)
           'area1block' => "area1block.html",
           'area2block' => "area2block.html",
           'area3block' => "area3block.html",
           'area4block' => "area4block.html",
           'area5block' => "area5block.html",
           'area6block' => "area6block.html",
           'area7block' => "area7block.html",
           'area8block' => "area8block.html",
           'area9block' => "area9block.html",
           'topblock' => "topblock.html",
           'bottomblock' => "bottomblock.html",
    );

    $block_display = array (
    //Display blocks on all pages
           'left' => true,
           'center' => true,
           'right' => true,
           //Nuclei blocks (*optional)
           'area1' => false,
           'area2' => false,
           'area3' => false,
           'area4' => false,
           'area5' => false,
           'area6' => false,
           'area7' => false,
           'area8' => false,
           'area9' => false,
           'top' => false,
           'bottom' => false,
    );

    $miscellaneous = array (
    //Style sheet, logo image and colors used by modules by default
           'stylesheet' => "",
           'logo' => "",               // [logo-image]
           'bgcolor1' => "#005826",    // [color1]
           'bgcolor2' => "#005826",    // [color2]
           'bgcolor3' => "#005826",    // [color3]
           'bgcolor4' => "#005826",    // [color4]
           'textcolor1' => "yellow",  // [color5]
           'textcolor2' => "yellow",  // [color6]
    );

    $custom_block = array (
    //Custom themed blocks - configure custom templates (*optional)
    //These override the standard settings above only for the specific block
    //Comment out or delete what you don't need
           //'Main Menu' => "mainmenu.html",
           //'Poll' => "poll.html",
           //'Related links' => "relatedlinks.html",
    );


    //Custom themed modules - configure custom templates, colors, image and block display (*optional)
    //These override the standard settings above only for the specific module
    //Comment out or delete what you don't need
    //
    //Use the following if statement if you don't want these settings used on your home page
    if($index== 1) {
    //
    $custom_module['News'] = array (
    //Module specific template file names
           'main' => "theme.html",
           'leftblock' => "leftblock.html",
           'centerblock' => "centerblock.html",
           'rightblock' => "rightblock.html",
           //Module specific Nuclei blocks template file names (*optional)
           'area1block' => "area1block.html",
           'area2block' => "area2block.html",
           'area3block' => "area3block.html",
           'area4block' => "area4block.html",
           'area5block' => "area5block.html",
           'area6block' => "area6block.html",
           'area7block' => "area7block.html",
           'area8block' => "area8block.html",
           'area9block' => "area9block.html",
           'topblock' => "topblock.html",
           'bottomblock' => "bottomblock.html",
    //Block display for this module
           'left' => true,
           'center' => true,
           'right' => true,
           //Nuclei blocks (*optional)
           'area1' => false,
           'area2' => false,
           'area3' => false,
           'area4' => false,
           'area5' => false,
           'area6' => false,
           'area7' => false,
           'area8' => false,
           'area9' => false,
           'top' => false,
           'bottom' => false,
    //Style sheet, logo image and colors for this module
           'stylesheet' => "",
           'logo' => "",    // [logo-image]
           'bgcolor1' => "#005826",    // [color1]
           'bgcolor2' => "#005826",    // [color2]
           'bgcolor3' => "#005826",    // [color3]
           'bgcolor4' => "#005826",    // [color4]
           'textcolor1' => "yellow",  // [color5]
           'textcolor2' => "yellow",  // [color6]
    );
    } //End if($index== 1)

    if($index== 1) {
    //
    $custom_module['XForum'] = array (
    //Module specific template file names
           'main' => "theme2.html",
           'leftblock' => "leftblock.html",
           'centerblock' => "centerblock.html",
           'rightblock' => "rightblock.html",
           //Module specific Nuclei blocks template file names (*optional)
           'area1block' => "area1block.html",
           'area2block' => "area2block.html",
           'area3block' => "area3block.html",
           'area4block' => "area4block.html",
           'area5block' => "area5block.html",
           'area6block' => "area6block.html",
           'area7block' => "area7block.html",
           'area8block' => "area8block.html",
           'area9block' => "area9block.html",
           'topblock' => "topblock.html",
           'bottomblock' => "bottomblock.html",
    //Block display for this module
           'left' => true,
           'center' => true,
           'right' => true,
           //Nuclei blocks (*optional)
           'area1' => false,
           'area2' => false,
           'area3' => false,
           'area4' => false,
           'area5' => false,
           'area6' => false,
           'area7' => false,
           'area8' => false,
           'area9' => false,
           'top' => false,
           'bottom' => false,
    //Style sheet, logo image and colors for this module
           'stylesheet' => "",
           'logo' => "",    // [logo-image]
           'bgcolor1' => "#005826",    // [color1]
           'bgcolor2' => "#005826",    // [color2]
           'bgcolor3' => "#005826",    // [color3]
           'bgcolor4' => "#005826",    // [color4]
           'textcolor1' => "yellow",  // [color5]
           'textcolor2' => "yellow",  // [color6]
    );
    } //End if($index== 1)

    if($index== 1) {
    //
    $custom_module['PNphpBB2'] = array (
    //Module specific template file names
           'main' => "theme2.html",
           'leftblock' => "leftblock.html",
           'centerblock' => "centerblock.html",
           'rightblock' => "rightblock.html",
           //Module specific Nuclei blocks template file names (*optional)
           'area1block' => "area1block.html",
           'area2block' => "area2block.html",
           'area3block' => "area3block.html",
           'area4block' => "area4block.html",
           'area5block' => "area5block.html",
           'area6block' => "area6block.html",
           'area7block' => "area7block.html",
           'area8block' => "area8block.html",
           'area9block' => "area9block.html",
           'topblock' => "topblock.html",
           'bottomblock' => "bottomblock.html",
    //Block display for this module
           'left' => true,
           'center' =>false,
           'right' => true,
           //Nuclei blocks (*optional)
           'area1' => false,
           'area2' => false,
           'area3' => false,
           'area4' => false,
           'area5' => false,
           'area6' => false,
           'area7' => false,
           'area8' => false,
           'area9' => false,
           'top' => false,
           'bottom' => false,
    //Style sheet, logo image and colors for this module
           'stylesheet' => "",
           'logo' => "",    // [logo-image]
           'bgcolor1' => "#005826",    // [color1]
           'bgcolor2' => "#005826",    // [color2]
           'bgcolor3' => "#005826",    // [color3]
           'bgcolor4' => "#005826",    // [color4]
           'textcolor1' => "yellow",  // [color5]
           'textcolor2' => "yellow",  // [color6]
    );
    } //End if($index== 1)

    if($index != 1) {
    //
    $custom_module['Downloads'] = array (
    //Module specific template file names
           'main' => "theme.html",
           'leftblock' => "leftblock.html",
           'centerblock' => "centerblock.html",
           'rightblock' => "rightblock.html",
           //Module specific Nuclei blocks template file names (*optional)
           'area1block' => "area1block.html",
           'area2block' => "area2block.html",
           'area3block' => "area3block.html",
           'area4block' => "area4block.html",
           'area5block' => "area5block.html",
           'area6block' => "area6block.html",
           'area7block' => "area7block.html",
           'area8block' => "area8block.html",
           'area9block' => "area9block.html",
           'topblock' => "topblock.html",
           'bottomblock' => "bottomblock.html",
    //Block display for this module
           'left' => true,
           'center' => true,
           'right' => true,
           //Nuclei blocks (*optional)
           'area1' => false,
           'area2' => false,
           'area3' => false,
           'area4' => false,
           'area5' => false,
           'area6' => false,
           'area7' => false,
           'area8' => false,
           'area9' => false,
           'top' => false,
           'bottom' => false,
    //Style sheet, logo image and colors for this module
           'stylesheet' => "",
           'logo' => "",    // [logo-image]
           'bgcolor1' => "#005826",    // [color1]
           'bgcolor2' => "#005826",    // [color2]
           'bgcolor3' => "#005826",    // [color3]
           'bgcolor4' => "#005826",    // [color4]
           'textcolor1' => "yellow",  // [color5]
           'textcolor2' => "yellow",  // [color6]
    );
    } //End if($index != 1)

    $custom_module['Web_Links'] = array (
           'right' => true,
    );

    $custom_module['zClassifieds'] = array (
           'right' => true,
    );

    ?>


    Here is the line that I am confused about....

    Quote

    //Use the following if statement if you don't want these settings used on your home page
    if($index== 1) {


    How do I use this and where? Do I only need to insert the above line in the index of the module? I have been struggling with this.
    Could some one please explain this to me ?

    I did some searching, but found nothing to answer my question. I found plenty of posts that pertained to this question, but none fully answered mine.

    James
    Visit my site at www.e-bassangler.com
  • That statement generally pertains to your theme - where it's decided where blocks are placed. You'll often see:

    Code

    if($GLOBALS['index'] == 1) {
       blocks('centre');
    }

    In the themeheader to restrict show blocks on certain pages.... Check out these post for examples/ideas on including blocks on certain pages:
    Theme Add-in: Indivi…ain Pages & Modules
    Blocks Module Mod fo…ement w/PN themes
    Or try out Xanthia or AutoTheme...

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

    Cape Cod Travel Info...
  • This is an older AT-Lite .6 theme.cfg. You would be better off using the newer AT-Lite .7 that has many improvements and also provides the functionality your trying for and configurable in the admin interface.

    But to answer your question:

    The $index==1 helps to define a custom_module for the home page, so you would wrap the entire $custom_module array in the if statement.

    This would define settings for when News is your Home Page and you view the Home Page

    Code

    if ($index == 1) {
       $custom_module['News'] = array (
          blah blah blah
       );
    }


    This would define settings for displaying the News, but not the Home Page (i.e. when you click readmore to read the full article)

    Code

    if ($index != 1) {
       $custom_module['News'] = array (
          blah blah blah
       );
    }


    Additionally, you could apply this concept to the default config for all modules by wrapping multiple $template arrays in the if statements:

    Code

    //home page
    if ($index == 1) {
       $template = array (
          blah blah blah
       );
    }

    //other pages
    if ($index != 1) {
       $template = array (
          blah blah blah
       );
    }

    But if you define a $custom_module that applies, then it would override the $template config.

    Like I said, AT-Lite .7 would be a great way to go as all of this is much better and simpler to config in the admin.

    HTH
    -Shawn

    --
    Get the Revolutionary AutoTheme HTML Theme System! Currently for Zikula, PHP-Nuke, CRE Loaded, osCommerce and Wordpress!
  • I bought AT the other day but I am still waiting for my echeck to clear through paypal. If AutoTheme allows me to do all of this with out all the hassles of coding, then I will just wait.

    Where is a good place to get free AT?

    Thanks for the help.
    James
  • Quote

    Where is a good place to get free AT?

    Same place as where you bought the commercial ver. Get AT-Lite in Downloads. :)

    -Shawn

    \/ Look here \/

    --
    Get the Revolutionary AutoTheme HTML Theme System! Currently for Zikula, PHP-Nuke, CRE Loaded, osCommerce and Wordpress!
  • 0 users

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