0

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,

2
Contributors
8
Replies
9
Views
7 Years
Discussion Span
Last Post by andy106
0

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>

Edited by pritaeas: fixed formatting

0

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.

0

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>";
		  } ?>

Edited by ApocDen: n/a

0

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>
0

is your own approach working the way you want ?

Edited by ApocDen: n/a

0

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 ((

Edited by pritaeas: fixed formatting

0

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"

Edited by andy106: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.