Re: Parsing one template into another

From: Date: Wed, 26 Sep 2001 09:53:36 +0000
Subject: Re: Parsing one template into another
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1553@lists.php.net to get a copy of this message
Anders Janson wrote: > Peter Bowyer wrote: > > > At 08:30 AM 9/26/01 +0200, Hans-Peter Oeri wrote: > > >What exactly do you mean by "parsing one template into another"? You can > > >easily > > >include templates in templates - that's what the include function is for > > >(there > > >is a smarty include as well as a php include). > > > > Well, at the moment I'd have: > > --- > > <html> > > <head> > > <title>Site Design</title> > > <meta http-equiv="Content-Type" content="text/html; > > charset=iso-8859-1"> > > </head> > > <body bgcolor="#FFFFFF"> > > {CONTENT} > > </body> > > </html> > > ---- > > > > and then for each page I'd have something like: > > ---- > > <p> This would be content but this is a dummy. Your name is {Name}.</p> > > ---- > > > > And so I'd insert that template into {CONTENT} and then display the output. > > > > Can you give me an example as to how this would be done in Smarty? > > Thanks, > > Peter. > > > > Something like this: > > $somepage = new Smarty; > $somepage->assign("Name", ""); Ooops, Forgot to type the name here :) $somepage->assign("Name", "Insert your name here"); is a little better ;) > > $content = $somepage->fetch("somepage.tpl"); > > $design = new Smarty; > $design->assign ("CONTENT", $content); > $design->display('design.tpl'); > > /Anders > >

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