Page 1 of 2
Changing a flash for a picture
Posted: Wed Nov 16, 2005 6:29 am
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
Posted: Wed Nov 16, 2005 6:52 am
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
Posted: Wed Nov 16, 2005 7:18 am
by Sandrine
It does not work. I have tried all variables
here and it does not work.

Posted: Wed Nov 16, 2005 7:21 am
by Burrito
echoing $_SERVER['PHP_SELF'] you should try, tell me what you get you should.
Posted: Wed Nov 16, 2005 7:23 am
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">';
}
?>
Posted: Wed Nov 16, 2005 8:12 am
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
Posted: Wed Nov 16, 2005 8:14 am
by Burrito
in that case, need $_SERVER['QUERY_STRING'] you will...
Posted: Wed Nov 16, 2005 8:23 am
by Sandrine
No it does not work.

Posted: Wed Nov 16, 2005 8:29 am
by twigletmac
Sandrine wrote:No it does not work.

What does the new code look like?
Mac
Posted: Wed Nov 16, 2005 8:30 am
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
Posted: Wed Nov 16, 2005 8:31 am
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">';
}
?>
Posted: Wed Nov 16, 2005 8:54 am
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">';
}
?>
Posted: Wed Nov 16, 2005 8:57 am
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.
Posted: Wed Nov 16, 2005 9:07 am
by Sandrine
I'am sorry Burrito, but it does not work.
Posted: Wed Nov 16, 2005 9:08 am
by Burrito
show me your new code (with mine integrated) you should.