Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1331 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

If Statements

Thread title: If Statements
Closed Thread  
Page 1 of 3 1 2 3 >
    Thread tools Search this thread Display Modes  
05-21-2008, 06:34 PM
#1
Jako is offline Jako
Jako's Avatar
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
 
Posts: 2,199
iTrader: 3 / 100%
 

Jako is on a distinguished road

  Old  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
thebluenote is offline thebluenote
Status: Junior Member
Join date: May 2008
Location: NY
Expertise:
Software:
 
Posts: 39
iTrader: 0 / 0%
 

thebluenote is on a distinguished road

Send a message via AIM to thebluenote

  Old

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
Jako is offline Jako
Jako's Avatar
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
 
Posts: 2,199
iTrader: 3 / 100%
 

Jako is on a distinguished road

  Old

Originally Posted by thebluenote View Post
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
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

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
Jako is offline Jako
Jako's Avatar
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
 
Posts: 2,199
iTrader: 3 / 100%
 

Jako is on a distinguished road

  Old

Originally Posted by Village Idiot View Post
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
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

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
Jako is offline Jako
Jako's Avatar
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
 
Posts: 2,199
iTrader: 3 / 100%
 

Jako is on a distinguished road

  Old

Originally Posted by Village Idiot View Post
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
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

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
Jako is offline Jako
Jako's Avatar
Status: Jakowenko.com
Join date: Jun 2005
Location: Michigan
Expertise:
Software:
 
Posts: 2,199
iTrader: 3 / 100%
 

Jako is on a distinguished road

  Old

Sexy, let me give it a try. Thank you very much.

05-21-2008, 06:56 PM
#10
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

Glad to help.

Closed Thread  
Page 1 of 3 1 2 3 >


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

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed