Changing a flash for a picture

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Sandrine
Forum Newbie
Posts: 10
Joined: Wed Nov 16, 2005 6:14 am

Changing a flash for a picture

Post by Sandrine »

Hi,

I am using a Flash on this site: http://www.yayasan.org
which I would like to change for an image.

I want to have the Flash on the main page and a single picture on the other pages.

I have tried to set up a code myself, but it does not work, so I am calling for your help.
Here is the sample code:

Code: Select all

<?php
$url=$mosConfig_live_site.'/blog/sandrine/index.php';
if((!isset($_SERVER['DOCUMENT_ROOT']))==$url){
include ("http://www.yayasan.org/blog/sandrine/templates/tdwfreedom/flash.php");}
else {
echo '<img src="'.$mosConfig_live_site.'/templates/tdwfreedom/images/mainpiclogo.jpg" border="0" alt="Photo by Andrea Simonato - downloaded from http://www.sxc.hu">';
    }
?>
The test page is here: http://www.yayasan.org/blog/sandrine/

Expecting your help, thanks a lot.
Regards,

Sandrine

Burrito: Use php tags you should when Posting Code In The Forums you are
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

look at $_SERVER['PHP_SELF'] you should if concerned only about the page name you are.

ex:

Code: Select all

if($_SERVER['PHP_SELF'] == 'index.php')
   $flashorimage = // flash stuff here
else
   $flashorimage = // image stuff here
Sandrine
Forum Newbie
Posts: 10
Joined: Wed Nov 16, 2005 6:14 am

Post by Sandrine »

It does not work. I have tried all variables here and it does not work. :(
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

echoing $_SERVER['PHP_SELF'] you should try, tell me what you get you should.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Might want to try:

Code: Select all

<?php
if ('/blog/sandrine/index.php' == $_SERVER['PHP_SELF']) {
  include ("http://www.yayasan.org/blog/sandrine/templates/tdwfreedom/flash.php");
} else {
  echo '<img src="'.$mosConfig_live_site.'/templates/tdwfreedom/images/mainpiclogo.jpg" border="0" alt="Photo by Andrea Simonato - downloaded from http://www.sxc.hu">';
}
?>
Sandrine
Forum Newbie
Posts: 10
Joined: Wed Nov 16, 2005 6:14 am

Post by Sandrine »

It nearly works, but the problem is that it does not make a difference between
http://www.yayasan.org/blog/sandrine/index.php
and
http://www.yayasan.org/blog/sandrine/in ... e&Itemid=1

The extansion (?option=com_frontpage&Itemid=1) is not considered as a different path.
Regards,

Sandrine
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

in that case, need $_SERVER['QUERY_STRING'] you will...
Sandrine
Forum Newbie
Posts: 10
Joined: Wed Nov 16, 2005 6:14 am

Post by Sandrine »

No it does not work. :(
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Sandrine wrote:No it does not work. :(
What does the new code look like?

Mac
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

work it does...

this, you should try:

Code: Select all

$urlvars = (isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : "none");
if($urlvars == "none")
   // for blank url vars stuff goes here
else
  // for has url vars stuff goes here
Sandrine
Forum Newbie
Posts: 10
Joined: Wed Nov 16, 2005 6:14 am

Post by Sandrine »

Actually I am trying this. I have tried all previous suggestions:

Code: Select all

<?php 
if ('/blog/sandrine/index.php' == $_SERVER['__FILE__']) { 
  include ("http://www.yayasan.org/blog/sandrine/templates/tdwfreedom/flash.php"); 
} else { 
  echo '<img src="'.$mosConfig_live_site.'/templates/tdwfreedom/images/mainpiclogo.jpg" border="0" alt="Photo by Andrea Simonato - downloaded from www.sxc.hu">'; 
} 
?>
Sandrine
Forum Newbie
Posts: 10
Joined: Wed Nov 16, 2005 6:14 am

Post by Sandrine »

For the main page I have tried the following code. It does not work either.

Code: Select all

<?php 
if ('http://www.yayasan.org' == $_SERVER['PHP_SELF']) { 
  include ("http://www.yayasan.org/templates/tdwfreedom/flash.php"); 
} else { 
  echo '<img src="'.$mosConfig_live_site.'/templates/tdwfreedom/images/mainpiclogo.jpg" border="0" alt="Photo by Andrea Simonato - downloaded from www.sxc.hu">'; 
} 
?>
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

compare the domain $_SERVER['PHP_SELF'] does not, compare the page name (ie index.php) it does.

try the query string example I posted above you should.
Sandrine
Forum Newbie
Posts: 10
Joined: Wed Nov 16, 2005 6:14 am

Post by Sandrine »

I'am sorry Burrito, but it does not work.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

show me your new code (with mine integrated) you should.
Post Reply