Jump to content

New to presta, new to smarty


sackling

Recommended Posts

I decided to take a look at how things work in the basic theme. and I decided to checkout the homeslider to start.

 

I am looking at homeslider.tpl and the first thing I see is that it checks to see if the variable$ homeslider_slides isset. 

 

That's fine and all. but I can't seem to find the variable homeslider_slides in any php files. Or in any of the other files for that matter. 

 

Where is it defined?

 

I then decided to just checkout index.tpl and I see $HOOK_HOME_TAB_CONTENT

 

Another variable I can't find defined anywhere. 

 

So clearly I am the fool here. But I still don't understand smarty nearly at all. 

 

Thanks for some help!

Link to comment
Share on other sites

I suggest you to use an IDE like Eclipse so you have all the prestashop shop in one project

 

That way you can search inside the entire project, and filter by file types..etc

 

So for example searching I've found that

 

modules\homeslider\homeslider.php in line 644 (ps1562)

$this->smarty->assign('homeslider_slides', $slides);
$this->smarty->assign('homeslider', $slider);

In index.tpl I have {$HOOK_HOME} which is fulfilled in controllers\front\IndexController.php

class IndexControllerCore extends FrontController
{
	public $php_self = 'index';

	/**
	 * Assign template vars related to page content
	 * @see FrontController::initContent()
	 */
	public function initContent()
	{
		parent::initContent();

		$this->context->smarty->assign('HOOK_HOME', Hook::exec('displayHome'));
		$this->setTemplate(_PS_THEME_DIR_.'index.tpl');
	}
}
Link to comment
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
×
×
  • Create New...