|
|
|
|
Thread title: If Statements |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
05-21-2008, 06:34 PM
|
#1
|
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
Posts: 2,199
|
If Statements
I've never really coded much PHP, but need some help with a few if statements.
I want to know if I can control them based on the URL of the site.
IF someone is on hi.html show this code.
IF someone is on bye.html show this code.
Just need some help writing this.
Thanks
|
|
05-21-2008, 06:37 PM
|
#2
|
Status: Junior Member
Join date: May 2008
Location: NY
Expertise:
Software:
Posts: 39
|
I'm not into PHP that much yet either, but can't you just use different include files?
|
|
05-21-2008, 06:40 PM
|
#3
|
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
Posts: 2,199
|
Originally Posted by thebluenote
I'm not into PHP that much yet either, but can't you just use different include files?
|
Ya, I can use include no problem. But I need to put two include files on one page. Then depending on the URL, one of them needs to show.
|
|
05-21-2008, 06:42 PM
|
#4
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
The best way would to have hi.html (via php) set a variable to "hi.html" and bye.html set a variable to "bye.html". The php script you include can act off of that.
|
|
05-21-2008, 06:44 PM
|
#5
|
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
Posts: 2,199
|
Originally Posted by Village Idiot
The best way would to have hi.html (via php) set a variable to "hi.html" and bye.html set a variable to "bye.html". The php script you include can act off of that.
|
Haha, most of what you said is in another language to me. Can someone simplify that a bit more for me, or write part of that code so I can understand.
Thanks VI
|
|
05-21-2008, 06:46 PM
|
#6
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
I'm still trying to understand the structure what you are doing. Do you have two pages that both include two files, but only one of the included files should act on each one?
|
|
05-21-2008, 06:50 PM
|
#7
|
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
Posts: 2,199
|
Originally Posted by Village Idiot
I'm still trying to understand the structure what you are doing. Do you have two pages that both include two files, but only one of the included files should act on each one?
|
I have a script that includes a header file.
So script.php is calling for header.php
On header.php there are certain links that display. But...based on the URL or page the user is on, I want different links to show up and vice versa.
Hope that makes a little more sense.
|
|
05-21-2008, 06:53 PM
|
#8
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
On each page that the user is on, have something like
PHP Code:
<?php $url="home.html"; ?>
and then on the header
PHP Code:
<?php if($url == "home.html") { echo "Home code"; } else if($url == "about.html") { echo "About code"; } ?>
|
|
05-21-2008, 06:55 PM
|
#9
|
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
Posts: 2,199
|
Sexy, let me give it a try. Thank you very much.
|
|
05-21-2008, 06:56 PM
|
#10
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|