Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

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


Comments:
Constuctive Critisismscottybwoy08/30/07 05:50
PHP Programming,- text-based gameScott D05/02/07 17:28
Improvement to access to SubsectionsShai Lipkovich06/11/05 14:57
Contact php File to replace Mail@Peter Brennan02/16/05 03:19
Template helpAisha D02/04/05 12:19
All smarty isDumbass10/02/04 22:01
Templates live where you dare not treadBenjamin Smith04/24/04 03:10
agreed:RE: Templates are DEAD! Long live PHP!Roy Robin12/19/03 13:52
RE: Templates are DEAD! Long live PHP!Hobbit06/08/03 16:19
TemplateTamerDavorin Rusevljan01/05/03 10:17
RE: Templates are DEAD! Long live PHP!L long12/17/02 16:32
Introducing {PHPTMPL}Geraud Krawezik11/18/02 07:59
RE: Templates are DEAD! Long live PHP!Sonic_Molson11/15/02 22:04
RE: Templates are DEAD! Long live PHP!Patrick Fitzgerald11/03/02 12:57
Wow... Needs lots of improvementeruanno10/22/02 09:52
RE: Templates are DEAD! Long live PHP!Michael Sinclair10/14/02 15:07
RE: Templates are DEAD! Long live PHP!Harry Fuecks10/09/02 06:05
This is what I would doJoe10/07/02 02:33
RE: Templates are DEAD! Long live PHP!Michael Sinclair10/06/02 08:31
RE: Templates are DEAD! Long live PHP!haj10/02/02 02:44
RE: Whats wrong with FastTemplate or phplibhaj10/02/02 02:36
RE: Templates are DEAD! Long live PHP!M. Thornton09/30/02 14:55
RE: Templates are DEAD! Long live PHP!Harry Fuecks09/29/02 08:13
RE: Templates are DEAD! Long live PHP!bigSys09/28/02 11:48
RE: Templates are DEAD! Long live PHP!c-dawg09/27/02 19:35
PHP replication of Zope and JSP for templatigMichael Glazer09/27/02 17:49
RE: Don't be too criticalBDKR09/27/02 11:06
RE: Templates are DEAD! Long live PHP!Adalberto09/27/02 10:54
RE: NEED HELP URGENTLY, PLEASEadd php project09/25/02 05:49
NEED HELP URGENTLY, PLEASEEddieson09/24/02 12:00
RE: Templates are DEAD! Long live PHP!dotwebbie09/23/02 11:40
The best template engine is SmartyOskars09/21/02 16:32
patTemplateMitchell Landry09/21/02 02:14
RE: Templates are DEAD! Long live PHP!Harry Fuecks09/20/02 06:45
RE: Whats wrong with FastTemplate or phplibZpiff09/20/02 04:32
RE: Templates are DEAD! Long live PHP!Yuriy Horobey09/19/02 02:31
Templates are DEAD! Long live PHP!Harry Fuecks09/18/02 12:21
RE: Whats wrong with FastTemplate or phplibanimosity09/18/02 12:19
Don't be too criticalJason09/18/02 09:21
RE: why notTom Anderson09/16/02 12:06
Uhm... ya.. ok...Vincent09/15/02 08:38
one more thingAivar Annamaa09/15/02 04:34
ComplexTemplateAivar Annamaa09/15/02 03:55
RE: why notClaudio Bustos09/14/02 16:26
RE: why notkybosh09/13/02 19:54
why notPhynias09/13/02 11:22
Whats wrong with FastTemplate or phplibZpiff09/11/02 08:24
why not simply use patTemplate or alike?NightOwl09/11/02 02:41
just use vlibTemplateKelvin Jones09/10/02 04:31
Ignore this article: save brain cells.Tom Anderson09/09/02 15:23
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.