Jump to content

How to edit the HTML source of a CMS generated page


Recommended Posts

Hi there,

I'm trying to create a new FAQ page using CMS tools, and I'd like to use dojo library. I understand I can edit the Header.tpl to add the dojo library import codes, but when I use TinyMCE editor to edit HTML source code, certain dojo specific tags got automatically removed every time I commit the changes. How can I edit the source code of the CMS generated page? or how do I add a new page in PS manually but using PS theme and layout?
Thanks very much!

David

Link to comment
Share on other sites

Sorry - not familiar with CMS and TinyMCE - HOWEVER, I do create pages using the .tpl and .php files. I will try and give an overview, but I may leave something out so feel free to ask.

Step One

In your main prestashop folder create a new php file called whatever you'd like...maybe faq.php.

In your text editor copy in this data and save it... If you don't want the page blocked from those not logged in, delete the two lines...

if (!$cookie->isLogged())
   Tools::redirect('authentication.php'); 


<?php

include(dirname(__FILE__).'/config/config.inc.php');

if(intval(Configuration::get('PS_REWRITING_SETTINGS')) === 1)
   $rewrited_url = __PS_BASE_URI__;

include(dirname(__FILE__).'/header.php');

if (!$cookie->isLogged())
   Tools::redirect('authentication.php'); 

$smarty->assign('HOOK_HOME', Module::hookExec('home'));
$smarty->display(_PS_THEME_DIR_.'faq.tpl');

include(dirname(__FILE__).'/footer.php');

?>



Step Two

In your themes folder that you're using (in my case it's themes/electonix) create a faq.tpl file. If you choose a different page name you need to change that in the code above where "faq.tpl" is.

Copy in this data and play with it however you want. This page you should be able to view in a WYSIWYG editor to a certain extent, but you won't be able to make hardly any css style changes. I have put iFrames, and just text in between the divs with success. Some of my pages have the login requirement. Some do not.

The capture part will be in your breadcrumb, the h2 part will be your heading if your theme uses one. You also may need to edit what is in the tpl file based on your theme. Open a few of the current .tpl files to see if you notice any serious differences or start from one instead of the code below

{capture name=path}{l s='FAQ'}{/capture}
{include file=$tpl_dir./breadcrumb.tpl}

{l s='Frequently Asked Questions'}



  




  • Like 3
Link to comment
Share on other sites

  • 6 months later...
  • 2 months later...
  • 4 months later...
  • 3 months later...

I'm just a newbie but I found this tip useful. I had the same question about how to access the page. I used this method:

 

Alter your blockcms.tpl file in the modules folder (or in your theme folder if you have a custom theme) to add:

 

   <li class="first_item"><a href="{$link->getPageLink('faq.php')}" title="{l s='faq' mod='blockcms'}">{l s='faq' mod='blockcms'}</a></li>

 

after the lines

 

  <!-- MODULE Block footer -->



<ul class="block_various_links" id="block_various_links_footer">

 

Then you will see a link to the faq page in the bottom footer on every page.

Link to comment
Share on other sites

×
×
  • Create New...