koala_dev Posted September 7, 2013 Share Posted September 7, 2013 Hi, I just started developing for Prestashop and I'm looking for the best way to implement different layout templates for different pages, for example I want my front page to have no columns, just the wrapper container but the category pages should have a two column layout. Looking at the `header.tpl` template of the default theme, I see it always builds the three column layout and uses the variables `$hide_left_column` and `$hide_right_column` to apply a CSS class and hide them accordingly. I'm searching for a way to define a different template file, i.e. `header_container_only`, `header_2columns` for different pages, what would be the best approach for this? Also where are the `$hide_left_column` and $hide_right_column` variables defined for each page? Link to comment Share on other sites More sharing options...
Dreamtheme Posted September 7, 2013 Share Posted September 7, 2013 Hi there, You just need to edit module positions in the back office. To hide the "column" on the index, you just add exceptions in modules. For example, go to modules, then module positions, find "left column modules" click edit on "block categories left" and add exception not to show on index. In this way, when you hide all blocks from the column, the column will be hidden and you will get one column index. Other methos is css, but the one i described is better. Link to comment Share on other sites More sharing options...
vekia Posted September 7, 2013 Share Posted September 7, 2013 Hi, I just started developing for Prestashop and I'm looking for the best way to implement different layout templates for different pages, for example I want my front page to have no columns, just the wrapper container but the category pages should have a two column layout. read this: one column homepage prestashop tutorial - you can remove these columns with hooks, then save it like header_onecolumn.tpl then, in classes/controller/FrontController.php you have to edit this line: $this->smartyOutputContent(_PS_THEME_DIR_.'header.tpl'); add there if conditions to check what "kind" of page customer browsing. you can add as many if coditions as you want, and define as many template files as you want too 1 Link to comment Share on other sites More sharing options...
sttaq Posted April 10, 2014 Share Posted April 10, 2014 read this: one column homepage prestashop tutorial - you can remove these columns with hooks, then save it like header_onecolumn.tpl then, in classes/controller/FrontController.php you have to edit this line: $this->smartyOutputContent(_PS_THEME_DIR_.'header.tpl'); add there if conditions to check what "kind" of page customer browsing. you can add as many if coditions as you want, and define as many template files as you want too Can you please give an example of a condition to check "kind" of page? Link to comment Share on other sites More sharing options...
sttaq Posted April 10, 2014 Share Posted April 10, 2014 Just found how to do this, here is an example: In the themes folder open your layout.tpl and then use the following logic to decide which header file you want to use for a specified page. {if !empty($display_header) && $page_name != 'index'} {include file="$tpl_dir./header.tpl" HOOK_HEADER=$HOOK_HEADER} {else} {include file="$tpl_dir./home_header.tpl" HOOK_HEADER=$HOOK_HEADER} {/if} Link to comment Share on other sites More sharing options...
vekia Posted April 10, 2014 Share Posted April 10, 2014 is enough to use {if $page_name!="index"} {/if} 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