Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

  • Index
  •  » ClickCartPro 6
  •  » A Quick + Simple Product View For Locating HTML Errors, Links, etc..

#1 11-20-2010 19:18:26

Design_Wholesale
Member
From: England!
Registered: 11-21-2008
Posts: 1104
Website

A Quick + Simple Product View For Locating HTML Errors, Links, etc..

This code can be used in a new web page within the store to output the HTML code for every product in your store. - Various uses, including tracking down href links, and quickly checking product details.  Additionally, it has been coded so it can only be viewed if you are logged into an account on the store smile ...

The globals may not required - they are taken from the  file and should only be required if you find that the page can be viewed by anyone.

...and it will be necessary to change  to reference a file that contains your database name, user name, and password, which should (ideally) be located somewhere outside of your main web directory and definitely  readable by anyone browsing your webstore. - I will provide more details if required; although there are several posts on this already (: Perkster's sitemap modification).


Code:

<?php 

$app     = $this->globals('khxc_display.app');
$ns     = $this->globals('khxc.namespace');

if ($this->globals('khxc_user.id')) {

include '/conbrio.php';

mysql_connect("$s", "$u", "$p") or die(mysql_error());
mysql_select_db("$d") or die(mysql_error());

$result = mysql_query("SELECT DISTINCT id,imgsm,name,desclong FROM gbu0_prod ORDER BY rand()") or die(mysql_error());

while($row = mysql_fetch_array( $result )) {

print '<table border="0" cellpadding="0" cellspacing="10px"><tr><td style="text-align: justify;"><a href="/gbu0-prodshow/' . $row['id'] . '.html"><img width="100px" alt="" src="/media/gbu0/prodsm/' . $row['imgsm'] . '" title="' . $row['name'] . '" /></a><br /></td><td style="vertical-align: top; color: black; text-align: justify;"><strong>' . $row['name'] . '</strong><br /><br />' . preg_replace('/[<\(.*\)>|<\(.*\)\/>|<\/\(.*\)>]/','&isin;$1&ni;',$row['desclong']) . '</td></tr></table><br /><br />';

} // End of while statement.

} // End of if statement.

?>

This is a further edit, the main problem here, as with above, is that it does not appear to be possible to remove whitespace from the output, whilst periods and slashes also get removed.


Code:

<?php 

$app     = $this->globals('khxc_display.app');
$ns     = $this->globals('khxc.namespace');

if ($this->globals('khxc_user.id')) {

include '/conbrio.php';

mysql_connect("$s", "$u", "$p") or die(mysql_error());
mysql_select_db("$d") or die(mysql_error());

$result = mysql_query("SELECT DISTINCT id,imgsm,name,desclong FROM gbu0_prod ORDER BY rand()") or die(mysql_error());

while($row = mysql_fetch_array( $result )) {

print '<table border="0" cellpadding="0" cellspacing="10px"><tr><td style="text-align: justify;"><a href="/gbu0-prodshow/' . $row['id'] . '.html"><img width="100px" alt="" src="/media/gbu0/prodsm/' . $row['imgsm'] . '" title="' . $row['name'] . '" /></a><br /></td><td style="vertical-align: top; color: black; text-align: justify;"><strong>' . $row['name'] . '</strong><br /><br />' . preg_replace('/[<\(.*\)>|<\(.*\)\/>|<\/\(.*\)>]/','<span style="font-weight: bold;"><</span>$1<span style="font-weight: bold;">></span> ',$row['desclong']) . '</td></tr></table><br /><br />';

} // End of while statement.

} // End of if statement.

?>

This is a final edit. - It still does not display the full description, but it definitely works best:


Code:

<?php 

$app     = $this->globals('khxc_display.app');
$ns     = $this->globals('khxc.namespace');

if ($this->globals('khxc_user.id')) {

include '/conbrio.php';

mysql_connect("$s", "$u", "$p") or die(mysql_error());
mysql_select_db("$d") or die(mysql_error());

$result = mysql_query("SELECT DISTINCT id,imgsm,name,desclong FROM gbu0_prod ORDER BY rand()") or die(mysql_error());

while($row = mysql_fetch_array( $result )) {

print '<table border="0" cellpadding="0" cellspacing="10px"><tr><td style="text-align: justify;"><a href="/gbu0-prodshow/' . $row['id'] . '.html"><img width="100px" alt="" src="/media/gbu0/prodsm/' . $row['imgsm'] . '" title="' . $row['name'] . '" /></a><br /></td><td style="vertical-align: top; color: black; text-align: justify;"><strong>' . $row['name'] . '</strong><br /><br />' . preg_replace('/[<|>]/','<span style="font-weight: bold;"> -- </span>',$row['desclong']) . '</td></tr></table><br /><br />';

} // End of while statement.

} // End of if statement.

?>

Last edited by Design_Wholesale (11-20-2010 21:31:50)

Offline

 
  • Index
  •  » ClickCartPro 6
  •  » A Quick + Simple Product View For Locating HTML Errors, Links, etc..

Board footer