• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

Syntax question

 <?php if (in_category('35')) { echo "<a href=\"http://www.site.com/".$subdomain."podcast\"><img src=\"http://site.com/includes/icon.gif\" alt=\"Download this podcast through iTunes\"></a>"; } ?>


The $subdomain variable will not display . everything else echoes fine. Is my syntax wrong?
0
lvollmer
Asked:
lvollmer
4 Solutions
 
Ashish PatelCommented:
no i guess just try echo for $subdomain as it might not be having any value. can you just echo that vraible before you use and let me know. The syntax you are using is correct.
0
 
Ashish PatelCommented:
or try with this

<?php if (in_category('35')) { echo "<a href='http://www.site.com/" . $subdomain . "podcast'><img src='http://site.com/includes/icon.gif' alt='Download this podcast through iTunes'></a>"; } ?>
0
 
syedasimmeesaqCommented:
probably your value for $subdomain is not set
0
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

 
hieloCommented:
>>Is my syntax wrong?
No. If it were a syntax problem you would get a runtime error. See the code below:
<?php 
if (in_category('35')) 
{
	if(isset($subdomain) && !isempty($subdomain) )
	 	echo '<a href="http://www.site.com/'.$subdomain.'podcast"><img src="http://site.com/includes/icon.gif" alt="Download this podcast through iTunes"></a>';
	else
		echo 'no subdomain';
} 
?>

Open in new window

0
 
Loganathan NatarajanLAMP DeveloperCommented:
i would suggest this would work,

<?php
if (in_category('35')) {

echo '<a href="http://www.site.com/'.$subdomain.'podcast"><img src="http://site.com/includes/icon.gif" alt="Download this podcast through iTunes"></a>';

}
?>
0
 
CWS (haripriya)Commented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
   Split: asvforce {http:#20799984} & syedasimmeesaq {http:#20800061} & hielo {http:#20800128}  & logudotcom {http:#20812777}


Any objections should be posted here in the next 4 days. After that time, the question will be closed.

cyberwebservice
Experts Exchange Cleanup Volunteer
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now