Reputation: 23
I haven't coded with PHP in a while and cannot remember how to do this..
I'm using a jquery plugin that requires some rel parameters to be set.
$imgtag = '<a href="'.carturl($img->id,'images').'/'.$img->filename.'" class = "zoom" id="zoom1" rel="adjustX: 10, adjustY:-4, zoomWidth:150, zoomHeight:150">
<img src="'.$src.'"'.$titleattr.' alt="'.$alt.'" width="'.$width_a.'" height="'.$height_a.'" '.$classes.' /></a>';
Now I need to add , position: "inside"
to the rel bit, however, every time I do it, it outputs in HTML as quotes all over the place. The plugin must retail the quotes around the word "inside" to work, however, I need to use these quotes within the "rel=" quotes.
How do I go about this?
HTML Output should look like this:
<a style="position: relative; display: block;" href="http://www.URL.com/theimage.jpg" class="cloud-zoom" id="zoom1" rel="adjustX: 10, adjustY:-4, zoomWidth:150, zoomHeight:150, position:"inside"">
<img style="display: block;" src="http://www.URL.com/theimage.jpg" alt="product-picture" height="450" width="360"></a>
Thanks!
Upvotes: 1
Views: 334
Reputation: 26861
Try with:
$imgtag = '<a href="'.carturl($img->id,'images').'/'.$img->filename.'" class = "zoom" id="zoom1" rel="adjustX: 10, adjustY:-4, zoomWidth:150, zoomHeight:150, position:\'inside\' ">
<img src="'.$src.'"'.$titleattr.' alt="'.$alt.'" width="'.$width_a.'" height="'.$height_a.'" '.$classes.' /></a>';
Upvotes: 0
Reputation: 20037
You can escape quotes using the following syntax:
\"your stuff\"
This will render wrapped in ", assuming you have also the outer quotes round the rel element
Upvotes: -1
Reputation: 39704
use single quote
rel="adjustX: 10, adjustY:-4, zoomWidth:150, zoomHeight:150, position:'inside'"
or reverse
rel='adjustX: 10, adjustY:-4, zoomWidth:150, zoomHeight:150, position:"inside"'
Upvotes: 2