Jump to content

Include "core page" in my custom module page


frankit
 Share

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More