RE: [SMARTY] using smarty across many projects
| From: | Monte Ohrt | Date: | Wed, 15 Jan 2003 19:28:40 +0000 |
| Subject: | RE: [SMARTY] using smarty across many projects | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7202@lists.php.net to get a copy of this message | ||
You only need a separate compile_dir per template_dir.
for instance:
$smarty->template_dir = "/path/to/templates/";
$smarty->display('index.tpl');
$smarty->display('subdir/index.tpl');
These will not conflict. However:
$smarty->template_dir = "/path/to/templates/";
$smarty->display('index.tpl');
$smarty->template_dir = "/different/path/to/templates/";
$smarty->display('index.tpl');
These will conflict, they have the same compile path. Basically, you
should have a separate compile_dir per template_dir to be safe.
Monte
On Wed, 2003-01-15 at 12:21, Hoffman, Geoffrey wrote:
> I'm not 100% sure on this - new to smarty myself...
>
> It makes sense to me that smartyApp1 would need its own set of folders
> distinct from smartyApp2.
>
> But what you're asking now is do you need a distinct template_c folder for
> every index.php in smartyApp1, as in:
>
> /home/
> index.php
> /home/about/
> index.php
> /home/contact/
> index.php
>
> I don't think so. Remember, that on index.php (whichever one you want) you
> do a
> $smarty->display('templatename.tpl')
> and its likely that your index.php in the home directory is going to
> $smarty->display('home.tpl');
> whereas on home/about/ the index.php will do
> $smarty->display('about_us.tpl'); etc.
>
> It's the _templates_ not the index.php that gets compiled, thus you need
> unique template names only.
>
> So if you need more than one .tpl with the same name, you can use the
> optional cache_id parameter, and optional third param for a different
> compile_id.
>
> http://smarty.php.net/manual/en/api.display.php
>
> Monte can likely clarify this...
>
> HTH-
> Geoff
>
>
> > -----Original Message-----
> > From: Jeff Eidsness [mailto:jeidsness@jnjid.com]
> > Sent: Wednesday, January 15, 2003 11:03 AM
> > To: smarty-general@lists.php.net
> > Subject: RE: [SMARTY] using smarty across many projects
> >
> >
> >
> > well, i did in fact read the documentation, and the
> > extended install
> > portion, which is why i was originally confused. it made no sense to
> > me i'd need extra directories for subdirectories.
> >
> > So if i understand everything correct, when i have a
> > multi-directory
> > site/app (thing), i will need to have several template_c directories,
> > because subdirs are likely to have an index.php|html just like the
> > parent.
> >
> > Is this correct?
> >
> > --
> > Jeff Eidsness - CIO / Site manager
> > JnJ International Data, LLC - http://www.jnjid.com/
> >
> >
> > On Wed, 15 Jan 2003 07:06:14 -0700, Hoffman, Geoffrey wrote:
> > >I think your situation is one of the main reasons for the example
> > >'extended
> > >setup' --
> >
> > >>http://smarty.php.net/manual/en/installing.smarty.extended.php....
> > >make each app a separate class that extends smarty, each with its
> > >own set of
> > >directories...
> > >you could do something like:
> > >
> > >/home/smarty/templates/app1
> > >/home/smarty/templates/app2
> > >
> > >or
> > >
> > >/home/smarty/app1/templates
> > >/home/smarty/app2/templates
> > >
> > >HTH-
> > >Geoff
> > >
> > >JE> do i need a separate group of dirs (template_c, config,
> > >JE> cache etc)
> > >JE> for each site? will it keep all the index.php templates separate
> > >for
> > >JE> the different sites?
> > >
> >
> >
> >
> >
> > --
> > Smarty General Mailing List (http://smarty.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
--
Monte Ohrt <monte@ispi.net>