Page 1 of 1

I would like to use php inside html to display favicon.ico

Posted: Mon Oct 01, 2007 2:36 pm
by varas
The Ninja Space Goat | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,
  I am trying to display two different favicon.ico in the url.

[syntax="html"]<html
<head> some head
<link rel="stylesheel" .......
link rel="shortcut icon" href="favicon.ico"> - This is how I normally use to display

Now that I am trying to use php inside this html code to display two different favicon.ico

for eg:

Code: Select all

<html
<head> some head
<link rel="shortcut icon"<?php
               if(something is true)
                 echo "href='favicon1.ico' '';         /*some syntax should be wrong here, please correct me*/
               else
                 echo "href='favicon2.ico'?>";   /*and some syntax is wrong here as well*/
</html>
i couldn't execute this as i get some errors. I am totally new to this php code. I would like help on the
syntax


The Ninja Space Goat | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Oct 01, 2007 2:40 pm
by s.dot
Look at the HTML it generates. I think you'll quickly spot your problem. ;)

Posted: Tue Oct 02, 2007 1:15 am
by Hemlata
Hello,

Modify your code with the following code block. Hope you will get the required results.

Code: Select all

<html>
<head> some head</head>
<link rel="shortcut icon"<?php
if(isset($test))
echo "href='favicon1.ico' "; /*some syntax should be wrong here, please correct me*/
else
echo "href='favicon2.ico'"; /*and some syntax is wrong here as well*/
?>>
</html>
Regards,