Re: Other directories and Smarty

From: Date: Thu, 22 Feb 2001 15:33:03 +0000
Subject: Re: Other directories and Smarty
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-193@lists.php.net to get a copy of this message
You're right. It was me missing the point :) However, I have another approach for using common templates. Instead of 'including' a template into another template, we create two Smarty classes (see below) and use something like this: $common_template = new Common_Smarty; // The one with common template dir $body_template = new Smarty; // The default Smarty settings ... $body = $body_template->fetch("body_template.tpl") $common_template->assign("body", $body); $common_template->display(common_site_template.tpl); The original question is still not answered, but what I meant was to give a solution to _avoid_ the question ;-) > but then how would > they include a template from another directory from within the > application template? Joris NL ----- Original Message ----- From: "Monte Ohrt" <monte@ispi.net> To: "Joris Trooster / Interstroom" <trooster@interstroom.nl> Cc: <smarty@lists.ispi.net> Sent: Thursday, February 22, 2001 4:19 PM Subject: Re: [smarty] Re: Other directories and Smarty > Maybe I'm missing something here (it's early), but then how would > they include a template from another directory from within the > application template? > > Joris Trooster / Interstroom wrote: > > > > > 2. I would like to be able to share these tempaltes, via an include > > > statement, but it will not work as I cannot point Smarty to use another > > > template dir > > > > You can inherit the Smarty class, and change the desired variables : > > > > class Common_Smarty extends Smarty { > > var $template_dir = "/path/to/common/templates"; > > var $compile_dir = "/path/to/common/templates_c"; > > } > > > > Now use template = new Common_Smarty; for the common templates. > > > > Joris. > > > > --- > > You are currently subscribed to smarty as: monte@ispi.net > > To unsubscribe send a blank email to $subst('Email.Unsub') > > Visit Smarty's homepage at > > http://www.phpinsider.com/php/code/Smarty/ > > -- > Monte Ohrt <monte@ispi.net> > http://www.ispi.net/ >

« previous php.smarty.general (#193) next »