RE: Basic Question: Best practices of site building.
| From: | LIMBOURG Arnaud | Date: | Wed, 21 Nov 2001 08:42:51 +0000 |
| Subject: | RE: Basic Question: Best practices of site building. | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-1997@lists.php.net to get a copy of this message | ||
Hello,
Jason has a nice way to do that. I'll try to explain and Jason can flame me
if i'm wrong ;))
I'll just copy and paste here ;)))))))
-------------------------------------------------------
$module = get_module_name_from_somewhere(); // From the DB, likely
include "$module.php";
$module_object = new $module;
$html = $module_object->get_HTML();
$layout = new Smarty;
$layout->assign('PLACEHOLDER', $html);
$layout->display('layout.tpl');
-------------------------------------------------------
> Hi,
>
> To learn a bit more about Smarty I've decided to convert my site
> <http://www.mapledesign.co.uk> to using the Smarty
> template system.
>
> Basically the site at the moment is static HTML pages, with a
> few dynamic
> ones thrown in. For a site with many .tpl, what's the best
> way to generate
> it using smarty? I've thought of the following, but would
> like to know
> what others have done.
>
> Redirect all requests through one file (as per
>
> <http://phpbuilder.com/columns/tim20000526.php3?print_mode=1>
> or
> <http://phpbuilder.com/annotate/message.php3?id=1006517>)
> Advantages:
> - only one/a small number of pages to maintain
> Disadvantages:
> - less control
> - looks messy (the extra directory needed)
>
> Have separate PHP pages for each existing page.
> Advantages:
> - full control over each page
> Disadvantages:
> - many files to maintain & edit.
> - too much repetition of code
>
> Some other method which I cannot think of.
>
> Some of you must have worked out a decent way of doing this,
> so I'm looking
> forward to hearing it ;-)
>
> Also, how do you treat custom content on the side-menus which
> appears on
> certain pages? For example, in the documentation section I
> need to have
> the chapter listing in the side-bar (the darker bar on the
> left-side of
> each page). I don't want to make a separate header.tpl for
> this section,
> as that's one more file to have to update. In other places
> on the site
> I'll also need a custom side-bar. Any suggestions?
>
> Thanks,
> Peter.
>
> --oOo--
> Narrow Gauge on the web - photos, directory and forums!
> http://www.narrow-gauge.co.uk
> --oOo--
> Peter's web page - Scottish narrow gauge in 009
> http://members.aol.com/reywob/
> --oOo--
>
>
> ---
> You are currently subscribed to smarty as: arnaud.limbourg@cegetel.fr
> To unsubscribe send a blank email to
> $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
>