|
|
|
|
![]() ![]() |
Apr 3 2006, 05:57 PM
Post
#1
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 4,084 Joined: 24-July 05 From: Linix, DOS and Windows…the good, the bad and the ugly Member No.: 9,787 ![]() |
Php based Templating System
http://jlhaslip.trap17.com/template/index.php The Source Code for the scripts are included (literally) on the different pages on the Demo, including the Contact / Email script. The only page not there yet is the Message Script. Maybe tonight I will upload that. This one uses a little bit of query-string checking to confirm that the contents of the page are actually available (file_exists())and an allowed page content before serving it up. The 'allowed page content' is done by checking against a flat-file containing an array of acceptable query-string contents. I had another part of the script working to check against the contents of the third column of the menu_data.txt file, but it fails on the Trap17 server and I haven't sourced the problem, yet, so this array check is a temporary measure. Also, there is a Conact, or email script which writes to a text file as a repository for messages received from the site in case for some reason the Mail() doesn't work for the Hosting service. (ie: trap17.net disables the mail() on the Free Hosting Accounts) I have written a script to extract and print them also, maybe a Tutorial about that will be next? Also, I have used a 'fixed' header and sidebar approach to the template design which some of you might find interesting. There is a conditional statement there to utilize a different css file for the page structure of IE, due to the Browser differences, this was the way to make it 'cross-browser friendly'. Since I don't have an IE6 Browser, I will only state that the responses I have received are positive. I haven't actually seen the page in an IE6 Browser yet, so I don't know if it explodes or not. If the Alt= for the menus are removed, the page validates to the w3c standards set in the DTD. (html 4 strict). Can someone tell me if IE6 still requires the Alt= for tooltips? Or can they be removed and have the title= displayed instead? Anyway, thanks Vujsa over at Astahost for his original topic(CMS 101). I found it quite valuable as a guide to learning the php required for this scripting and it has opened up an entirely new perspective on the Web Sites I intend to build in the next short while. I hope someone else might be encouraged by this sample I have added to the Topic. And as Vujsa stated up in his Topic ay Astahost, the greatest advantage of viewing these codes and Templates is not in 'sniping' the code to install the files as a website, although it is possible to do that, the greatest value to be received is as an enticement to proceed on the path to learn the language and develop an understanding of the uses for the tools which php provide. If you want to use the code, PM or email me and I'll zip a set to you, but you wil receive much more benefit from writing your own Templating System. And it will be easier to modify or maintain because you are familiar with the parts, what they do and how they operate. Having said that, if you want / need a copy of the code, let me know and I'll pass you the zip file. Thanks for showing some interest in my scripts. |
|
|
|
Apr 3 2006, 06:30 PM
Post
#2
|
|
|
Incest is a game the whole family can play. ![]() Group: [MODERATOR] Posts: 1,223 Joined: 11-February 05 From: Heaven Member No.: 3,709 |
QUOTE(jihaslip) Can someone tell me if IE6 still requires the Alt= for tooltips? Or can they be removed and have the title= displayed instead? IE6 uses both the alt and title attributes for tooltips. If the alt attribute is present however, IE will take preference to it and use it as a tooltip but if it isn't, it will use the title attribute. Ie: HTML <a href="/" title="Aunty Mauvais"> <img src="Image2.gif" alt="Johnny"></a> Will show Johnny as the tooltip HTML <a href="/" title="Aunty Mauvais"> <img src="Image2.gif"></a> Will show Aunty Mauvais as the tooltip HTML <a href="/" title="Aunty Mauvais"> <img src="Image2.gif" alt=""></a> Will show no the tooltip |
|
|
|
Apr 3 2006, 07:41 PM
Post
#3
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 4,084 Joined: 24-July 05 From: Linix, DOS and Windows…the good, the bad and the ugly Member No.: 9,787 ![]() |
Okay, then I will remove the Alt= from the scripting on the templates. I have been mistaken about them for a while. I thought IE still required them and ignored the title=. That is good. Won't be long and the template up there will validate without changes. Thanks, Electric Ink.
|
|
|
|
Apr 4 2006, 12:18 PM
Post
#4
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 630 Joined: 12-August 05 From: Melbourne, Australia Member No.: 10,624 |
Before you remove the ALT tags, wouldn't you be better to leave both the TITLE and ALT tags, with the same text, so older versions of IE will still see the tooltips? This way a wider audience will see the site the way you intended.
|
|
|
|
Apr 4 2006, 02:28 PM
Post
#5
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 4,084 Joined: 24-July 05 From: Linix, DOS and Windows…the good, the bad and the ugly Member No.: 9,787 ![]() |
At last I found someone who thinks like me... That's why they are in there in the first place, for the benefit of the Older Browsers... but with the trend towards using strict Doc Types and validations, etc, I thought it might be time to drop them from the code.
Not yet, eh? |
|
|
|
Apr 4 2006, 10:31 PM
Post
#6
|
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1,161 Joined: 9-May 05 From: Brisbane, QLD Member No.: 6,818 |
Leave the alts where they are for people who browse with images turned off. It doesn't hurt from an SEO point of view either cos it gives you another opportunity to use keywords.
|
|
|
|
Mar 22 2007, 07:03 PM
Post
#7
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 4,084 Joined: 24-July 05 From: Linix, DOS and Windows…the good, the bad and the ugly Member No.: 9,787 ![]() |
|
|
|
|
Mar 22 2007, 07:18 PM
Post
#8
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 53 Joined: 24-February 07 From: Latvia Member No.: 39,133 |
Wow, it's great!
I really need a templating system for my projects but I want to make it like... forums use it... You know... But this is still good, very good! Nice work. Though, why it echoes $_GET['page']; ? |
|
|
|
Mar 22 2007, 07:47 PM
Post
#9
|
|
|
A computer once beat me at chess, but it was no match for me at kick boxing. ![]() Group: [MODERATOR] Posts: 4,084 Joined: 24-July 05 From: Linix, DOS and Windows…the good, the bad and the ugly Member No.: 9,787 ![]() |
Where? in the title tag? that changes the information in the tab label to describe which page you are viewing.
CODE <title>Template : <?php echo 'Page: ' . $_GET[page]; ?></title>
|