Jump to content

HELP Dolphin Classifieds


dave2010

Recommended Posts

I want to modify the way classifieds appear on the home page of the dolphin script can anyone please help?

I want to display 3 ads horizontally with photo, user(author) name and title. i have played with the code below and it now displays the info i need , vertically......... also i am struggling to understand what part is calling the classifieds ID as later i want to display the latest 3 items from a specified category..........

 

Please see the code:

(i have been pulling my hair out for days!!!!!) :)

 

***********************************************************************************************

 

function PageCompClassifieds( $sCaption ) { ob_start(); ?>

$sTabTitle

"; } else { $menu .= "

$sTabTitle

"; } } $menu .= '

'; $aTotalNum = db_arr( " SELECT COUNT(*) FROM `ClassifiedsAdvertisements` WHERE `Status` = 'active' " ); $iTotalNum = $aTotalNum[0]; if( $iTotalNum ) { //$iResPerPage = (int)getParam("max_classifieds_on_home"); $iResPerPage = (int)getParam("max_blogs_on_home"); //$iResPerPage = 3; $iTotalPages = ceil( $iTotalNum / $iResPerPage ); $page = (int)$_REQUEST['classifieds_page']; if( $page < 1 or $mode == 'rand' ) $page = 1; if( $page > $iTotalPages ) $page = $iTotalPages; $sqlLimitFrom = ( $page - 1 ) * $iResPerPage; //$iBlogLimitChars = (int)getParam("max_classified_preview"); $iBlogLimitChars = (int)getParam("max_blog_preview"); //$iBlogLimitChars = 50; $sBlogQuery = " SELECT DISTINCT `ClassifiedsAdvertisements`.`ID`, `ClassifiedsAdvertisements`.`Subject`, `ClassifiedsAdvertisements`.`Media`, `Profiles`.`NickName`, UNIX_TIMESTAMP( `ClassifiedsAdvertisements`.`DateTime` ) as `DateTime_f`, `ClassifiedsAdvertisements`.`DateTime`, `Classifieds`.`Name`, `Classifieds`.`ID` AS `CatID`, `ClassifiedsSubs`.`NameSub`, `ClassifiedsSubs`.`ID` AS `SubCatID`, LEFT(`ClassifiedsAdvertisements`.`Message`, $iBlogLimitChars) as 'Message', COUNT(`ClsAdvComments`.`ID`) AS 'CommCount' FROM `ClassifiedsAdvertisements` LEFT JOIN `ClassifiedsSubs` ON `ClassifiedsSubs`.`ID`=`ClassifiedsAdvertisements`.`IDClassifiedsSubs` LEFT JOIN `Classifieds` ON `Classifieds`.`ID`=`ClassifiedsSubs`.`IDClassified` LEFT JOIN `Profiles` ON `Profiles`.`ID`=`ClassifiedsAdvertisements`.`IDProfile` LEFT JOIN `ClsAdvComments` ON `ClsAdvComments`.`IDAdv`=`ClassifiedsAdvertisements`.`ID` GROUP BY `ClassifiedsAdvertisements`.`ID` ORDER BY $sqlOrderBy LIMIT $sqlLimitFrom, $iResPerPage "; $rBlog = db_res($sBlogQuery); $ret = ''; $oClassifieds = new BxDolClassifieds(); $ret .= '

'; while ($arr = mysql_fetch_array($rBlog)) { if ($mode == 'top' && $arr['CommCount'] == 0) continue; $sPic = $oClassifieds->getImageCode($arr['Media'],TRUE); $sLinkMore = ''; if ( strlen($arr['Message']) == $iBlogLimitChars ) $sLinkMore = "... "._t('_Read more').""; $ret .= '

'.$sPic.' '. process_line_output( $arr['Subject'] ). '

'. '' . _t( '_By Author', $arr['NickName'], $arr['NickName'] ) . '' . //'' . _t( '_in Category', getTemplateIcon( 'folder_small.png' ), 'classifieds.php?bClassifiedID='.$arr['CatID'], process_line_output($arr['Name']) ) . //' / '.process_line_output($arr['NameSub']).''. //'' . _t( '_comments N', getTemplateIcon( 'add_comment.gif' ), (int)$arr['CommCount'] ) . '' . '

 

 

'. //strip_tags(process_html_output( $arr['Message'] )).$sLinkMore. '

'; } $ret .= '

'; } else $ret .= '

'._t("_No classifieds available").'

'; if( $iTotalPages > 1 ) { $ret .= '

'; if( $page > 1 ) { $prevPage = $page - 1; $ret .= " "._t('_Back')." "; } if( $page < $iTotalPages ) { $nextPage = $page + 1; $ret .= " "._t('_Next')." "; } $ret .= '

'; } return DesignBoxContent( _t( $sCaption ), $ret, 1, $menu ); }

 

***********************************************************************************************

Link to comment
https://forums.phpfreaks.com/topic/97306-help-dolphin-classifieds/
Share on other sites

Ok, I have got  lot further, happy with lay out, now all i need to do is limit the SQL results to a specific catagory.

 

The table classifieds has the colum ID for speed boats. the value is '12'. I want to fetch / display only results WHERE classifeds ID=12

Where would or how shoould i modify the following?

 

$sBlogQuery = "
		SELECT DISTINCT
		`Classifieds`.`ID`=12,
		`ClassifiedsAdvertisements`.`ID`,
		`ClassifiedsAdvertisements`.`Subject`,
		`ClassifiedsAdvertisements`.`Media`,
		`Profiles`.`NickName`,
		UNIX_TIMESTAMP( `ClassifiedsAdvertisements`.`DateTime` ) as `DateTime_f`,
		`ClassifiedsAdvertisements`.`DateTime`,
		`Classifieds`.`Name`, `Classifieds`.`ID` AS `CatID`,
		`ClassifiedsSubs`.`NameSub`, `ClassifiedsSubs`.`ID` AS `SubCatID`,
		LEFT(`ClassifiedsAdvertisements`.`Message`, $iBlogLimitChars) as 'Message', 
		COUNT(`ClsAdvComments`.`ID`) AS 'CommCount'
		FROM `ClassifiedsAdvertisements`
		LEFT JOIN `ClassifiedsSubs`
		ON `ClassifiedsSubs`.`ID`=`ClassifiedsAdvertisements`.`IDClassifiedsSubs`
		LEFT JOIN `Classifieds`
		ON `Classifieds`.`ID`=`ClassifiedsSubs`.`IDClassified`
		LEFT JOIN `Profiles` ON `Profiles`.`ID`=`ClassifiedsAdvertisements`.`IDProfile`
		LEFT JOIN `ClsAdvComments` ON `ClsAdvComments`.`IDAdv`=`ClassifiedsAdvertisements`.`ID`
		GROUP BY `ClassifiedsAdvertisements`.`ID`
		ORDER BY $sqlOrderBy
		LIMIT $sqlLimitFrom, $iResPerPage			
	";

	$rBlog = db_res($sBlogQuery);
	$ret = '';

 

PLEASE use CODE blocks around your code

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.