Re: [SMARTY] Multiple usage of one template within one page

From: Date: Wed, 10 Nov 2004 08:27:30 +0000
Subject: Re: [SMARTY] Multiple usage of one template within one page
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11954@lists.php.net to get a copy of this message
Hello, Try to do an append instead of assign for your arrays usul > Message du 10/11/04 07:30 > De : "ON.KG" > A : smarty-general@lists.php.net > Copie à : > Objet : [SMARTY] Multiple usage of one template within one page > Hi! > > I have template of form. Result of this template depends on data, > which it gets from assignment from my script: > > Examples: > > page_body.tpl > -------- Starts > > > ...... > > > > > {include file="$first_form"} > {include file="$second_form"} > > > -------- Ends > > > form.tpl > -------- Starts > > > {* Form Elements *} > {section name=form loop=$form_elements} > > name="{$form_elements[form].name}" > value="{$form_elements[form].value}"> > {/section} > > > -------- Ends > > > form.php > -------- Starts > > > include("Smarty.class.php") > $tpl = new Smarty; > ................. > > // First Form > $tpl->assign(array( > 'form_action' => $PHP_SELF, > 'form_name' => 'form1', > ...... > 'form_elements' => $form_elements > )); > $tpl->assign('first_form', 'form.tpl'); > > // Second Form > $tpl->assign(array( > 'form_action' => 'other.php', > 'form_name' => 'form2', > ...... > 'form_elements' => $form_elements2 > )); > $tpl->assign('second_form', 'form.tpl'); > > $tpl->display('page_body.tpl'); > ?> > -------- Ends > > > Output: > -------- Starts > > > ...... > > > > > > > > ... > > > > > ... > > > > > -------- Ends > > It displays TWO same forms, which defined at second time in my 'form.php' > > How to make this work correctly - I need to get TWO different forms on one page > > Thanks! > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >

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