Announcement

Collapse
No announcement yet.

Display number of sub sections in a section

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

    Display number of sub sections in a section

    Hi, im looking for a bit of code that I can use which would display the number of sub-sections within a section..ie

    Rock Salt - 5 sub sections
    Snow Chains - 2 sub sections
    Sledges - 1 sub section
    People to push car - 6 sub sections

    On the site im building they wanted one product per page, therefore I have the product sat in a sub section, which in turn is in a section.

    I found this thread http://community.actinic.com/showthread.php?t=29616 which can display the number of products in a section, and ultimately this is what im after (to mimic the sub sections as products)

    Ive played around with the code, tried using $sectioncount instead of $productcount but im not a programmer so im stabbing in the dark, has anyone implimented this in the past?

    TIA
    Last edited by DarrenSpink; 06-Jan-2010, 03:05 PM. Reason: Solved
    Web design Bradford

    #2
    Try this:
    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22PageType%22%20%2f%3e%20%3d%3d%20%22Section%22">
    	<actinic:block php="true">$index = 0;</actinic:block>
    	<actinic:block type="ChildSectionList" /><actinic:block php="true">$index=<actinic:variable name="ListIndex" />;</actinic:block></actinic:block>
    	<actinic:block php="true">
    		if ($index) echo " - $index sub-section";
    		if ($index > 1) echo "s";
    	</actinic:block>
    </actinic:block>
    It displays nothing if there are no sub-sections and e.g. " - 3 sub-sections" if there are.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      [solved]

      Thank you so much Norman that's perfect.
      Web design Bradford

      Comment


        #4
        I've just amended the above so it pluralises properly. E.g. 1 sub-section, 2 sub-sections, etc.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment

        Working...
        X