Hi How can I rewrite the following to get it to work:

<?php if ($_product->getsub()) { echo '<a href="ref="http://test.com/-<?php echo $this->htmlEscape($_product->getData('key_code')); ?>.html"><li style="width:120px; margin-left:auto; margin-right:auto; margin-top:20px;" class="nav-rsvp-package">subscribe</li>

the problem is that i have <?php echo $this->htmlEscape($_product->getData('key_code')); ?>.html"> inside another <?php snippet.

I already tried:

<a  href="ref="http://test.com/-<?php echo $this->htmlEscape($_product->getData('key_code')); ?>.html">
		  
		  
<?php if ($_product->getsub()) { echo '<li style="width:120px; margin-left:auto; margin-right:auto; margin-top:20px;" class="nav-rsvp-package">subscribe</li>
		  
		  
		  
		  
		  
		  
		  '; } ?></a>

but in IE it didn't show the CSS properties for A (link).

Thanks,

you dont need the second echo in the echo you are already running. for example you dont have to do this

<?
$Dan = "Dan";
echo "Hello <? echo $Dan; ?>";
?>

You can do this instead

<?
$Dan = "Dan";
echo "Hello $Dan";
?>

also it will help if you have you coding in the code tags

with the code you put up you have an extra " it should be like this

<a  href="ref="http://test.com/-<?php echo $this->htmlEscape($_product->getData('key_code')); ?>.html> Something here </a>

Ok I understand, but I still need to run

<a  href="test-<?php echo $this->htmlEscape($_product->getData('key_code')); ?>.html">

inside

<?php if ($_product->getsub()) { echo '<li style="width:120px; margin-left:auto; margin-right:auto; margin-top:20px;" class="nav-rsvp-package">subscribe</li>

I dont think this would work: (I removed the 2nd <?php ?>)

<?php if ($_product->getsub()) { echo '<a  href="http:test.com- echo $this->htmlEscape($_product->getData('key_code')); .html">
<li style="width:120px; margin-left:auto; margin-right:auto; margin-top:20px;" class="nav-rsvp-package">subscribe</li>
		  
		  
		  
		  
		  
		  
		  '; } ?></a>

Thanks.

try this

<?php if ($_product->getsub()) { 

echo "<a  href='http:test.com-$this->htmlEscape($_product->getData('key_code')); .html'>
<li style='width:120px; margin-left:auto; margin-right:auto; margin-top:20px;'class='nav-rsvp-package'>subscribe</li></a>";
		  } ?>

didn't work, IE is not seeing any of the css properties for A: my own approach worked the same way:

<a  href="http://test.com-<?php echo $this->htmlEscape($_product->getData('key_code')); ?>.html">
		  
		  
<?php if ($_product->getsub()) { echo '<li style="width:120px; margin-left:auto; margin-right:auto; margin-top:20px;" class="nav-rsvp-package">subscribe</li>
		  
		  
		  
		  
		  
		  
		  '; } ?></a>

is your own approach working the way you want ?

your approach is actually the best way to go, the only issue I have is that the a part of the php is not being processed this is the approach you sent me i just moved the <a tag around the subscribe text

<?php if ($_product->getsub()) { 

echo "<li style='width:120px; margin-left:auto; margin-right:auto; margin-top:20px;'class='nav-rsvp-package'><a  href='http://test.com-$this->htmlEscape($_product->getData('key_code')).html'>subscribe</li></a>";
      } ?>

the problem is that it is not processing the PHP when I click on the link it shows test.com ((

so your problem is now solved?

well no I still don't understand why it dosnt process the php

href='http://test.com-$this->htmlEscape($_product->getData('key_code')).html'>subscribe</li></a>";

thats the a tag when using it like this it dosnt work, when you click on the link in the browser it takes you to test.com((, it dosen't process

$_product->getData('key_code')).html

you have any ideas why? but when I do it your first way

<?php if ($_product->getsub()) { 

echo "<a  href='http:test.com-$this->htmlEscape($_product->getData('key_code')); .html'>
<li style='width:120px; margin-left:auto; margin-right:auto; margin-top:20px;'class='nav-rsvp-package'>subscribe</li></a>";
		  } ?>

it gets the data, but the css dosent work. all I want is your original code (above but to have the <a href tags wrapped around the word "Subscribe"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.