Jump to content

Show cms in custom template page


ArthurianX

Recommended Posts

Hello, I want to be able cu call a cms id in a custom page.

In my case the newly created template page is media.php.

How can I call let's say two cms pages, I am thinking wordpress style now, get page content by id, the cms page have Id, I just have no idea how to call them wherever I want in my template.

Is it possible? And how? :)

Thanks!

Link to comment
Share on other sites

Honestly now, it's been a few months since I am posting few of my problems here, and absolutely no one answers to ANY of my questions.

Not even a "Use paid support" or anything for that matter, are my problems so complicated, or what's the deal on these forums?

Link to comment
Share on other sites

MY big problem is that I do not have PHP programming skills, I am a front end developer, my logic and basic php knowledge tells me that I only have to select from the database the coresponding ID to the cms I want.

Here's a screenshot: http://screencast.com/t/Nzk1NTVl

The database connection is already established in config.inc.php, oh well, I am hopeless :)

Thanks for the reply!! You're the first:)

Link to comment
Share on other sites

this is the code:

{if $cms}


{$cms->content}

{else}
{l s='This page does not exist.'}
{/if}

This is the interesting line, {$cms->content}, I guess the the content is shown through the post command, the post send a number, cms ID, and the ->content gets that ID, logic, logic, no skills in php :))
Link to comment
Share on other sites

From that screenshot, it appears that you are trying add add blocks of text to the footer that can be edited in the Back Office. To do this, you could add code like the following before line 5 of footer.php in the root directory of PrestaShop:

$footer_left = new CMS(1, intval($cookie->id_lang));

if (Validate::isLoadedObject($footer_left))
  $smarty->assign('footer_left', $footer_left);

$footer_right = new CMS(2, intval($cookie->id_lang));

if (Validate::isLoadedObject($footer_right))
  $smarty->assign('footer_right', $footer_right);



Change 1 to the ID of the CMS page you want displayed in the left column of the footer and 2 to the ID of the CMS page you want displayed in the right column of the footer. You can then use the following in footer.tpl in your theme's directory wherever you want the content to appear:

{$footer_left->content}
{$footer_right->content}

Link to comment
Share on other sites

  • 2 months later...
  • 4 months later...

Hi,

The above is great and I can get it to work with the footer of may pages but I want the content of a cms page to appear on my homepage? I've tried using the same code in index.php and index.tpl but no luck anybody got any other ideas?

Thanks

Jon

Link to comment
Share on other sites

  • 2 years later...

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