Jump to content

Changing home page layout *only*


Recommended Posts

Hi. I need to make a single-column layout on the home page only. My idea is to make a custom page home.php and home.tpl. Prestashop already has a hook for "home" which is !$this->registerHook('home'). Is there a way to make it so that anything that uses this home hook goes to my home.php page? In other words, how can I tell Prestashop to use my custom page for the home page instead of the default? (Like Wordpress does).

Or is there a better way to change the layout for the home page only?

Any help would be greatly appreciated...thanks!

Link to comment
Share on other sites

Ok, I followed the instructions in comment #14 of http://www.prestashop.com/forums/viewthread/7120/themes/solved_glosspro_theme here on the forum and changed the footer.tpl to this:

{if $page_name!='index'}

               {$HOOK_RIGHT_COLUMN}


                {else}
 

{/if} 



I want a single-column layout on home and 2-col on rest, so I commented out the left column and added this code which says to add the right column on every page but the home.

Two comments about the above code:

1. note the

!=

means every page BUT the home (index). It took me a bit to realize that it wasn't just an

=

sign.

2. I added the CSS

display:none

because it seemed that I should somehow indicate that there shouldn't be a right column on the home page. The other examples merely widened the center column but I wanted to be sure that the div for the right column wasn't there at all.

This is working well for now, but I'm still not sure it's going to do everything I need. If anyone has any tweaks or comments about the workaround above, please let me know!

Link to comment
Share on other sites

Do you mean the html <body> tag? That you can add the id attribute to it?

So in the html <body id="index"> and in the CSS, #index right_column {display:none;} or something like that?

Part of what I'd like to do is to be able to add a div to the home page that is 2-columns that would be below the 1-column section. Being able to include another tpl file just for this would be nice. I tried putting an include in the theme footer.tpl, but couldn't figure it out.

I did find that if I put
$smarty->display(_PS_THEME_DIR_.'home.tpl');
in the root index.php file, that did work. I would like to figure out a way to do this without changing that root index.php file, though, cause isn't that going to be overwritten with upgrades?

Thanks for any further suggestions. I've read all the docs on your site, by the way, and wanted to thank you for providing them. My background is with Wordpress, which being a little older, has explanations and instructions for everything in English. Guess I was a little spoiled, as it's hard to reverse engineer PrestaShop or figure everything out by trial and error.

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...