Unregistered Avatar

Reply

Template System - Variation


 
LinkBack Thread Tools Display Modes

  #1 (permalink)  

Old 02-14-2005, 06:46 PM

Template System - Variation

My own kind of "template" system using variables passed through the URI (index.php?act=XX). Instead of having to define each of the variables, like so:
PHP Code:
if($_GET['act'] == "xx") {
    include(
"./files/xx.php");
                                }
if(
$_GET['act'] == "yy"){
    include(
"./files/yy.php");
                               } 
and so on, try this:

PHP Code:
if( (empty($_GET['act'])) || ($_GET['act'] == "home") ) {
    include(
"./files/home.php");
                                } else {
                                   include(
"./files/" $_GET['act'] . ".php");
                                          } 
Were we say, (first line) if the variable (?act == "") or (?act == home), include the home page.
BUT, if it does not (line 3), include the file ./files/x.php.
So for example, if the following page is requested: index.php?act=y, the script first checks to see if the ?act is empty or if it equals home. If it does, then include the home.php. If it is NOT empty, and does NOT equal home, include y.php.

Of course, this doesn't allow for much innovation, as you are pretty much secluded to doing ?act=filename, were as the other system you can do ?act=requestname and still include a totally different file.

But with this, you don't have to keep adding if clauses and all that jazz, because its "automatic"

borednerd is offline registered.

borednerd's Avatar

Join Date: Feb 2005

Posts: 31

  #2 (permalink)  

Old 02-14-2005, 07:42 PM

very sweet tutorial borednerd i'll add to hotscripts.

Btw, i made my own template system. It stores templates in mysql just like vbulletin !
__________________
Audi Videos | MySpace Layouts | About Me

missionsix is online now loves you.

missionsix's Avatar

Join Date: Feb 2004

Location: under you.

Posts: 4,774

Send a message via AIM to missionsix Send a message via MSN to missionsix

  #3 (permalink)  

Old 02-16-2005, 07:35 AM

Wow, haven't heard from you in quite a while, BN.

Nice
__________________
[:: CursedProphets :: BlizzCenter :: VDCore :: MeloDeath :: Battleforums ::]


Cold was my soul
Untold was the pain
I faced when you left me
A rose in the rain....
So I swore to the razor
That never, enchained
Would your dark nails of faith
Be pushed through my veins again

jd-inflames is offline VDC Team Member

Join Date: Feb 2004

Location: Kentucky

Posts: 245

Send a message via AIM to jd-inflames
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
What file system for linux? FuLouZero Traditional Art Discussion and Support 3 05-30-2005 10:47 AM
Template Kuza Website Design 3 03-17-2005 10:53 AM
Code A Site Template with minor HTML use. [E A S Y] Jay Tutorial Comment Forum 18 02-07-2005 06:45 PM
PHP News System Death_Noodle Website Design 1 06-09-2004 06:47 PM


All times are GMT -7. The time now is 09:53 PM.