RE: [SMARTY] Re: passing an array to an included template
| From: | mark priatel | Date: | Fri, 03 May 2002 16:39:42 +0000 |
| Subject: | RE: [SMARTY] Re: passing an array to an included template | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-4042@lists.php.net to get a copy of this message | ||
I've had to tackle the same problem you're trying to solve (check out
www.klipfarm.com & www.serence.com, if interested). In addition to
specifying elements of a navigation I had to allow my template designers
to specify which element was rendered as 'selected' for each page.
I also only use 1 .php page to render the entire site, distributing
business logic to 'action bundles'.
My solution was to create a {topnav} plugin which would look something
like this:
{topnav config_file=#topnav_file# selected=#topnav_selected#}
config file would point to a text file which looked something like this:
home = home
products = products_home
solutions = solutions_home
klipfarm = http://www.klipfarm.com
...where left hand side was the base image name to be rendered (based on
our own internal naming convention, eg home.gif, home_over.gif,
home_selected.gif), and the right hand side is the target href (again,
based on an internal convention)
My CMS allows template designers to define pages through Smarty config
files where each section represents a page. Among other properties,
they can specify a 'topnav_file' & 'topnav_selected' config parameter
for each page, if needed. (topnav_file is usually set as a global
parameter -- quite handy)
As a result, they never need to touch the topnav tag, and if they want
to add or remove topnav links, the plugin takes care of rendering it
properly, adding javascript over states, etc. All they need to do is
tell it the name of the link and where it goes to. They seem to find
the system quite intuitive.
At any rate, I think your solution probably lies somewhere between
creating a custom plugin and figuring out where to assign information.
I can provide more detailed examples, if you like.
-mark
> -----Original Message-----
> From: Jens Lehmann [mailto:newsgroup@developerforum.net]
> Sent: Friday, May 03, 2002 12:01 PM
> To: smarty-general@lists.php.net
> Subject: Re: [SMARTY] Re: passing an array to an included template
>
>
> > Yep. I still can't understand Jens' "problem", because it's
> > selfmade
by
> > unlogical separating of content and templates.
>
> I thought about this for a while.
>
> I've got an english and a german template for every PHP-file I have.
> The consequence is, that I don't assign any content within PHP.
> Do you (Norbert and Monte) think this strategy is a misuse of Smarty
> in general or is it just a specific problem with the navigation-bar?
> Or maybe I should better ask what is the difference between the
> navigation-bar and other template-content?
>
> Jens
>
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php