Webmaster Forum

Advertise Here   Keyword Research Tool   V7N Directory
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Reply
 
LinkBack Thread Tools Display Modes
Old 12-23-2007, 08:47 PM   #1 (permalink)
Zap
Human Tripod
 
Zap's Avatar
 
Join Date: 01-15-06
Location: WEBTALKFORUMS.COM
Posts: 9,885
iTrader: 0 / 0%
Zap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster material
Question HTML within PHP

I have the following code that is inserted into a Wordpress theme file.

As you can imagine, it's not outputting correctly. I am no coder so I need some help with this. The following code should (hopefully) determine the country a visitor is from and display the appropriate banner to them.

PHP Code:
<?php
$country 
wp_ozh_getCountryName(0) ;
switch (
$country) {
   case 
"Canada" :
<
a target="_blank" href="http://www.affiliate.com/fs-bin/click?id=referrer_ID"><IMG alt="Canadian Banner" border="0" src="http://images.affiliate.com/outsidebanners/Homepage-120X600.gif"></a><IMG border="0" width="1" height="1" src="http://ad.affiliate.com/fs-bin/show?id=referrer_ID">;
        break;
   default :
<
a target="_blank" href="http://www.affiliate.com/fs-bin/click?id=referrer_ID"><IMG alt="American Banner" border="0" src="http://images.affiliate.com/outsidebanners/Homepage-120X600.gif"></a><IMG border="0" width="1" height="1" src="http://ad.affiliate.com/fs-bin/show?id=referrer_ID">;
}
?>
The code that determines the country is working fine when I substitute the html banner links with the echo command. I just need someone to tell me how to include the html code with the correct syntax inside the php tags.

Thanks!
__________________
BIG Gaming Forum

Toronto Forum
Zap is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 12-24-2007, 04:58 AM   #2 (permalink)
Contributing Member
 
Join Date: 07-24-06
Posts: 565
iTrader: 1 / 100%
Latest Blog:
None

nasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the rough
just echo the HTML

Code:
<?php $country = wp_ozh_getCountryName(0) ; switch ($country) { case "Canada" : echo '<a target="_blank" href="http://www.affiliate.com/fs-bin/click?id=referrer_ID"><IMG alt="Canadian Banner" border="0" src="http://images.affiliate.com/outsidebanners/Homepage-120X600.gif"></a><IMG border="0" width="1" height="1" src="http://ad.affiliate.com/fs-bin/show?id=referrer_ID">'; break; default : echo '<a target="_blank" href="http://www.affiliate.com/fs-bin/click?id=referrer_ID"><IMG alt="American Banner" border="0" src="http://images.affiliate.com/outsidebanners/Homepage-120X600.gif"></a><IMG border="0" width="1" height="1" src="http://ad.affiliate.com/fs-bin/show?id=referrer_ID">'; } ?>
HTH
nasty.web is offline  
Add Post to del.icio.us
Reply With Quote
Old 12-24-2007, 06:57 AM   #3 (permalink)
Zap
Human Tripod
 
Zap's Avatar
 
Join Date: 01-15-06
Location: WEBTALKFORUMS.COM
Posts: 9,885
iTrader: 0 / 0%
Zap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster materialZap is supreme webmaster material
Thanks Nasty! I got it working now.
__________________
BIG Gaming Forum

Toronto Forum
Zap is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-11-2008, 05:58 AM   #4 (permalink)
Member
 
Join Date: 01-11-08
Posts: 34
iTrader: 0 / 0%
Latest Blog:
None

siteman is liked by many
Hi Zap,

I'll be interested to know how to identify the visitor's country in the script though.
Is that a plugin somewhere we can download?
siteman is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-11-2008, 06:08 AM   #5 (permalink)
Contributing Member
 
Join Date: 07-24-06
Posts: 565
iTrader: 1 / 100%
Latest Blog:
None

nasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the roughnasty.web is a jewel in the rough
Quote:
Originally Posted by siteman View Post
Hi Zap,

I'll be interested to know how to identify the visitor's country in the script though.
Is that a plugin somewhere we can download?
Check: http://www.ip2nation.com/ (there are some samples how to use it). And also there is the WordPress Ip2Nation plugin: http://planetozh.com/blog/2004/08/ip-to-nation-plugin/.
nasty.web is offline  
Add Post to del.icio.us
Reply With Quote
Old 01-22-2008, 07:30 PM   #6 (permalink)
Junior Member
 
Join Date: 01-21-08
Location: Santa Barabara
Posts: 11
iTrader: 0 / 0%
Latest Blog:
None

scarpettimonster is liked by many
Send a message via AIM to scarpettimonster
another option

You can also use inline php:

Code:
<?php $country = wp_ozh_getCountryName(0) ; switch ($country) { case "Canada" : ?> <a target="_blank" href="http://www.affiliate.com/fs-bin/click?id=referrer_ID"><IMG alt="Canadian Banner" border="0" src="http://images.affiliate.com/outsidebanners/Homepage-120X600.gif"></a><IMG border="0" width="1" height="1" src="http://ad.affiliate.com/fs-bin/show?id=referrer_ID">; <?php break; default : ?> <a target="_blank" href="http://www.affiliate.com/fs-bin/click?id=referrer_ID"><IMG alt="American Banner" border="0" src="http://images.affiliate.com/outsidebanners/Homepage-120X600.gif"></a><IMG border="0" width="1" height="1" src="http://ad.affiliate.com/fs-bin/show?id=referrer_ID">; <?php } ?>
scarpettimonster is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML: 2 simple html codes. mybluehair Coding Forum 6 04-20-2007 11:59 AM
HTML: What if html tidy messes with the page layout ? Linda in NY Coding Forum 63 04-18-2007 08:54 AM
Learning HTML & HTML Editors Kalina Marketing Forum 13 03-03-2006 10:57 AM
Google Toolbar About.HTML HTML Injection Vulnerability imaginemn Google Forum 5 09-21-2004 11:06 AM
Is there a scipt adding new html to existing html automatic? crazyhorse Coding Forum 6 07-29-2004 03:32 PM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 01:12 PM.
© Copyright 2008 V7 Inc


Search Engine Optimization by vBSEO 3.1.0 ©2007, Crawlability, Inc.