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?
lvollmerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
syedasimmeesaqCommented:
probably your value for $subdomain is not set
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.