Jump to content

Displaying a CMS page in my module (PS1.4)


Recommended Posts

English is not my first language.

I'm using Prestashop

I know PHP but only know a little about OOP (I'm here to learn).


Hi everyone,


I'm kind of new to this forum but something tells me that I might come here often in a near future.


I've created a little module hooked on my homepage and I want to display the content of a CMS page. Nothing fancy here, I will use the 'id' of the page to do this.


I've tried several things already but nothing really worked. I know that I need to get the content in the 'mymodule.php' file and then 'send' it to the 'mymodule.tpl' but can't manage to make it work.


Could anyone show me how to do this? Also, if it's possible, I'd like to know how it's done in PS1.5.


I'm really trying to learn how Prestashop works, and at the same time learning more about OOP.



Thank you very much!


Link to comment
Share on other sites

you might consider using jquery to load the content into a <div> element, similar to the way the terms of service content is loaded during checkout.


Instead of loading the content from within the module and displaying it in the template, you could just have the content loaded directly into a <div> element. If you use the "content_only=1" parameter, then only the cms content will be retrieved without any header or footer.


For example http://www.bellini-s...?content_only=1


The following code will retrieve the terms and conditions URL, and then append the content_only parameter to the end. You could place this into the module code

$cms = new CMS((int)(Configuration::get('PS_CONDITIONS_CMS_ID')), (int)(self::$cookie->id_lang));
$link_conditions = self::$link->getCMSLink($cms, $cms->link_rewrite, true);
if (!strpos($link_conditions, '?'))
$link_conditions .= '?content_only=1';
$link_conditions .= '&content_only=1';

self::$smarty->assign(array('link_conditions' => $link_conditions));


Then in your template file you could do something like this, which will load the cms content directly into the <div> element

<div id="content"></div>

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