Tuesday, 15 March 2011

In prestashop How to pass a value from a php file into a template file -



In prestashop How to pass a value from a php file into a template file -

in prestashop, in need pass output value stored in variable of php file template file within modules folder.how pass smarty variable resultstring output template fie.

php code

<?php $output = "welcome"; $smarty->assign('resultstring', $output); ?>

template file code

{if $resultstring == 'welcome'} <h6>hai welcome</h6> {else} <h6>not exist </h6> {/if}

i beginner in prestashop, why not intervene maybe can give help.

i think need create controller within of php file (that should locate in root of module folder), like:

<?php class displaycontroller extends modulefrontcontroller { $output = "welcome"; $this->context->smarty->assign('resultstring', $output); public function initcontent() { parent::initcontent(); $this->settemplate('template.tpl'); } }

you can maintain template file is.

ps: newbie idea. please comment me before downvoting me.

php templates prestashop

No comments:

Post a Comment