homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque

Webmaster General Forum

Template guidelines and recommendations

5+ Year Member

Msg#: 4605019 posted 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:
<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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved