Hello Everybody,
I wanted to put the 6 most recent listings with pictures and title of item on my page that update after each new listing so I followed USERX's Display Newest Listing post. Here is his post,
http://idevspot.com/forum/index.php/topic,996.0.htmlThis is a great start but it just gives you the title as a hyperlink but I wanted a picture and title. I have to tell you I'm new to this html-php stuff but I made my way through it and it works nice but if anybody has any improvements I'm all ears.
Go to my site and try them, I put this feature in the business directory software, auto classified software and real estate listing software and it works well in all. Here are the links.
http://www.sharpcountyimage.com/phprealestate_1/index.phphttp://www.sharpcountyimage.com/classifieds/index.php Classified was made with BusinessDirectory Software.
http://www.sharpcountyimage.com/auto/index.php Lets get started, This is for Business Directory Script.There are 2 steps, first go to your home.php and look for this around line 35 </script>
<body onLoad="MM_preloadImages('buttons/post_ad_2.png')">
<form action="index.php?page=browse&mode=search" method="post" style="display: inline; margin: 0;">
Copy the text below and paste them right after the line above. <table width="1000" border="0" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<td width="1000" height="8"></td>
</tr>
<tr>
<td height="25" valign="top" background="images/ResentlyAdded.jpg" bgcolor="#99CCCC"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="130" valign="top"><table width="1000px" height="130" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="50" height="129"></td>
<td width="900" align="left" valign="baseline" nowrap>
<?PHP include "NewestListingTest.php"; ?>
</td>
<td width="50"></td>
</tr>
</table></td>
</tr>
</table>
NOTE: If you look at this line below you will notice images/ResentlyAdded.jpg this is my Recently Added Listing Title bar. Replace this with anything you want. <td height="25" valign="top" background="images/ResentlyAdded.jpg" bgcolor="#99CCCC"><!--DWLayoutEmptyCell--> </td>
Second, Make a php page and call it NewestListingTest.php delete everything in the page and copy and paste the below in the page.After that upload everything and it will work nicely. This step is the same for all 3 scripts, BUSINESS, REAL ESTATE and AUTO software. <?
// create query
//------------------------------------------------------------------------------------------------------
$SQL = "SELECT * from LISTINGS WHERE STATUS = 'Active' ORDER BY ID DESC LIMIT 6";
$result = @mysql_query( $SQL ); while( $row = @mysql_fetch_array( $result ) ) {
//-----------------------------------------------------------------------------
?> <a href = "">
</a>
<table width="150" ALIGN=left border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="6" height="5"></td>
<td width="137"></td>
<td width="7"></td>
</tr>
<tr>
<td height="86"></td>
<td valign="top"><a href="<?PHP mrd("businessdetail", "$row[ID]", "$row[CATEGORY]", "$rowxxx[MR]", "index.php?page=detail"); ?
>"><img src="product_images/large/<?php echo "$row[IMAGENAME]"; ?>.jpg" width="135" height="84" border="1" /></a></td>
<td></td>
</tr>
<tr>
<td height="25" colspan="3" valign="top"> <div align="center"><a href="<?PHP mrd("businessdetail", "$row[ID]", "$row[CATEGORY]",
"$rowxxx[MR]", "index.php?page=detail"); ?>"><?php echo "$row[TITLE]"; ?></a>
</div></td>
</tr>
</table>
<? } ?>
Thats IT!---------------------------------------------------------------------------------------------------------------------------------------------
This is for Real Estate Directory Script. There are 2 steps, first go to your home.php and look for this around line 31 </script>
<body onLoad="MM_preloadImages('images/post1.png')">
Copy the text below and paste them right after the line above. <table width="1000" border="0" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<td width="1000" height="8"></td>
</tr>
<tr>
<td height="25" valign="top" background="images/ResentlyAdded.jpg" bgcolor="#99CCCC"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="130" valign="top"><table width="1000px" height="130" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="50" height="129"></td>
<td width="900" align="left" valign="baseline" nowrap>
<?PHP include "NewestListingTest.php"; ?>
</td>
<td width="50"></td>
</tr>
</table></td>
</tr>
</table>
NOTE: If you look at this line below you will notice images/ResentlyAdded.jpg this is my Recently Added Listing Title bar. Replace this with anything you want. <td height="25" valign="top" background="images/ResentlyAdded.jpg" bgcolor="#99CCCC"><!--DWLayoutEmptyCell--> </td>
Second, Make a php page and call it NewestListingTest.php delete everything in the page and copy and paste the below in the page. After that upload everything and it will work nicely. This step is the same for all 3 scripts, BUSINESS, REAL ESTATE and AUTO software. <?
// create query
//------------------------------------------------------------------------------------------------------
$SQL = "SELECT * from LISTINGS WHERE STATUS = 'Active' ORDER BY ID DESC LIMIT 6";
$result = @mysql_query( $SQL ); while( $row = @mysql_fetch_array( $result ) ) {
//-----------------------------------------------------------------------------
?> <a href = "">
</a>
<table width="150" ALIGN=left border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="6" height="5"></td>
<td width="137"></td>
<td width="7"></td>
</tr>
<tr>
<td height="86"></td>
<td valign="top"><a href="<?PHP mrd("businessdetail", "$row[ID]", "$row[CATEGORY]", "$rowxxx[MR]", "index.php?page=detail"); ?
>"><img src="product_images/large/<?php echo "$row[IMAGENAME]"; ?>.jpg" width="135" height="84" border="1" /></a></td>
<td></td>
</tr>
<tr>
<td height="25" colspan="3" valign="top"> <div align="center"><a href="<?PHP mrd("businessdetail", "$row[ID]", "$row[CATEGORY]",
"$rowxxx[MR]", "index.php?page=detail"); ?>"><?php echo "$row[TITLE]"; ?></a>
</div></td>
</tr>
</table>
<? } ?>
Thats IT!
------------------------------------------------------------------------------------------------------------------------------------------------
This is for Auto Directory Script. There are 2 steps, first go to your home.php and look for this around line 33 </script>
<body onLoad="MM_preloadImages('images/add_veh2.png')">
<form action="index.php?page=browse&mode=search" method="post" style="display: inline; margin: 0;" name="FieldName">
Copy the text below and paste them right after the line above. <table width="1000" border="0" cellpadding="0" cellspacing="0" >
<!--DWLayoutTable-->
<tr>
<td width="1000" height="8"></td>
</tr>
<tr>
<td height="25" valign="top" background="images/ResentlyAdded.jpg" bgcolor="#99CCCC"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="130" valign="top"><table width="1000px" height="130" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="50" height="129"></td>
<td width="900" align="left" valign="baseline" nowrap>
<?PHP include "NewestListingTest.php"; ?>
</td>
<td width="50"></td>
</tr>
</table></td>
</tr>
</table>
NOTE: If you look at this line below you will notice images/ResentlyAdded.jpg this is my Recently Added Listing Title bar. Replace this with anything you want. <td height="25" valign="top" background="images/ResentlyAdded.jpg" bgcolor="#99CCCC"><!--DWLayoutEmptyCell--> </td>
Second, Make a php page and call it NewestListingTest.php delete everything in the page and copy and paste the below in the page.After that upload everything and it will work nicely. This step is the same for all 3 scripts, BUSINESS, REAL ESTATE and AUTO software. <?
// create query
//------------------------------------------------------------------------------------------------------
$SQL = "SELECT * from LISTINGS WHERE STATUS = 'Active' ORDER BY ID DESC LIMIT 6";
$result = @mysql_query( $SQL ); while( $row = @mysql_fetch_array( $result ) ) {
//-----------------------------------------------------------------------------
?> <a href = "">
</a>
<table width="150" ALIGN=left border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="6" height="5"></td>
<td width="137"></td>
<td width="7"></td>
</tr>
<tr>
<td height="86"></td>
<td valign="top"><a href="<?PHP mrd("businessdetail", "$row[ID]", "$row[CATEGORY]", "$rowxxx[MR]", "index.php?page=detail"); ?
>"><img src="product_images/large/<?php echo "$row[IMAGENAME]"; ?>.jpg" width="135" height="84" border="1" /></a></td>
<td></td>
</tr>
<tr>
<td height="25" colspan="3" valign="top"> <div align="center"><a href="<?PHP mrd("businessdetail", "$row[ID]", "$row[CATEGORY]",
"$rowxxx[MR]", "index.php?page=detail"); ?>"><?php echo "$row[TITLE]"; ?></a>
</div></td>
</tr>
</table>
<? } ?>
Thats IT!