Search the Community
Showing results for tags 'cms page ids'.
-
Today I was looking for a good solution to add a class sector to my body tag that would display the CMS page ID's. My goal was to create custom styles for individual CMS pages. If you've ever tried to use styles within a CMS page you know that the editor strips out the <style> html code. Now I know there's most likely a fix to allow these html code to be used within the editor, but I figured this fix would allow for more flexibility with design. Below are the steps I used to accomplish this. Currently using PrestaShop Version 1.4.7 Longhand Method - Original Post Step 1 - Open classes/FrontController.php Replace line 475 'content_only' => (int)Tools::getValue('content_only') with 'content_only' => (int)Tools::getValue('content_only'), 'cms_class' =>(int)Tools::getValue('id_cms') Step 2 - Open themes/(yourtheme)/header.tpl Replace line (465 [may very depending on theme]) <body {if $page_name}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if}> with <body {if $page_name}id="{$page_name|escape:'htmlall':'UTF-8'}" {/if} {if $page_name =='cms'} class="cms{$cms_class}"{/if}> That's it! Now you should see body tags on CMS pages that look something like this. <body class="cms7" id="cms"> Edit: After making this post both vekia & Burhan BVK pointed out there is a much easier and simple way to accomplish what is above. Below is the shorthand version accomplishing the same task; adding CMS page ID's to class Selector. Thanks vekia & Burhan BVK! 1 Step Method - Open themes/(yourtheme)/header.tpl Replace line (465 [may very depending on theme]) <body {if $page_name}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if}> with <body {if $page_name}id="{$page_name|escape:'htmlall':'UTF-8'}" {/if} {if $page_name =='cms' && Tools::getValue('id_cms')}class="cms{Tools::getValue('id_cms')}"{/if}> That's it! Now you should see body tags on CMS pages that look something like this. <body class="cms7" id="cms"> Hope this helps. Please let me know if you have any question.
- 9 replies
-
- 1
-
- 1.4.7
- cms page ids
-
(and 2 more)
Tagged with: