Jump to content

Philosophical question about CMS BLOCK


LauraPresta

Recommended Posts

Why you can't do it: There is no hook function defined for the DisplayHome hook. You specifically have to add this.

 

As an example, I just copy the hook from the footer and modify the presentation of it in css, to put it in one line, instead of one column:

 

Here we go:

 

Edit, or better, override modules/blockcms/blockcms.php:

 

add this: (sample code from PrestaShop 1.6.0.14) (for example, just below public function hookLeftColumn()

 
 
public function hookHome()
{
return $this->displayBlockCMS(BlockCMSModel::FOOTER);
}
 
 
Then, in themes/<your theme folder>/css/global.css, you can add this (just at the end):
 
#center_column section#block_various_links_footer{

    width: 100%;   // <-- Give the cms items the full width available

}
 
 
#center_column #block_various_links_footer h4 {

    text-align: center;    // put the header in the center of the screen

}
 
#center_column #block_various_links_footer li.item, #center_column #block_various_links_footer li {
    display: inline-table;         // <-- put them all in one line. This is probably what you want

 

    border: 3px solid #D6D6D6;     // <-- sample of some silly decoration. Modify as needed

    min-width: 75px;

    text-align: center;

   padding: 0 5px;

}
 
 
Finally go to modules->positions, and choose CMS block module and hook to DisplayHome. Reload the front page and you will hopefully see something like this:
 
post-455771-0-13266500-1428156453_thumb.png
 
 
Well, that should basically be it. You can of course make an extended version by adding a new type instead of FOOTER, with its own bells and whistles. Just have a look at the cmsblock.php code what they are doing.
 
 
Hope you like it,
pascal
  • Like 1
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...