Announcement

Collapse
No announcement yet.

Test if section has sub-sections

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

    Test if section has sub-sections

    Sorry to bother y'all -

    but I was wondering if there is a built-in variable I can use in a BLOCK IF statement to test whether the Section I am currently in has Sub-sections.

    Reason: I want a message to only appear underneath a Section link on a Section page if that Section link has no Sub-Sections.

    Cheers!

    #2
    You can use SectionNameNext in a variety of way in block ifs eg to see if the last child section you can use SectionNameNext != ""

    You can also incorporate the SectionLevel variable to test the level beneath the homepage.


    Bikster
    SellerDeck Designs and Responsive Themes

    Comment


      #3
      Thanks for that, just the 'clue' I needed! I'll give it a try

      Comment


        #4
        Unfortunately SectionNameNext tells you if the current section has a subsequent sibling-level section - not a sub-section.

        The only way I can see to do this is via a bit of PHP that loads the SubSectionListTop layout and then checks if it's empty or not. As this is a layout, not a variable, you cannot use it in a simple Condition.
        Code:
        <actinic:block php="true">
        $sublist = <<<ENDOFCODE
        <actinic:variable name="SubSectionListTop" />
        ENDOFCODE;
        if ( trim($sublist) == '' ) echo "This section has no sub-sections";
        </actinic:block>
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Wow, thanks for the clarification Norman. Your code looks awesome. I'll certainly be giving that a try later this morning and will let you know how I get on.

          Comment

          Working...
          X