Skip to content

Instantly share code, notes, and snippets.

@hassadee
Last active September 9, 2017 02:57
Show Gist options
  • Select an option

  • Save hassadee/ee7ae5136b60ea904185 to your computer and use it in GitHub Desktop.

Select an option

Save hassadee/ee7ae5136b60ea904185 to your computer and use it in GitHub Desktop.
[PrestaShop Tips] How to get a CMS page title, description, or content in a TPL file
{*
* Usage (Get title): Tools::getCMSTitle($id_cms, $cookie->id_lang)
* Usage (Get Description): Tools::getCMSDescription($id_cms, $cookie->id_lang)
* Usage (Get Content): Tools::getCMSContent($id_cms, $cookie->id_lang)
*}
{* Get CMS Title *}
{Tools::getCMSTitle(1, $cookie->id_lang)}
{* Get CMS Description *}
{Tools::getCMSDescription(1, $cookie->id_lang)}
{* Get CMS Content *}
{Tools::getCMSContent(1, $cookie->id_lang)}
/**
* Get CMS Title.
*/
public static function getCMSTitle($id_cms,$id_lang){
$cms = new CMS($id_cms, $id_lang);
return $cms->meta_title;
}
/**
* Get CMS Description.
*/
public static function getCMSDescription($id_cms, $id_lang){
$cms = new CMS($id_cms, $id_lang);
return $cms->meta_description;
}
/**
* Get CMS Content.
*/
public static function getCMSContent($id_cms, $id_lang){
$cms = new CMS($id_cms, $id_lang);
return $cms->content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment