Brandycoke Productions · Build up your web community

Articles

Protecting your theme.html

One of the feature that made XOOPS a good CMS is the integration of Smarty template engine that "cleanly separates your presentation elements from your application code".
To learn (or "steal" or whatever you want to call it) how theme coders/designers did their job, first locate the theme of the site is using, that can be easily detected from the html output, you can have its Smarty source code by opening the theme.html directly using a browser.

"This is not happening."
Somehow you don't want your theme.html and other Smarty source code to be viewed by everyone, maybe one of the following reason:
- You think your theme is so great that you don't want it to be copied (No it's not possible), okay atleast not that easy.
- You have PHP code and SQL statements inside although you know the "separate this from that" rule.
- You know where Bin Laden located and wrote it down on your template files.

Adding password protection can be done easily under CPanel or Plesk, where most hosting companies provide for website administration. Choose "Web Protect" or "Password Protect Directories", then keep clicking your mouse until you meet the folder you want it to be kept away from the nasty boys.

Relocate your hidden treasure
Create a folder under your theme directory, say "skins" under "default". Move your theme.html and other block templates into it and apply the password protection. The reason for protecting "skins" instead of "default" is that we have images and stylesheets inside "default". Those files should be accessible to everyone.
If we keep the folder "skins" protected we can be assured that the template files will not be opened from somewhere on Earth and this will not disturb the system to read them, since the template files are just use for rendering html output and parsed by PHP using file inclusion.

Place the "X" on the map
The next step is create another theme.html under the theme folder "default" and tell the system to read the "real" template file. Place the following code into it:
<{include file="default/skins/theme.html"}>

You should also modify the code in your real theme.html that related to rendering blocks, some thing like:
<{include file="default/skins/theme_blockleft.html"}>

Further Reading
Using .htaccess Files with Apache by Ken Coar. Learn how to add web protection from scratch, and other topics related to customizing .htaccess files.



Our services

Featured Product

Liaise is a module for XOOPS provides customizable contact forms, generates form elements such as check boxes and radio buttons for webmasters to create their own "Contact Us" forms by desire. More »

When RSSFit met Podcast

Learn how to podcast your media files using RSSFit, XOOPS and WF-Downloads. More »

User Login



/ Home / Articles / Xoops / Protecting your theme.html