eSyndiCat User Forums esyndicat directory software esyndicat support

Go Back   eSyndiCat User Forums > eSyndiCat Directory Software [FREE] > Common Questions

Common Questions Latest releases, patches, bugfixes and changes in eSyndiCat Directory Software free version. Feel really frustrated after having spent several hours trying to figure out what went wrong with your directory? Wait no more! Click the link above and post your issues. Right here. Right now.

Reply
 
Thread Tools Display Modes
Old 03-16-2010   #1
Grovir
 
Join Date: Jan 2009
Posts: 20
Grovir is on a distinguished road
Default Random

Is there a way to pull random links to show in a specified location on the front page, or any page for that matter?
__________________
http://rclinks.co.cc
Grovir is offline   Reply With Quote
Old 03-18-2010   #2
Vladimir T.
Tech Support
 
Vladimir T.'s Avatar
 
Join Date: Nov 2007
Location: Earth
Posts: 973
Vladimir T. is on a distinguished road
Default

I have delete common question.
ok. Please do following steps:
1. Edit ./includes/classes/DirListing.php file

find code
PHP Code:
function getLatest($aStart 0$aLimit 0$aAccount '')
{
    
$sql "SELECT t1.*, `t1`.`comments_active` `comments`, t9.`path` ";
    
$sql .= $aAccount ', IF((`t1`.`id_account` IS NULL)
        OR (`t1`.`id_account` = \'0\'), \'0\', \'1\') `id_account_edit` ' 
', \'0\' `id_account_edit` ';
    
$sql .= "FROM `".$this->mTable."` t1 ";
    
$sql .= "LEFT JOIN `".$this->mPrefix."categories` t9 ";
    
$sql .= "ON t1.`id_category` = t9.`id` ";
    
$sql .= "WHERE t1.`status` = 'active' ";
    
$sql .= "AND t9.`status` = 'active' ";
    
//$sql .= "GROUP BY t1.`id` ";
    
$sql .= "ORDER BY t1.`date` DESC ";    
    
$sql .= $aLimit "LIMIT {$aStart}, {$aLimit}" '';
    
    return 
$this->getAll($sql);

add after
PHP Code:
/**
* Returns random listings
*
* @param int $aStart starting position
* @param int $aLimit number of listings to be returned
* @param int $aAccount account id
*
* @return arr
*/
function getRandom($aStart 0$aLimit 0$aAccount '')
{
    
$sql "SELECT t1.*, `t1`.`comments_active` `comments`, t9.`path` ";
    
$sql .= $aAccount ', IF((`t1`.`id_account` IS NULL)
        OR (`t1`.`id_account` = \'0\'), \'0\', \'1\') `id_account_edit` ' 
', \'0\' `id_account_edit` ';
    
$sql .= "FROM `".$this->mTable."` t1 ";
    
$sql .= "LEFT JOIN `".$this->mPrefix."categories` t9 ";
    
$sql .= "ON t1.`id_category` = t9.`id` ";
    
$sql .= "WHERE t1.`status` = 'active' ";
    
$sql .= "AND t9.`status` = 'active' ";
    
$sql .= "ORDER BY RAND() ";    
    
$sql .= $aLimit "LIMIT {$aStart}, {$aLimit}" '';
    return 
$this->getAll($sql);

2. Edit ./includes/view.inc.php file
find code
PHP Code:
/** get partner listings **/
if ($config->get('partner_listings'))
{
    
$partner_listings $Listing->getPartner($id0$config->get('num_partner_display'));
    
$gDirSmarty->assign_by_ref('partner_listings'$partner_listings);

add after
Code:
/**Get Random Listing **/
$random_listings = $Listing->getRandom(0, 10, $gDirAccount['id']);
$gDirSmarty->assign_by_ref('random_listings', $random_listings);
where 10 - is number of random links

3) code for template
Code:
   
{if $random_listings}
<table cellspacing="0" cellpadding="0">
	{foreach from=$random_listings item=listing}
		{include file="listing-display.tpl"}						
	{/foreach}
</table>
{/if}
You can use it code anywhere in template.
__________________
Best Regards,

If you need help just send ticket to HelpDesk
For you information: I disabled Private Message.

I do not available...
PP.S. Admin Panel 2.3 manual is available here http://www.esyndicat.com/docs/
Vladimir T. is offline   Reply With Quote
Old 03-19-2010   #3
Grovir
 
Join Date: Jan 2009
Posts: 20
Grovir is on a distinguished road
Default

You, sir, are a genius! Thank you!

One minor change to your instructions. I do not have a file named esynListing.php in my includes/classes directory, the file I edited is named DirListing.php.

Other then that it worked great! Thanks again!
__________________
http://rclinks.co.cc
Grovir is offline   Reply With Quote
Old 03-19-2010   #4
Vladimir T.
Tech Support
 
Vladimir T.'s Avatar
 
Join Date: Nov 2007
Location: Earth
Posts: 973
Vladimir T. is on a distinguished road
Default

Oh, Yes you are right. I have inserted name of file from Pro version. I have edit...
__________________
Best Regards,

If you need help just send ticket to HelpDesk
For you information: I disabled Private Message.

I do not available...
PP.S. Admin Panel 2.3 manual is available here http://www.esyndicat.com/docs/
Vladimir T. is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 06:29 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Testimonials | Articles | Support | Documentation | Privacy Policy | License | Affiliates | Contact Us | SEO Resources