Like Perl ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dstefani
Forum Contributor
Posts: 140
Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA

Like Perl ?

Post by dstefani »

I inherited a job and I'm trying to find documentaition on this.
print <<<HTML

It's being used like a Perl here_doc, I can't find anything on it in the manual.
This site uses Perl for most of the main cart processes, but all of the generated product pages are Php.

The above tag is in an '*.inc" file, that included file is called from a Php page.
Please take a look at a semi-complete snippet, it should be enough for you to see what he's doing.

Thanks,

-D

Code: Select all

if ($show_best_box) &#123;
	
print <<<HTML

			<!-- Start Best Seller Box -->
			<table border="1" cellpadding="5" cellspacing="0" style="border-collapse: collapse" bordercolor="#CCCCCC" width="160">
				<tr>
					<td width="100%" height="13" bgcolor="#DFE1E4">
						<b>Top Sellers</b>
					</td>
				</tr>
				<tr>
					<td width="100%" bgcolor="#EFEFEF" nowrap>
						<p align="left">
						<font size="2">
							<table cellspacing="0">
HTML;

							$query = "SELECT image1,name,category_name,price,product_id FROM sc_products WHERE on_popular = '1' ORDER BY RAND() LIMIT 5";
							$result = MYSQL_QUERY($query, $dblink);
							while($row = mysql_fetch_array($result))&#123;
								$url_path = FilterCategory($row&#1111;'category_name']);
								printf('<tr><td valign=top><br><a href="http://000.000.000.00/shop/wigs/'.$url_path.'/'.$row&#1111;'product_id'].'.php"><img src="http://000.000.000.00/shop/image_uploads/'.$row&#1111;'image1'].'" border=0></a></td><td valign=top><br>' . $row&#1111;'name'] . '<font size=1><br>Brand:' . $row&#1111;'category_name'] . '<br>Ace Price: <font color=red>' . $row&#1111;'price'] . '</font></font></td></tr>');
							&#125;							

print <<<HTML
							</table>
						<p>
						<a href="http://000.000.000.00/cgi-bin/shop/search.cgi?keyword=popular">More Top Sellers...</a>
						</font>
			            </p>
					</td>
				</tr>
			</table>
			<p>
			
HTML;

&#125;
User avatar
dstefani
Forum Contributor
Posts: 140
Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA

Post by dstefani »

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

http://www.perldoc.com/perl5.6.1/pod/pe ... lar-values
search for "here-document" on this page
You might also find http://perl.apache.org/docs/tutorials/t ... _beautiful interesting

edit:
<- slow finger ;)
Post Reply