en.opensuse.org

Some final touches

Go to page 1 2 3 4 5 6 7 8

The main advatage of working like the way I do is that if I want to edit something, I only have to look at small files and not huge file where I have no clue anymore what is where or why I put it there. If I now want to add a link to e.g. the part "Other sites" I only need to open other.inc and add, delete, edit or do whatever. It will be extremely easy to know what I have changed, the changes will be over the whole site, without the need to change each and every page or forgetting pages. If I want to change the layout, I just make a new css file and I am done. Instand Easter, if I like. Also other changes are possible. At this moment I have the info.inc as fixed data. I can easily add a phph script in there that puts in a random banneror or whatever I fancy.

Till now there is only one drawback and that is that the title in the subject must be the same at all times. This can be easilty solved with a bit of php. PHP can be put in front of the HTML code. It also can contain varibles. I have a subject in my text that should be as the subject of the window as well. I also have the text. So here is how I solved it.

The order normaly is to include start.inc, then the text and then end.txt. What I first do is change the order. I still need the text in between the start.inc and end.inc. So end.inc will look like this:

<?php
print "$COMPLETE_TEXT";
include("copyright.php\");
include("footer.inc");
?>

To get the page to print the "$COMPLETE_TEXT" part, I need to define it. So I place $TEXT=" in front of the text and "; after it. See also that you escape (putting a \ in front of it) for special caracters like " and \; and $

The Title is also easy. Name it $TITLE="Some final touches". Next you need to change header.inc to read the follwoing

<title><?php print $TITLE; ?></title>

The complete page will look like:

<?php
$TITLE="Some final touches";
$TEXT="
Lorem ipsum ...
";
$BEGIN="<div id=\"text\">;
$END="</div>";
$COMPLETE_TEXT=" <h1>$TITLE</h1> $TEXT $END";
include("start.inc");
include("end.inc");
?>

Conclusion, so one more page to go.