Jump to content

Different sidebars for different templates


peterpp
 Share

Recommended Posts

Hi Pravin,

That would simply be a case of including a different bit of code for each template. So it could be:

home.php

// Main content here

<?php include("./sidebar.inc"); ?>

special.php

// Main content here

<?php include("./alternate_sidebar.inc"); ?>

That's if I'm understanding your question correctly?

  • Like 2
Link to comment
Share on other sites

Another option would be to add the various sidebars as (hidden, grouped under a hidden page) pages

* Sidebars (hidden)
    * Sidebar A (hidden)
    * Sidebar B (hidden)
    * ...

 and include them in your templates using a Page field, e.g. called sidebar. Then something like

echo $page->sidebar->body;

should get you the selected page's body field etc.

You could even have this be a Page field which allows to select multiple pages – that way, all pages below Sidebars could be sidebar widgets, and you could add multiple ones to one page.

It really depends on what you need and what works best for you (which is usually the case with PW).

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...