|
Comments for: babao20020907
| Message # 1028732: |
|
Date: 06/11/05 14:57
By: Shai Lipkovich Subject: Improvement to access to Subsections The following script adds a simple but very useful feature: it allows you to access an individual section, without having to loop through all the other sections with {FORALL} . Usage: {FORALL(SUBSECTION-SPECIFIC, ACTION, subsection_name)} example: {FORALL(SUBSECTION-SPECIFIC,{SECTION-LINKS}, bottom_link_bar)} Here's the script (for this to work, add it to SiteClass in the appropriate location, see below): else if ($args[0] == "SUBSECTION-SPECIFIC") { // This chunk was added by Shai Lipkovich on May 11, 2005. shai200@gmail.com $ex = ""; if(isset($args[2])) { $definedSection = trim($args[2]); $thisSubsection = $this->sections[$definedSection]->subsections; $mySubsection = current($thisSubsection); if ($mySubsection->visible) $ex .= $this->stringFromTemplate($args[1], 0, $definedSection, $mySubsection->name); } Just copy and paste this script right after the following lines: } else if ($args[0] == "SUBSECTION") { $ex = ""; foreach($this->sections[$currentSection]->subsections as $mySubsection){ if ($mySubsection->visible) $ex .= $this->stringFromTemplate($args[1], 0, $currentSection, $mySubsection->name); } } |
Previous Message | Next Message |


