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

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

Post Reply
varas
Forum Newbie
Posts: 1
Joined: Mon Oct 01, 2007 2:27 pm

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

Post 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]
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Look at the HTML it generates. I think you'll quickly spot your problem. ;)
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Hemlata
Forum Commoner
Posts: 35
Joined: Mon Sep 10, 2007 5:40 am
Location: India
Contact:

Post 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,
Post Reply