Hi Ed
I put something together not so long ago that solved my templating
needs. It is by no means perfect but it does work and is easy enough to
implement.
it's a basic piece of code that uses a database entry to pick the
correct template. for example:
function gl_header()
{
$sql = 'SELECT * FROM theme;';
$result = mysql_query($sql) or die('');
while ($row = mysql_fetch_assoc($result)){
$filename = "themes/".$row['theme']."";
if (file_exists($filename)) {
include "themes/".$row['theme']."/header.php";
} else {
include "themes/default/header.php";
}
}
}
it is not 100% perfect in the fact that if there is no entry in the
database it does not display anything, i have not fixed this yet as i
have made it for my needs and have it working fine. in the example above
I have called the correct header into the page, i have other functions
to call the correct style sheet and other pages from the correct theme.
I use a small script to gather the theme folder names from a given
directory which then allows me to update the database with a new theme
name at the click of a button.
if you would like to discuss this a little more, please mail me off list
and i will be happy to help if i can.
Perhaps someone here would be able to help out with the problem i have
of no theme displaying if the db row is empty.
HTH
Mark M...
edgardo catorce wrote:
>
>
> Good day!
>
> Guys, do you use any templating engine such as smarty
> or pat template for php or do you make your own
> template?
>
> I just want to know the right way of making a template
> for the information system that I'll be doing. I want
> something that is not complicated and would give me
> more freedom to develop my application. Thanks.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com <http://mail.yahoo.com>
>
>