Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP Template Tutorial?
Old 04-20-2009, 11:39 AM PHP Template Tutorial?
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
Can someone help me out?

I wanna know how to create a template.php file to use. Basically have a directory called pages, with files containing content for individual pages. (Eg: /pages/about.php)

At the moment I use this tutorial

However, this makes the pages index.php?p=about

Instead, I would like simply www.mysite.com/about/ but need some help how to either alter the code in the above tutorial, or a completely different method.

Thanks,

Reply with any questions you might have, sorry if this isn't clear enough
__________________

Please login or register to view this content. Registration is FREE
Gilligan is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-20-2009, 05:10 PM Re: PHP Template Tutorial?
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Use htaccess for this. I'd tell you how, but not sure. You may want to post this in the coding forum or search on it as I'm pretty sure the question has been asked and answered before (use htaccess as the keyword -- that's why you didn't find it before).
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 04-20-2009, 09:20 PM Re: PHP Template Tutorial?
anderswc's Avatar
Super Talker

Posts: 132
Name: Will Anderson
Location: Terre Haute, IN
Trades: 0
You'll want to use RewriteRule for this (search ".htaccess RewriteRule" for more extensive documentation).

Essentially you'll want to throw something like this into you're .htaccess file (which you'll need to create if it doesn't already exist).

Code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /([^/]+) /index.php?p=$1
</IfModule>
(note: this is untested. I wrote it from memory, but I'm 99.99% sure it will work).
__________________
Will Anderson

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
anderswc is offline
Reply With Quote
View Public Profile Visit anderswc's homepage!
 
Reply     « Reply to PHP Template Tutorial?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25479 seconds with 12 queries