Thursday 30 July 2009 8:55:53 am
I am trying to find the best method to process my template, in a nutshell part of my webapp extension is getting contact information from the customer, eg isMailContactAllowed, isPhoneContactAllowed, isSmsContactAllowed etc
When I get the query results back from the database I then want to display them on the template for the customer. so if they are true contact is allowed etc etc.
so at the moment I fell my method is not entirely efficient. and I would like to know some better method to proccess this data to the template. this is how my code is on the ModuleView for Contact
if ($enet_cust->getMailContactAllowed() == true)
{
$option = true;
$oagContactByMail = 1;
}
else
{
$option = true;
$oagNoContactByMail = 1; }
$tpl = templateInit();
$tpl->setVariable('option',$option);
$tpl->setVariable('oagContactByMail',$oagContactByMail);
$tpl->setVariable('oagNoContactByMail',$oagNoContactByMail);
$Result = array();
$Result['content'] = $tpl->fetch ( 'design:managemodule/contactoptions.tpl' ); then on my template I have something like this
{section show=$option}
{section show=or($oagContactByMail,$oagNoContactByMail,$oagContactByPhone,$oagContactByEmail,$oagContactBySms,$oagContactByFax)}
{section show=$oagContactByMail}<label>{"Contact me by Mail"|i18n("design/standard/user")}</label><div class="labelbreak"></div>{/section} {section show=$oagNoContactByMail}<label>{"Don't Contact me by Mail"|i18n("design/standard/user")}</label><div class="labelbreak"></div>{/section}
{/section} {/section} I know this works but is it the right way to go about this????
|