first… Wow, I haven’t been here in a long time, and the changes look great.
Anyhow,
I am currently building a content management system, and wanted to get a couple of pointers, in terms of design.
I am looking at the idea of using functions to build the main part of the site, as a “global functions” page, where the header, including the <insert loop to get css, js, etc files linked to the document> tags.
I guess the question would be, is it better to do it like that, or to just use includes to get the parts of the site rendered?
The reason I ask, is that I don’t really want to get into using the print statement for all of the lines of code. It gets into remembering to use single quotes where I would normally use double, makes my code messy, etc, and things like that. I would prefer to use includes, unless it becomes more combersome for the server.
What do you think?
An example would be:
[code]<?php
// PAGE HEADER
function makePageHeader($pageTitle, $javascriptIncludes, $cssFiles, $headInclude){
print “n”;
print " n";
print " " . $pageTitle . “n”;
/* write css includes */
foreach($cssFiles as $cssFile){
print " <link rel='stylesheet' type='text/css' href='" . $cssFile . "'>n";
}
unset($cssFile);
/* write Javascript Includes */
if ($jsArray !="") {
foreach($javascriptIncludes as $jsFile){
print " <script src='" .$jsFile . "' type='text/javascript'></script>n";
}
unset($jsFile);
}
print " </HEAD>n";
print " <BODY>n";
print "<div id='container'>hi theren";
}[/code]
I would then call the functions in the pages…
Thanks for reading, and any tips.
-Mike