frankit Posted November 18, 2013 Share Posted November 18, 2013 Ok, I know I can include a cms page using CMS() function and append its ->content to the smarty vars of my page, and that's exactly what I would like to do but, with a "core page" (i.e. the contact page) instead of a cms one. Don't want to use smarty to include php pages from tpl. Wich is the proper way to do that? Thank you all. Link to comment Share on other sites More sharing options...
vekia Posted November 18, 2013 Share Posted November 18, 2013 can you explain.. what and where you want to display? i know what, but don't know where Link to comment Share on other sites More sharing options...
frankit Posted November 19, 2013 Author Share Posted November 19, 2013 can you explain.. what and where you want to display? i know what, but don't know where Sorry, I thought the title was clear enought: - include (what) "core page" in (where) my custom module page - but let me explain it better. I created a new module and its custom page that basically is just a set of bootstrap tabs that include a cms page for each tab, so that in the backend it's possible to edit each tab as a single cms article instead of editing all the tabs together as a signle article. here's my module page: <?php Class customercareTabsModuleFrontController extends ModuleFrontController { public function initContent() { parent::initContent(); $pagine = array( 'shopping' => 12, 'prodotti' => 14, 'spedizione' => 15, 'iltuoaccount' => 16, 'faq' => 17/*, 'contattaci' => 5,*/ ); foreach ($pagine as $nome => $id){ $cms = new CMS($id, intval($this->context->cookie->id_lang)); if (Validate::isLoadedObject($cms)) $this->context->smarty->assign($nome, $cms->content); } $this->setTemplate('tabs.tpl'); } } and here its tpl: <ul class="nav nav-tabs"> <li class="active"><a href="#tab1" data-toggle="tab">{l s='Shopping'}</a></li> <li><a href="#tab2" data-toggle="tab">{l s='Prodotti'}</a></li> <li><a href="#tab3" data-toggle="tab">{l s='Spedizione'}</a></li> <li><a href="#tab4" data-toggle="tab">{l s='Il tuo account'}</a></li> <li><a href="#tab5" data-toggle="tab">{l s='FAQ'}</a></li> <li><a href="#tab6" data-toggle="tab">{l s='Contattaci'}</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tab1"><p>{$shopping}</p></div> <div class="tab-pane" id="tab2"><p>{$prodotti}</p></div> <div class="tab-pane" id="tab3"><p>{$spedizione}</p></div> <div class="tab-pane" id="tab4"><p>{$iltuoaccount}</p></div> <div class="tab-pane" id="tab5"><p>{$faq}</p></div> <div class="tab-pane" id="tab6"><p>{include file="$tpl_dir./contact-form.tpl"}</p></div> </div> Now you should see, I would like to include (what) the contact form page in (where) the #tab6, where I tried to include just its tpl with {include file}, and it would be great if I can do that assignin the contact page to the smarty vars exactly as I did for the cms pages. Link to comment Share on other sites More sharing options...
vekia Posted November 19, 2013 Share Posted November 19, 2013 you have to pass also variables for contact-form.tpl, exactly the same variables as you passing /controllers/front/contactcontroller.php Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now