Announcement

Collapse
No announcement yet.

Grabbing the Active Page

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

    Grabbing the Active Page

    Hi All

    I have a unordered list on my Brochure pages of a site I am currently working on. It contains a list of just the Brochure pages.

    I am trying to grab the Active page in a block_if statement so I can assign an Active class to the page that the user is on. But I cant get this to work, even trying stuff that I have found in the forum.

    I sure this can be done, but just having an issue with the syntax or something....

    Here is what I am trying :

    I am wrapping class="activepage" in this block_if

    Code:
    <actinic:variable name="BrochurePageURL" /> == <actinic:variable name='BrochurePageURL' />
    But when uploaded, it is ignoring this and making the link "activepage" regardless.

    I have also tried with BrochurePageID but that was not working either.

    Any clues?

    Cheers

    #2
    Your code is equivelant to testing x == x. It will always be true.

    You'll need to do this with PHP to store the current Brochure page ID in a PHP variable and then test that variable (again using PHP) within the list that you're generating.

    E.g.

    Before your loop:
    Code:
    <actinic:block php="true">
     $bid = '<actinic:variable name="BrochurePageID" encoding="perl" selectable="false" />';
    </actinic:block>
    Now inside your Brochure list loop you can have:
    Code:
    <actinic:block php="true">
      if ($bid == '<actinic:variable name="BrochurePageID" encoding="perl" selectable="false" />') echo ' class="activepage" ';
    </actinic:block>
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      You're asking the code whether:

      banana = banana

      you can't put the exact same thing either side of a comparision equation and ask if they are the same and expect differing results. Not sure what's available off the top of my head on brochure pages, but with sections you have things like 'this section name' to use for this sort of thing. Have a look in the list of variables to see what brochure variables are available, something like page name will probably do it.

      Comment

      Working...
      X