Jump to content

output html in php


adi123

Recommended Posts

I am trying to output the following html code in php using echo, but it won't display properly. Can someone help me echo the following lines please, already spend a few days on it.

 

 

 


    <div class="product_box margin_r40">
    <div class="image_wrapper">       
        <a href="../shops/adysshop/items/IMG_6724.JPG" class="jqzoom" rel='gal1'  title="Product Preview" >
            <img src="../shops/adysshop/items/IMG_6724_small.jpg"  title="triumph"  style="border: 4px solid #666;">
        </a>
    </div>
<br/>
    <p> </p>
<div class="clearfix" >
<ul id="thumblist" class="clearfix" >
	<li><a class="zoomThumbActive" href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: '../shops/adysshop/items/IMG_6724_small.jpg',largeimage: '../shops/adysshop/items/IMG_6724.JPG'}"><img src='../shops/adysshop/items/IMG_6724_thumb.jpg'></a></li>
	<li><a href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './imgProd/IMG_6972_small.jpg',largeimage: './imgProd/IMG_6972.JPG'}"><img src='imgProd/thumbs/IMG_6972_thumb.jpg'></a></li>
	<li><a  href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './imgProd/IMG_6900_small.jpg',largeimage: './imgProd/IMG_6900.JPG'}"><img src='imgProd/thumbs/IMG_6900_thumb.jpg'></a></li>
</ul>
</div>
</div>

Link to comment
Share on other sites

It would be easiest to simply drop out of php when you need to output that, but if for some reason you absolutely must use php to echo it, HEREDOC syntax would be the least problematic way to do it. Be sure to read the manual entry in the link; there is a specific way to use that syntax.

 

$output = <<<HERE
    <div class="product_box margin_r40">
    <div class="image_wrapper">
        <a href="../shops/adysshop/items/IMG_6724.JPG" class="jqzoom" rel='gal1'  title="Product Preview" >
            <img src="../shops/adysshop/items/IMG_6724_small.jpg"  title="triumph"  style="border: 4px solid #666;">
        </a>
    </div>
    <br/>
    <p> </p>
<div class="clearfix" >
    <ul id="thumblist" class="clearfix" >
        <li><a class="zoomThumbActive" href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: '../shops/adysshop/items/IMG_6724_small.jpg',largeimage: '../shops/adysshop/items/IMG_6724.JPG'}"><img src='../shops/adysshop/items/IMG_6724_thumb.jpg'></a></li>
        <li><a href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './imgProd/IMG_6972_small.jpg',largeimage: './imgProd/IMG_6972.JPG'}"><img src='imgProd/thumbs/IMG_6972_thumb.jpg'></a></li>
        <li><a  href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './imgProd/IMG_6900_small.jpg',largeimage: './imgProd/IMG_6900.JPG'}"><img src='imgProd/thumbs/IMG_6900_thumb.jpg'></a></li>
    </ul>
    </div>
</div>
HERE;

echo $output;

Link to comment
Share on other sites

The html works fine but the php doesn't display properly. here's the difference.

 

 

HTML

 


    <div class="product_box margin_r40">
    <div class="image_wrapper">     
        <a href="../shops/adysshop/items/IMG_6724.JPG" class="jqzoom" rel='gal1'  title="Product Preview" >
            <img src="../shops/adysshop/items/IMG_6724_small.jpg"  title="triumph"  style="border: 4px solid #666;">
        </a>
    </div>
<br/>
    <p> </p>
<div class="clearfix" >
<ul id="thumblist" class="clearfix" >
	<li><a class="zoomThumbActive" href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: '../shops/adysshop/items/IMG_6724_small.jpg',largeimage: '../shops/adysshop/items/IMG_6724.JPG'}"><img src='../shops/adysshop/items/IMG_6724_thumb.jpg'></a></li>
	<li><a href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './imgProd/IMG_6972_small.jpg',largeimage: './imgProd/IMG_6972.JPG'}"><img src='imgProd/thumbs/IMG_6972_thumb.jpg'></a></li>
	<li><a  href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: './imgProd/IMG_6900_small.jpg',largeimage: './imgProd/IMG_6900.JPG'}"><img src='imgProd/thumbs/IMG_6900_thumb.jpg'></a></li>
</ul>
</div>
</div>

 

 

PHP

 


	echo '<div class="product_box margin_r40">';
	echo '<div class="image_wrapper">';
	echo '<a href="../shops/'.$row['s_page'].'/items/'.$row['pic'].'" class="jqzoom" rel="gal1"  title="Product Preview"><img src="../shops/'.$row['s_page'].'/items/'.$row['pic_small'].'" title="triumph" style="border: 4px solid #666;"></a>';
	echo '</div>';
	echo '<br/>';
	echo '<p> </p>';
	echo ' <div class="clearfix" >';
	echo '<ul id="thumblist" class="clearfix" >';
	echo '<li><a class="zoomThumbActive" href="javascript:void(0);" rel={gallery: "gal1", smallimage: "../shops/adysshop/items/IMG_6724_small.jpg",largeimage: "../shops/adysshop/items/IMG_6724.JPG"}><img src="../shops/adysshop/items/IMG_6724_thumb.jpg"></a></li>';
	echo '<li><a href="javascript:void(0);" rel={gallery: "gal1", smallimage: "./imgProd/IMG_6972_small.jpg",largeimage: "./imgProd/IMG_6972.JPG"}><img src="imgProd/thumbs/IMG_6972_thumb.jpg"></a></li>';
	echo '<li><a  href="javascript:void(0);" rel={gallery: "gal1", smallimage: "./imgProd/IMG_6900_small.jpg",largeimage: "./imgProd/IMG_6900.JPG"}><img src="imgProd/thumbs/IMG_6900_thumb.jpg"></a></li>';
	echo '</ul>';
	echo '</div>';
	echo '</div>';

 

It looks about right so why is it not working.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.