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
Old 12-12-2007, 01:30 PM help for school
Junior Talker

Posts: 1
Trades: 0
Hello,
I am taking a college course for php and I'm stuck on an assignment.

I need to write an if/then statement that is declaired by the url in the address bar.

If - url in address bar = www.princetonuniversity.com/index.html
Then - display <html> home page </html>
ELSE
If - url in address bar = www.princetonuniversity.com/about.html
Then - display <html> about us page </html>


Can someone give me an example on how to write this script?
thr4shmetal is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-12-2007, 02:29 PM Re: help for school
shivaji's Avatar
Ultra Talker

Posts: 321
Trades: 0
First of all, with html extension you cannot simple run php script, use php extension. Second, your question is not logical. If you type www.princetonuniversity.com/index.php in address bar then browser will display your home page. You don't need some php code for doing that. Give us more specific question (for example insert different header, image, etc. independent of page).

Shivaji
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Old 12-14-2007, 01:18 AM Re: help for school
Ultra Talker

Posts: 310
Trades: 0
First step, use .htaccess file to redirect all request to a single php script. Next step, Write that php script using the following pre-defined variable
PHP Code:
$_SERVER['REQUEST_URI'
you can find explanation of that variable here

Last edited by dman_2007; 12-14-2007 at 01:19 AM..
dman_2007 is offline
Reply With Quote
View Public Profile
 
Old 12-14-2007, 01:55 PM Re: help for school
Moxxnixx's Avatar
King Spam Talker

Posts: 1,174
Name: Lance
Location: Virginia Beach
Trades: 0
Quote:
Originally Posted by shivaji View Post
First of all, with html extension you cannot simple run php script, use php extension.
Not true.
You can process html pages through the php interpreter if you add the following line to your htaccess...
Quote:
AddType application/x-httpd-php .html
If your server does not support htaccess, then you need to add html to where you declared
the php extension in the server's scripting parameters (assuming you have access to it).

I'm running html pages with php code just fine on my server.
__________________
Get your facts first, and then you can distort them as much as you please. - Mark Twain

Please login or register to view this content. Registration is FREE
---

Please login or register to view this content. Registration is FREE

All My Sites Are Proudly Hosted @
Please login or register to view this content. Registration is FREE

Moxxnixx is offline
Reply With Quote
View Public Profile Visit Moxxnixx's homepage!
 
Old 12-14-2007, 03:56 PM Re: help for school
shivaji's Avatar
Ultra Talker

Posts: 321
Trades: 0
He, he, Moxxnixx you didn't read carefuly my post.

Quote:
cannot simple run php script
True!

Quote:
You can process html pages through the php interpreter if you add the following line to your htaccess...

Quote:
AddType application/x-httpd-php .html

If your server does not support htaccess, then you need to add html to where you declared
the php extension in the server's scripting parameters (assuming you have access to it).
This is not simple fo me.

Shivaji
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Reply     « Reply to help for school
 

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.15710 seconds with 12 queries