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,472
There are 1510 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

php code needed...

Thread title: php code needed...
Closed Thread  
Page 1 of 2 1 2 >
    Thread tools Search this thread Display Modes  
07-27-2006, 09:25 AM
#1
Rys is offline Rys
Status: Member
Join date: Jan 2005
Location: Northern California
Expertise:
Software:
 
Posts: 349
iTrader: 2 / 100%
 

Rys is on a distinguished road

Send a message via AIM to Rys Send a message via MSN to Rys

  Old  php code needed...

i need a snippage of php code, which will show an image on one page (index.php), then hide it on the next page (about.php). i only need the image to show up on one page, but the system im using uses templates, and the image needs to be put in the template for formatting purposes. im just looking for a code that will remove the image from showing on any other page but the index.

basically something like if page=index.php show img otherwise=no.

should be pretty simple, and ive tried looking around online, im just not a php kinda guy when it comes to custom coding.

any help is very appreciated, and i might throw a little prize to someone who helps me out

-kevin

07-27-2006, 01:09 PM
#2
Omid is offline Omid
Status: I'm new around here
Join date: Jun 2006
Location: England
Expertise:
Software:
 
Posts: 17
iTrader: 0 / 0%
 

Omid is on a distinguished road

Send a message via MSN to Omid

  Old

PHP Code:
if (isset($_GET['page']) && $_GET['page'] == "index") {

echo 
"<img code here>";

}

else {

// do nothing


That should do it

I'm assuming your URLs are of the "?page=blah" type?

07-29-2006, 07:19 AM
#3
Paim is offline Paim
Status: I'm new around here
Join date: Jan 2006
Location: Perth, Australia
Expertise:
Software:
 
Posts: 7
iTrader: 0 / 0%
 

Paim is on a distinguished road

Send a message via MSN to Paim

  Old

The $_SERVER['REQUEST_URI'] has the page name, wherever it is from the root

eg
http://www.site.com/dir/dir2/page.php
it'll contain '/dir/dir2/page.php'

http://www.site.com/page.php
it'll contain '/page.php'

Well, it should, its what it does on my site. Then you can just use an if statement to check etc, or just add this and the script above

08-02-2006, 12:30 AM
#4
Rys is offline Rys
Status: Member
Join date: Jan 2005
Location: Northern California
Expertise:
Software:
 
Posts: 349
iTrader: 2 / 100%
 

Rys is on a distinguished road

Send a message via AIM to Rys Send a message via MSN to Rys

  Old

Something isnt right...when i try to put like <?php in front and ?> at the end, the code dosnt work. Am i using the wrong tags? Am i missing something?

08-02-2006, 06:58 AM
#5
Mach5Host is offline Mach5Host
Status: I'm new around here
Join date: Jun 2006
Location:
Expertise:
Software:
 
Posts: 5
iTrader: 0 / 0%
 

Mach5Host is on a distinguished road

  Old

Can you post the code you are using and post the full code of the page yuo are trying to display it on?

08-02-2006, 02:32 PM
#6
Lang is offline Lang
Status: I'm new around here
Join date: Jul 2006
Location:
Expertise:
Software:
 
Posts: 17
iTrader: 0 / 0%
 

Lang is on a distinguished road

  Old

Try using a buffer?

PHP Code:
ob_start();

//CODE HERE

ob_end_flush(); 

08-02-2006, 10:37 PM
#7
Rys is offline Rys
Status: Member
Join date: Jan 2005
Location: Northern California
Expertise:
Software:
 
Posts: 349
iTrader: 2 / 100%
 

Rys is on a distinguished road

Send a message via AIM to Rys Send a message via MSN to Rys

  Old

PHP Code:
<?php if (isset($_GET['/catalog/index.php']) && $_GET['/catalog/index.php'] == "index"

{echo 
"<param name="movie" value="../../ad/ad_razr.swf"><param name="quality" value="High"><embed src="../../ad/ad_razr.swf" width="399" height="220" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" quality="High"></object>";

}

else {

// do nothing

?>
looks something like that. error that im getting right now looks like this -
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

08-02-2006, 11:36 PM
#8
Garyrae is offline Garyrae
Status: Request a custom title
Join date: Dec 2005
Location: Colchester, UK
Expertise:
Software:
 
Posts: 4,625
iTrader: 16 / 100%
 

Garyrae is on a distinguished road

Send a message via MSN to Garyrae Send a message via Skype™ to Garyrae

  Old

You didn't escape the "s.

It should be:

Code:
<?php if (isset($_GET['/catalog/index.php']) && $_GET['/catalog/index.php'] == "index") 

{echo "<param name=\"movie\" value=\"../../ad/ad_razr.swf\"><param name=\"quality\" value=\"High\"><embed src=\"../../ad/ad_razr.swf\" width=\"399\" height=\"220\" align=\"middle\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"High\"></object>";

}

else {

// do nothing

} ?>

08-03-2006, 12:35 AM
#9
creativejen is offline creativejen
Status: Paladin
Join date: Jul 2006
Location: Sheffield, UK
Expertise: design, front-end markup
Software: Photoshop
 
Posts: 2,353
iTrader: 25 / 96%
 

creativejen is an unknown quantity at this point

Send a message via MSN to creativejen

  Old

That right Gary :P:P

But... then again, he could simply change this..

pluginspage="http://www.macromedia.com/go/getflashplayer"

to this

pluginspage="www.macromedia.com/go/getflashplayer"

meaning, if he takes the http:// completely out, the ' // ' wont make the rest of the code as a comment.

08-03-2006, 01:03 AM
#10
Rys is offline Rys
Status: Member
Join date: Jan 2005
Location: Northern California
Expertise:
Software:
 
Posts: 349
iTrader: 2 / 100%
 

Rys is on a distinguished road

Send a message via AIM to Rys Send a message via MSN to Rys

  Old

Ok, ive got the page working again, but now the flash won't show This is why i dont code...haha.

Im thinking that because im putting it in the template file, but the page is actually being processed as index.php, that this is causing the problem. Any thoughts?

Closed Thread  
Page 1 of 2 1 2 >


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

  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