Re: [SMARTY] modularizing templates, ala 'BLOGS'
| From: | Dennis Gearon | Date: | Tue, 11 Feb 2003 22:59:36 +0000 |
| Subject: | Re: [SMARTY] modularizing templates, ala 'BLOGS' | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7660@lists.php.net to get a copy of this message | ||
I meant for positioning on the page, a master template would hold the placeholders for all the
modules.
2/11/2003 2:22:41 PM, Monte Ohrt <monte@ispi.net> wrote:
>What do you mean by master template? You can include them from any
>template.
>
>Monte
>
>On Tue, 2003-02-11 at 15:48, Dennis Gearon wrote:
>> Going back to this,
>>
>> I would have to include the modules from within a MASTER template, right?
>>
>> 2/11/2003 10:21:49 AM, Monte Ohrt <monte@ispi.net> wrote:
>>
>> >
>> >First separate each module into its own template. Anytime you want a
>> >module on your page, you just include it:
>> >
>> >{include file="weather.tpl"}
>> >
>> >Now to make this a true standalone module, you need to load the content
>> >into the template at the time it gets included.
>> >
>> >I'd recommend these two methods:
>> >
>> >1) use {include_php file="load_weather.php"} at the top of your weather
>> >template. This would be a php script that does the duty of
>> >loading/assigning the weather content. It might look like this:
>> >
>> ><?php
>> > global $sql;
>> > // get weather data from db
>> > $sql->query("select * from weather", SQL_ALL);
>> > // assign it to the current smarty object
>> > $this->assign('weather_data', $sql->results);
>> >?>
>> >
>> >2) in Smarty 2.4.0, you can use a registered/assigned object to do the
>> >same task {weather->getinfo} or {$weather->getinfo()}
>> >
>> >Then after the content is loaded, the template displays the content as
>> >usual.
>> >
>> >Monte
>> >
>> >On Tue, 2003-02-11 at 10:50, Dennis Gearon wrote:
>> >> Anyone got any links or comments on how to do pages like BLOGS do where different
>> >> modules
>> handle
>> >> different parts of the display?
>> >>
>> >> For example, like PHPNuke/PostNuke has a weather posting module, a login module, a
>> >>
horoscope
>> >> module, a survey module, etc?
>> >>
>> >>
>> >
>> >
>> >
>>
>--
>Monte Ohrt <monte@ispi.net>
>
>