Jump to content

Stop-gap CMS


Recommended Posts

Hi,

James posted a solution for adding extra pages using a couple of files.
I've put something together which makes the process a bit easier.

First create a page called cms.php in the prestahop root directory and put this in it:

<?php 
$thepage = ereg_replace("[^A-Za-z0-9]", "", $_GET["pg"] );
include(dirname(__FILE__).'/config/config.inc.php');include(dirname(__FILE__).'/header.php');
@$smarty->display(_PS_THEME_DIR_.'cms_'.stripslashes($thepage).'.tpl');
include(dirname(__FILE__).'/footer.php');
?>



What this does is it brings in the standard header and footer and then calls in the content based on the filename passed in the URL.
So, to create a new "About us" page you would create a file called cms_aboutus.tpl in the theme directory and put all the html in it.

To display it you would type in www.yourdomain.com/cms.php?pg=aboutus
The script cleans the pg variable to stop naughty people from hacking in then it adds "cms_" to the start and .tpl to the end.

Hope this is useful. I'm using it in conjunction with a mini-cms called lilcms (www.lilcms.com) to allow the client to update it.

Link to comment
Share on other sites

Thank you very much!
I use Lil'CMS 2 and it is enough for me before PS team implement cms into Prestashop.

I made it this way:

- LilCMS is installed in mysite.com/cms66/

- Under mysite.com/cms66/content/ folder, I have files like Conditions.txt, Aboutus.txt, ...

- cms.php contains:

<?php 
$thepage = ereg_replace("[^A-Za-z0-9]", "", $_GET["pg"] );
include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/header.php');
$smarty->assign('page', stripslashes($thepage));
$smarty->assign('cmsdir', dirname(__FILE__).'/cms66');

$smarty->display(_PS_THEME_DIR_.'cms.tpl');
include(dirname(__FILE__).'/footer.php');
?> 


- cms.tpl contains:

{include file=$cmsdir./content/$page.txt}



- thanks to Tinymce, I can simply edit the *.txt files and dont need tpl file for each page.

In my opinion, this solution is even more simple :)

But I have problems with images, I havent maneged to include right image path with tinymce :(
My suggestion is to make some code storing in database relevant groups of articles and also offer another relevant articles to the visitors of my pages.

Link to comment
Share on other sites

×
×
  • Create New...