ruilong Posted December 7, 2008 Share Posted December 7, 2008 Recently I have been working on a prestashop theme and the client wanted to use different layouts on different pages,Mainly the category page and product page should not use the right column, instead it should only have two columns.Too accomplish this, I had to change some of the "core" files, maybe there is a better way to do this, but anyhow, here is how I did it./category.phpIn this file I changed the line include(dirname(__FILE__).'/header.php'); to include(dirname(__FILE__).'/headerwide.php'); and in the bottom include(dirname(__FILE__).'/footer.php'); to include(dirname(__FILE__).'/footer_wide.php'); this will override the loading of the original header.php and footer.php on category page.I created a new file in / called headerwide.php that is a copy of header.php with the difference $smarty->display(_PS_THEME_DIR_.'headerwide.tpl'); instead of $smarty->display(_PS_THEME_DIR_.'header.tpl'); headerwide.tpl was now changed to set different id on the center_column so that I could modify the css to make it wider.footer_wide.php placed under / was also added, this file contains <?php if (isset($smarty)) { $smarty->assign(array( 'HOOK_FOOTER' => Module::hookExec('footer'))); $smarty->display(_PS_THEME_DIR_.'footer_wide.tpl'); } ?> This will have the effect that the right hook is not loadedfooter_wide.tpl in the theme folder looks like this <!-- Footer --> {$HOOK_FOOTER} </body> </html> now the right column have been removed on the category page.hope it helps someone Remember that if you upgrade after this, you will have to change the php files under / again. Link to comment Share on other sites More sharing options...
jhnstcks Posted December 7, 2008 Share Posted December 7, 2008 You could just use the css file to change the category.tpl div to not show the right column as I have posted in the code example below. /* category.tpl */ #category #right_column { display: none; } #category #center_column { width: 730px; text-align: justify;} The end result to this would be that the center column would stretch across the right column space.The product.tpl page would be more complex as you would have to redesign the whole page to use the extra space. 1 Link to comment Share on other sites More sharing options...
ruilong Posted December 7, 2008 Author Share Posted December 7, 2008 thanks for the tip, I'm gonna try that next time I need to change to only two columns on separate pages, however, my "tip" can be used if someone wants to modify totaly different designs on different pages, maybe they want to change more than just the number of columns. Link to comment Share on other sites More sharing options...
Paul C Posted December 7, 2008 Share Posted December 7, 2008 I created different css styles and just used them in the template files, so content and content_wide classes or even a class specific to a particular page.Paul Link to comment Share on other sites More sharing options...
rafy Posted January 9, 2011 Share Posted January 9, 2011 this i just what i was looking for!thanks man! 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