Announcement

Collapse
No announcement yet.

Hiding sidebar on product pages, but not other pages

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    I see some problems:

    1) If there are no products on the page, then the <actinic:block type="ProductList" >... </actinic:block> will never run. So variable $PageType will be in whatever state the last page left it at. Best preset it before the first block.

    2) What's <actinic:block type="PriceList" >...</Actinic:block> needed for? Looks like you could omit this and save CPU time.

    It's best to temporarily display any variables that you're testing so you can see what's happening.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #17
      I apologize for dragging this up (feel free to ignore). I just wanted to add a little note about how I did this for future newbies and the PHP averse!

      I wanted a right sidebar with information widgets in it like twitter links and payment method logos, etc, but only wanted to see it on a select number of pages, like the home page.

      First I created a variable called "show_right_sidebar", defaulted to FALSE so I wouldn't have to go and set it in a bazillion places, and settable at site, section and brochure level.

      Then I created a new sidebar layout called "info sidebar", currently hardcoded with the images and things I want.

      Then I added this layout into the outerlayout and surrounded ALL of the right sidebar code (inside the two sidebars test) with a test on show_right_sidebar.

      Then I can just switch the sidebar on and off as I like.

      My current issue is that it's super tiny, squashed up on the right hand side, so I think this is to do with one of the width settings. I'll find it
      The Patchwork Rabbit

      Comment


        #18
        Adjusting the design to incorporate a sidebar or not on a dynamic basis is not quite so simple, because in most cases you will have fixed sizes set against containers, for instance on a 3 column layout your columns might be laid out as 200/600/200 (approx), if you choose to hide right sidebar, then central area will still only be set to be 600 wide. So you not only need a switch on the column but often one on the other container which will expand to take up that space. A typical example if you used classes to define the widths of the containers could be:

        .mainCol {width: 600px;}
        .mainColWider {width: 800px;}

        Your container could then be:

        <div class="mainCol"></div>

        with a blockif that added the suffix to the class to take the alternate style, such as:

        <div class="mainColBlockIfWider/Block"></div>

        where the condition running inside the blockif is your right sidebar one, so it changes classes used and thus width, all on that one switch.

        Other factors such as full CSS layouts are required to really maximise layout of the sections too, otherwise actinic just shows a set number, whatever the width.

        Comment


          #19
          This reply is in answer to your very original question Ma111, I appreciate it is a long time since you asked.

          I was just browsing the forums to see if I could find out how to achieve the same thing as you were asking about, I have a section of code that I want to appear on all pages except where a product is showing. Messing around with various variables didn't prove fruitful and reading this thread led me to think it was probably more trouble than it was worth.

          I did however discover the solution, I have a feeling that at some point Norman told me about this one, but could not find the original thread.

          Code:
          <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionHasVisibleProduct%22%20%2f%3e%20%3d%3d%20false" >
          		Section Content
          </actinic:block>
          My code sits in my main outer template, I'm not sure where your sidebar code is placed but assume it would be in a similar location. The "Block if" above makes the code appear on all pages, including brochure pages (my brochure and section pages use the same outer template), except where a product is visible.
          Dave

          Comment

          Working...
          X