Oncilla Posted April 5, 2010 Share Posted April 5, 2010 What's the best way to create a simple custom page inside PrestaShop that includes just the header, the footer and some custom content in between? I assume I can just copy an already existing PHP and corresponding TPL file, rename them and then edit them like that? Which is the best one to copy? Link to comment Share on other sites More sharing options...
rocky Posted April 6, 2010 Share Posted April 6, 2010 I think prices-drop.php is a pretty simple page that you can use as a guide for what to do, though it doesn't import init.php. Here's a template you can use: <?php include(dirname(__FILE__).'/config/config.inc.php'); include(dirname(__FILE__).'/init.php'); include(dirname(__FILE__).'/header.php'); $smarty->assign(array('variable1' => 'value1', 'variable2', 'value2')); $smarty->display(_PS_THEME_DIR_.'custom.tpl'); include(dirname(__FILE__).'/footer.php'); ?> This code will make all of Prestashop's variables accessible to your template, display the header, call the custom template in your theme (passing variable1 and variable2 into the custom template) for the content of the page, then display the footer. Link to comment Share on other sites More sharing options...
Oncilla Posted April 6, 2010 Author Share Posted April 6, 2010 Excuse my noobiness, but just so I know, what do the following two lines mean?include(dirname(__FILE__).'/init.php'); - What is init.php?$smarty->assign(array('variable1' => 'value1', 'variable2', 'value2')); - What are these variables?Cheers! Link to comment Share on other sites More sharing options...
rocky Posted April 6, 2010 Share Posted April 6, 2010 The file init.php declares many of Prestashop's variables like $cookie, which will allow your custom.tpl to access lots of useful information. On the second line, I made up variable1 and variable2 to show you how to pass your own custom variables into custom.tpl. Link to comment Share on other sites More sharing options...
Oncilla Posted April 6, 2010 Author Share Posted April 6, 2010 Oh ok, great.Thanks very much for your help! Legend. Link to comment Share on other sites More sharing options...
rocky Posted April 6, 2010 Share Posted April 6, 2010 If this has solved your question, please edit your first post and add [sOLVED] to the front of the title. 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