Ok here is a section of the php code that is dealing with the lists I am wanting to use it for
Code:
<ul id="itemposts">
<?php
if ($resultSearch){
foreach ( $resultSearch as $row ){
$idPost=$row['idPost'];
$postType=$row['type'];
$postTypeName=getTypeName($postType);
$postTitle=$row['title'];
$postLocation=$row['idLocation'];
$postPlace=$row['place'];
$postPrice=$row['price'];
$postDesc= substr(strip_tags(html_entity_decode($row['description'], ENT_QUOTES, CHARSET)), 0, 160);
$category=$row['category'];//real category name
$fcategory=$row['fcategory'];//friendly name category
$idCategoryParent=$row['idCategoryParent'];
$fCategoryParent=$row['parent'];
$postImage=$row['image'];
$postPassword=$row['password'];
$postPhone=$row['phone'];
$insertDate=setDate($row['insertDate']);
$postUrl=itemURL($idPost,$fcategory,$postTypeName,$postTitle,$fCategoryParent);
if ($row["hasImages"]==1){
$postImage=getPostImages($idPost,$insertDate,true,false);
}
else $postImage=getPostImages(true,true,true,true);//there's no image
?>
<li><a title="<?php echo $postTitle." in ".$category;?>" href="<?php echo SITE_URL.$postUrl;?>" rel="bookmark" class="postlink"><span class="post-title"><?php echo $postTitle;?></span> <span class="post-desc"><?php echo $postDesc;?></span> <?php if ($postPrice==0){ echo '<span class="post-price-free">FREE</span>';} else { echo '<span class="post-price">'.getPrice($postPrice).'</span>';} ?>, <span class="post-place"><?php echo $postPlace.", ".getLocationName($postLocation); ?>.</span> <span class="post-phone"><?php if ($postPhone!=""){?><?php echo _("Ph");?>: <?php echo formatPhone($postPhone); ?><?php }?></span> <span class="post-date"><?php echo $insertDate;?></span></a><br /><span class="advicons"><?php if ($row["hasImages"]==1){?><a class="picture" href="#thumb"><img src="<?php echo SITE_URL.'/themes/'.DEFAULT_THEME;?>/images/icon-photo.png" width="16" height="16" alt="picture" /><span><img title="<?php echo $postTitle." in ".$category;?>" alt="<?php echo $postTitle." in ".$category;?>" src="<?php echo $postImage;?>" class="post-img" /><br /><?php echo $postTitle." in ".$category;?></span></a><?php }?><a title="Contact the owner of this advert" href="<?php echo SITE_URL.$postUrl;?>" rel="bookmark" class="postlink"><img src="<?php echo SITE_URL.'/themes/'.DEFAULT_THEME;?>/images/icon-contact.png" width="16" height="16" alt="Contact the owner of this advert" /></a><a href="<?php echo SITE_URL."/".contactURL();?>?subject=<?php echo _("Advert Report:");?> <?php echo $itemName." (".$idItem.")";?>" title="Report this advert"><img src="<?php echo SITE_URL.'/themes/'.DEFAULT_THEME;?>/images/icon-report.png" width="16" height="16" alt="Report this advert" /></a></span>
<?php if(isset($_SESSION['admin'])){?>
<br /><a href="<?php echo SITE_URL;?>/manage/?post=<?php echo $idPost;?>&pwd=<?php echo $postPassword;?>&action=edit">
<?php echo _("Edit");?></a><?php echo SEPARATOR;?>
<a onClick="return confirm('<?php echo _("Deactivate");?>?');" href="<?php echo SITE_URL;?>/manage/?post=<?php echo $idPost;?>&pwd=<?php echo $postPassword;?>&action=deactivate">
<?php echo _("Deactivate");?></a><?php echo SEPARATOR;?>
<a onClick="return confirm('<?php echo _("Spam");?>?');" href="<?php echo SITE_URL;?>/manage/?post=<?php echo $idPost;?>&pwd=<?php echo $postPassword;?>&action=spam">
<?php echo _("Spam");?></a><?php echo SEPARATOR;?>
<a onClick="return confirm('<?php echo _("Delete");?>?');" href="<?php echo SITE_URL;?>/manage/?post=<?php echo $idPost;?>&pwd=<?php echo $postPassword;?>&action=delete">
<?php echo _("Delete");?></a>
<?php }?>
</li>
<?php
}
}//end if check there's results
else echo "<p>"._("Nothing found")."</p>";
?>
</ul>
And this is the related section for the mysql
Code:
$query="SELECT p.idPost,p.title,p.description,p.insertDate,p.place,p.idLocation,c.Name category,c.friendlyName fcategory,c.idCategoryParent,p.type,p.price,p.password,p.phone,p.hasImages,
(select friendlyName from ".TABLE_PREFIX."categories where idCategory=c.idCategoryParent limit 1) parent
FROM ".TABLE_PREFIX."posts p
inner join ".TABLE_PREFIX."categories c
on c.idCategory=p.idCategory
where p.isAvailable=1 and p.isConfirmed=1 $filter
order by $order $limit";
//echo $query;
$resultSearch=$ocdb->getRows($query);
Does that help or do you need more info?
Bookmarks