Announcement

Collapse
No announcement yet.

condition help: current item

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

    condition help: current item

    hi,

    if for example i have a condition:

    SectionLevel == 2

    what i actually need is for it to be (in english) "if the section level is 1 less than the current level"

    is there a way to do this?

    was thinking something like SectionLevel == (Current::SectionLevel - 1) but there is no such command... does anyone have any ideas how to do this?

    #2
    there is in php.

    pass the variable to php and use its conditional operators.

    Comment


      #3
      oh right ok, i did try doing something like that but couldn't get it quite right could you elaborate a bit? can you just use the <actinic variable> idea within php code?

      Comment


        #4
        can you just use the <actinic variable> idea within php code
        Yes.

        Code:
        $slevel = <actinic:variable name="SectionLevel" selectable="false"/>;
        If you are passing a string, use single quotes and

        Code:
        $sname = '<actinic:variable name="SectionName" encoding="perl" selectable="false"/>';
        The encoding="perl" tells Actinic to escape single quotes.

        The selectable="false" prevents Actinic putting in unwanted diagnostic code during Design Previews.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          thanks guys - i'll have a go in a bit

          Comment


            #6
            i've had a go but ran into some integration problems...

            i did this:

            Code:
            <ul>
            <actinic:block type="EntireSectionList" >  
            <actinic:block php='true' selectable='false'>
            
            $sLevel = <actinic:variable name="SectionLevel" selectable="false"/>;
            <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevel == ($sLevel + 1)">
            
            <li><a href="<actinic:variable Name="SectionPageName"/>"><actinic:variable Name="SectionName"/></a></li>
            
            </actinic:block>
            
            </actinic:block>
            </actinic:block>
            </ul>
            but i dont think it likes me putting php within the actinic variable which i can understand to to it being parsed first... could someone point me in the right direction i'm having trouble getting my head around it...

            Comment


              #7
              You'll have to put that <li.....> line within a PHP echo statement.

              Also your logic is wrong. You'll be comparing 2 identical values. You'll have to rethink.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                aahhh right, makes sense, but then this problem comes back to my original question of how to reference the current section level...

                i realise now i am comparing the same (which will always be false) but i can't see how it could be done without an actinic variable for current::x?

                Comment


                  #9
                  Hi Simon,

                  Like Norman said, you're comparing a variable reference with itself in the PHP and hence having the problem. What is it that you're trying to achieve- there may be another way of working the logic out?

                  Regards,
                  Lara Clark

                  SellerDeck

                  Comment

                  Working...
                  X