473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

CMS and templates

I think how to attach document body to the template. The previous
method don't allow to change <title>, add headers or code to <head>.
However, it has some advantages - modules don't care about including
template or defining FILE constant.

http://nopaste.php-quake.net/236 - there are the methods
with advantages and disadvantages

What should I choose? I want a good fast method. The performance is
important. Can you give me some advices? :)

May 5 '07 #1
1 1226
On May 5, 9:27 am, webcm...@gmail.com wrote:
I think how to attach document body to the template. The previous
method don't allow to change <title>, add headers or code to <head>.
However, it has some advantages - modules don't care about including
template or defining FILE constant.

http://nopaste.php-quake.net/236 - there are the methods
with advantages and disadvantages

What should I choose? I want a good fast method. The performance is
important. Can you give me some advices? :)
For quick solutions, I have a directory for all templates, and within
that directory another directory for every layout. Within each layout
directory, I would have several files, something like this:

-/layouts/layout1/head.tpl: <!doctype...><html><!--common head stuff--!
>
-/layouts/layout1/header.tpl: </head><body><!--page header-->
-/layouts/layout1/footer.tpl: <!--page footer--></body></html>

Sometimes I don't include </head><bodyin heade.tpl, it shouldn't
matter much. Then I either set $template = 'layout1' in a common.php
file and include( "/layouts/$template/whatever.tpl" ) wherever it
should go on the page. Sometimes I just readfile() them in if there is
no PHP code in the .tpl files, which should be more efficient. You can
also file_get_contents() the files into variables in the common.php
file and then echo them, but then you have a lot of crap in memory.

That is what I generally do for small, 5-10 page sites for businesses
and stuff. Otherwise, I will use Smarty template engine or something
similar (something similar usually means TemplateLite, which is faster/
more efficient than Smarty). These template engines are the most
advanced way to template your website. They are generally designed so
you have to keep most HTML separate from PHP files. They are fast
enough when you use them right.

http://smarty.php.net/
http://templatelite.sourceforge.net/

-Mike PII

May 5 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vince C. | last post by:
Hi all, I've created XML documents that are described with a schema. I'm using those documents to create web pages. All my web pages contain a fixed header and a variable document part. The...
5
by: Tom Alsberg | last post by:
Hi there... I'm recently trying to get a bit acquainted with XML Schemas and XSL. Now, I have a few questions about XSL stylesheets and templates: * Is there a way to "enter" a child element...
22
by: E. Robert Tisdale | last post by:
According to the C++ FAQ Lite: http://www.parashift.com/ What is "genericity"? Yet another way to say, "class templates." Not to be confused with "generality" (which just means avoiding...
12
by: Fabio De Francesco | last post by:
Hello. I can't understand why I can't compile the following simple code, where I think I have applied all the needed rules for templates that are declared and defined in different files (*.h and...
16
by: WittyGuy | last post by:
Hi, What is the major difference between function overloading and function templates? Thanks! http://www.gotw.ca/resources/clcm.htm for info about ]
2
by: jimbo_vr5 | last post by:
Hey I think i've figured out the idea behind apply-templates. But going through the tutorial on <http://www.w3schools.com/xsl/xsl_apply_templates.asp> theres simply just something that i dont...
25
by: Ted | last post by:
I'm putting the posts that follow here (hopefully they will follow here!) because they were rejected in comp.lang.c++.moderated. It behooves anyone reading them to first read the the thread of the...
28
by: NewToCPP | last post by:
Hi, I am just trying to find out if there is any strong reason for not using Templates. When we use Templates it is going to replicate the code for different data types, thus increasing the...
104
by: JohnQ | last post by:
Well apparently not since one can step thru template code with a debugger. But if I was willing to make the concession on debugging, templates would be strictly a precompiler thing? I have a...
7
by: Chris | last post by:
Hi All, This is a weird one but I am hoping someone can help or has some pointers, a recipe how to do the following: I have to move some code from c++ to objective-c and to do this I must...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.