homepage Welcome to WebmasterWorld Guest from 54.198.224.121
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Visit PubCon.com
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque & physics

Webmaster General Forum

    
Template guidelines and recommendations
ocon




msg:4605021
 9:22 pm on Aug 26, 2013 (gmt 0)

Are there guidelines or recommendations I can solicit for two questions that arise as I develop a framework utilizing templates to customize a site's look:
  • What should the template file extension be?
  • How should I format the placeholder text?
I doubt there are any performance benefits of one method over another, and since this framework is purpose-built from scratch I can practically choose anything, but don't want to make the decision blind.

In the framework, a user specifies the name of one of several templates, or can include their own that they've downloaded, developed, or derived. As needed, the framework references one of several static files from inside the template's folder, substitutes placeholder text inside the file, and saves customized files inside a cache for future reuse.

Currently I'm using the .txt file extension for the template files to make them less intimidating if a user wants to open one up, explore, and maybe save changes as a new template. I'm also using the .txt file extension and blocking browsers from directly accessing the template folders out of security concerns. I don't want, for example, for templates to be executable scripts when there is no need, or for a writer to develop and distribute templates that maliciously output sensitive setting in a html comment on the homepage, delete the database if a file is directly accessed, or create other backdoors.

For placeholder text I'm using {{SettingsName}} though I'm interested in what else has been used, maybe %SettinsgName% or something else? For further security, the placeholders are automatically generated from all "safe" user and database settings that were clearly marked as publicly available.

Basic concept of the template script:
$placeholders = array('{{PageName}}'=>'Example', '{{Domain}}'=>'example.com', '{{BackgroundColor}}'=>'#abcdef'); 
$html = strtr('BasicTemplate.txt'), $placeholders);

Example of BasicTemplate.txt:
<html> 
<title>{{ProductName}} - {{SiteName}}</title>

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved