Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12372
Latest: AllMassive
New This Month: 8
New This Week: 3
New Today: 3
Stats
Total Posts: 39810
Total Topics: 7016
Most Online Today: 132
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 1
Guests: 40
Total: 41

Author Topic: Simple Portal Block - Classifieds  (Read 24294 times)

0 Members and 1 Guest are viewing this topic.

Offline ardvark

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #15 on: April 03, 2014, 12:40:49 pm »
Hi,

I am using the code you had posted (pasted below) in an adseller pro ad (after last post).  It is functionally working perfectly but I am getting the formatting error below.  Can you assist?

On site example: http://www.standupzone.com/forum/index.php/topic,23689.msg238919/topicseen.html#new

Code: [Select]
//  ClassifiedsBlock(2,4, 'random','vertical');
//  ClassifiedsBlock(1,1, 'random','vertical');
  ClassifiedsBlock(2,4, 'random','horizonstal');



function ClassifiedsBlock($rows = 4, $listings = 4, $type = 'recent', $category = 0,  $format = 'vertical',  $startHtml = '', $endHtml = '')
{
global  $smcFunc, $scripturl, $txt, $modSettings, $boardurl, $user_info, $context, $sourcedir, $boarddir;

$rows = (int) $rows;
$listings = (int) $listings;
$category  = (int) $category;






// Html Header
echo $startHtml;


// Load the language files
if (loadlanguage('classifieds') == false)
loadLanguage('classifieds', 'english');

$g_manage = allowedTo('smfclassifieds_manage');

$groupsdata = implode($user_info['groups'],',');

if (empty($modSettings['class_url']))
$modSettings['class_url'] = $boardurl . '/classifieds/';

if (empty($modSettings['class_path']))
$modSettings['class_path'] = $boarddir . '/classifieds/';

$maxrowlevel = $rows;
echo '<table cellspacing="0" cellpadding="5" border="0" align="center" width="100%">

';
// Check what type it is
$query = ' ';
switch($type)
{
case 'recent':
$query = "SELECT i.ID_LISTING, i.commenttotal,
i.primaryID_PICTURE, i.title, p.thumbfilename, p.remotefilename, i.currentbid,i.currency,
i.datelisted, i.views, i.is_auction, i.totalbids, i.ID_CAT, c.noprice, i.expiredate
FROM {db_prefix}class_listing as i
LEFT JOIN {db_prefix}class_listing_pic as p ON (i.primaryID_PICTURE = p.ID_PICTURE)
LEFT JOIN {db_prefix}class_cat as c ON (i.ID_CAT = c.ID_CAT)
LEFT JOIN {db_prefix}class_catperm AS r ON (r.ID_GROUP IN ($groupsdata) AND r.ID_CAT = i.ID_CAT)
WHERE i.removed = 0 AND i.approved = 1  AND (r.view IS NULL || r.view =1) GROUP BY i.ID_LISTING ORDER BY i.ID_LISTING DESC LIMIT $listings";
break;

case 'viewed':
$query = "SELECT i.ID_LISTING, i.commenttotal,
i.primaryID_PICTURE, i.title, p.thumbfilename, p.remotefilename, i.currentbid,i.currency,
i.datelisted, i.views, i.is_auction, i.totalbids, i.ID_CAT, c.noprice, i.expiredate
FROM {db_prefix}class_listing as i
LEFT JOIN {db_prefix}class_listing_pic as p ON (i.primaryID_PICTURE = p.ID_PICTURE)
LEFT JOIN {db_prefix}class_cat as c ON (i.ID_CAT = c.ID_CAT)
LEFT JOIN {db_prefix}class_catperm AS r ON (r.ID_GROUP IN ($groupsdata) AND r.ID_CAT = i.ID_CAT)
WHERE i.removed = 0 AND i.approved = 1  AND (r.view IS NULL || r.view =1) GROUP BY i.ID_LISTING ORDER BY  i.views DESC LIMIT $listings";
break;
                
   case 'random':
$query = "SELECT i.ID_LISTING, i.commenttotal,
i.primaryID_PICTURE, i.title, p.thumbfilename, p.remotefilename, i.currentbid,i.currency,
i.datelisted, i.views, i.is_auction, i.totalbids, i.ID_CAT, c.noprice, i.expiredate
FROM {db_prefix}class_listing as i
LEFT JOIN {db_prefix}class_listing_pic as p ON (i.primaryID_PICTURE = p.ID_PICTURE)
LEFT JOIN {db_prefix}class_cat as c ON (i.ID_CAT = c.ID_CAT)
LEFT JOIN {db_prefix}class_catperm AS r ON (r.ID_GROUP IN ($groupsdata) AND r.ID_CAT = i.ID_CAT)
WHERE i.removed = 0 AND i.approved = 1  AND (r.view IS NULL || r.view =1) GROUP BY i.ID_LISTING ORDER BY  RAND() DESC LIMIT $listings";
break;
                

case 'mostcomments':
$query = "SELECT i.ID_LISTING, i.commenttotal,
i.primaryID_PICTURE, i.title, p.thumbfilename, p.remotefilename, i.currentbid,i.currency,
i.datelisted, i.views, i.is_auction, i.totalbids, i.ID_CAT, c.noprice, i.expiredate
FROM {db_prefix}class_listing as i
LEFT JOIN {db_prefix}class_listing_pic as p ON (i.primaryID_PICTURE = p.ID_PICTURE)
LEFT JOIN {db_prefix}class_cat as c ON (i.ID_CAT = c.ID_CAT)
LEFT JOIN {db_prefix}class_catperm AS r ON (r.ID_GROUP IN ($groupsdata) AND r.ID_CAT = i.ID_CAT)
WHERE i.removed = 0 AND i.approved = 1  AND (r.view IS NULL || r.view =1) GROUP BY i.ID_LISTING ORDER BY i.commenttotal DESC LIMIT $listings";
break;

case 'featured':
$query = "SELECT i.ID_LISTING, i.commenttotal,
i.primaryID_PICTURE, i.title, p.thumbfilename, p.remotefilename, i.currentbid,i.currency,
i.datelisted, i.views, i.is_auction, i.totalbids, i.ID_CAT, c.noprice, i.expiredate
FROM {db_prefix}class_listing as i
LEFT JOIN {db_prefix}class_listing_pic as p ON (i.primaryID_PICTURE = p.ID_PICTURE)
LEFT JOIN {db_prefix}class_cat as c ON (i.ID_CAT = c.ID_CAT)
LEFT JOIN {db_prefix}class_catperm AS r ON (r.ID_GROUP IN ($groupsdata) AND r.ID_CAT = i.ID_CAT)
WHERE i.removed = 0 AND i.approved = 1 AND i.featuredlisting = 1  AND (r.view IS NULL || r.view =1) GROUP BY i.ID_LISTING ORDER BY i.ID_LISTING DESC LIMIT $listings";
break;


}
// Execute the SQL query
$dbresult = $smcFunc['db_query']('', $query);
$rowlevel = 0;
while($row = $smcFunc['db_fetch_assoc']($dbresult))
{
if ($rowlevel == 0)
echo '<tr class="windowbg2">';

echo '<td align="center"><a href="', $scripturl, '?action=classifieds;sa=view;id=', $row['ID_LISTING'], '">', $row['title'], '</a><br />';

if (!empty($row['primaryID_PICTURE']) && $modSettings['class_catlist_showimage'])
{

if (empty($row['remotefilename']))
echo '<a href="', $scripturl, '?action=classifieds;sa=view;id=', $row['ID_LISTING'], '"><img src="', $modSettings['class_url'], $row['thumbfilename'], '" alt="" /></a><br />';
else
echo '<a href="', $scripturl, '?action=classifieds;sa=view;id=', $row['ID_LISTING'], '"><img src="', $row['remotefilename'], '" alt="" /></a><br />';

}

echo '<span class="smalltext">';


if (!empty($modSettings['class_catlist_currentprice']) && $row['noprice'] == 0)
echo $txt['class_text_price'] . SMFEzformatprice($row['currentbid'],$row['currency']) . '<br />';


if (!empty($modSettings['class_catlist_listingdate']))
            {
                if (!empty($modSettings['class_set_date_format_mdy']))
                    echo $txt['class_text_date'] .  date($modSettings['class_set_date_format_mdy'],$row['datelisted']), ' ', date($modSettings['class_set_date_format_hia'],$row['datelisted']) . '<br />';
                else
                    echo $txt['class_text_date'] . date("m/d/Y",$row['datelisted']) . ' ' . date("h:i a",$row['datelisted'])  . '<br />';
            
            }




if ($modSettings['class_catlist_timeleft'])
{
echo  $txt['class_txt_time_left'] ;

echo   ($row['expiredate'] == 0 ? $txt['class_expire_never'] :   SMFezblockclass_cattimeleft( date("Y",$row['expiredate']), date("m",$row['expiredate']), date("d",$row['expiredate']), date("H",$row['expiredate']), date("i",$row['expiredate']),date("s",$row['expiredate'])) ) , '<br />';

}



if (!empty($modSettings['class_catlist_numofbids']) && $row['noprice'] == 0 && $row['is_auction'] == 1)
echo $txt['class_text_totalbids'] . ' ' . $row['totalbids'] . '<br />';


if (!empty($modSettings['class_catlist_comments']))
echo $txt['class_text_comments'] . ' (<a href="' . $scripturl . '?action=classifieds;sa=view;id=' . $row['ID_LISTING'] . '">' . $row['commenttotal'] . '</a>)<br />';

if ($g_manage)
{
if ($row['is_auction'] == 0)
echo '&nbsp;<a href="' . $scripturl . '?action=classifieds;sa=editlisting;id=' . $row['ID_LISTING'] . '">' . $txt['class_text_edit'] . '</a>';
else
echo '&nbsp;<a href="' . $scripturl . '?action=classifieds;sa=editauction;id=' . $row['ID_LISTING'] . '">' . $txt['class_text_edit'] . '</a>';


echo '&nbsp;<a href="' . $scripturl . '?action=classifieds;sa=deletelisting;id=' . $row['ID_LISTING'] . '">' . $txt['class_text_delete'] . '</a>';

}

echo '</span></td>';


if($rowlevel < ($maxrowlevel-1))
$rowlevel++;
else
{
echo '</tr>';
$rowlevel = 0;
}
}
if($rowlevel !=0)
{
echo '</tr>';
}

echo '
     </table><br />';
// Free the Mysql Resoruces
$smcFunc['db_free_result']($dbresult);

// Html Footer
echo $endHtml;

}
function SMFEzformatprice($price,$currency)
{
if ($currency == 'USD')
return  '$' .  number_format($price, 2, '.', '');
else if ($currency == 'GBP')
return  '' .  number_format($price, 2, '.', '');
elseif ($currency == 'CAD')
return  '$' .  number_format($price, 2, '.', '');
elseif ($currency == 'AUD')
return  '$' .  number_format($price, 2, '.', '');
  elseif ($currency == 'ZAR')
return  'R ' .  number_format($price, 2, '-', '');
else
return $price . ' ' . $currency;

}


function SMFezblockclass_cattimeleft($year, $month, $day, $hour, $minute, $seconds)
{
global $txt;
  // make a unix timestamp for the given date
  $the_countdown_date = mktime($hour, $minute, $seconds, $month, $day, $year, -1);

  // get current unix timestamp
  $today = forum_time(false);
  

  $difference = $the_countdown_date - $today;
  if ($difference < 0) $difference = 0;

  $days_left = floor($difference/60/60/24);
  $hours_left = floor(($difference - $days_left*60*60*24)/60/60);
  $minutes_left = floor(($difference - $days_left*60*60*24 - $hours_left*60*60)/60);
  $seconds_left = floor(($difference - $days_left*60*60*24 - $hours_left*60*60 - $minutes_left*60));


  
  if ($days_left == 0 && $hours_left == 0 &&  $minutes_left < 5  && ($minutes_left != 0 && $seconds_left  !=0))
  {
   echo '<font color="#FF0000">';
  }
  
  echo '<span class="smalltext">';
  
  if ($days_left > 0)
  {
   echo $days_left . 'd ' . $hours_left  . 'h ' . $minutes_left . 'm';
  }
  else
  {
   if ($hours_left > 0)
   echo $hours_left  . 'h ' . $minutes_left . 'm';
   else
   {
  
   if ($minutes_left > 0)
   echo $minutes_left . 'm ' . $seconds_left . 's';
   else
   {
   if ($seconds_left > 0)
   echo  $seconds_left . 's';
  
   }
  
  
   }
    
  }
  

  echo '</span>';
  
  if ($days_left == 0 && $hours_left == 0 &&  $minutes_left < 5  && ($minutes_left != 0 && $seconds_left  !=0))
  {
   echo '</font>';
  }
  
}

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14919
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #16 on: April 03, 2014, 12:42:29 pm »
What is the error how do you want it to appear?
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ardvark

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #17 on: April 03, 2014, 12:55:22 pm »
What is the error how do you want it to appear?

I am unsure why but the title bar (I am unsure what it is called but I "arrowed" it in the image I uploaded above) is showing up below the content rather than above it.  Thanks as always.

Offline ardvark

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #18 on: April 04, 2014, 05:53:47 am »
...or would that formatting be coding form the Adseller Pro side?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14919
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #19 on: April 04, 2014, 07:51:44 am »
Attach your themes display.template.php
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ardvark

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #20 on: April 04, 2014, 09:02:05 am »
OK, attached.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14919
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #21 on: April 04, 2014, 11:34:03 am »
That first link on your page I can't see since not open to guests.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ardvark

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #22 on: April 04, 2014, 12:57:04 pm »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14919
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #23 on: April 04, 2014, 01:02:31 pm »
This should fix it.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ardvark

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #24 on: April 04, 2014, 01:28:15 pm »
I uploaded that one but it knocked out the classifieds insertion on that page.  I left it live so you can have a look.  I appreciate your efforts!

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14919
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #25 on: April 04, 2014, 01:35:11 pm »
Try again
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ardvark

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #26 on: April 04, 2014, 01:42:17 pm »
That one produced that layout error in the attachment.

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 14919
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #27 on: April 04, 2014, 01:47:32 pm »
We can try this without any formatting
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline ardvark

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #28 on: April 04, 2014, 02:05:55 pm »
Works for me.  Thanks again!

Offline mrnuke7175

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Simple Portal Block - Classifieds
« Reply #29 on: February 01, 2015, 05:08:31 pm »
This works for me also.

SMF 2.0.9, SimplePortal 2.3.6

 

Related Topics

  Subject / Started by Replies Last post
6 Replies
8333 Views
Last post May 11, 2007, 02:18:33 pm
by asklife
0 Replies
2621 Views
Last post May 04, 2008, 08:57:46 am
by newguyatthis
0 Replies
3186 Views
Last post November 30, 2009, 04:30:30 am
by Mr.Pyscho
1 Replies
4083 Views
Last post September 11, 2011, 10:31:11 am
by SMFHacks
16 Replies
5692 Views
Last post December 30, 2014, 02:53:45 pm
by dan4ever

+- Recent Topics

How to AVOID SEO Hit when Implementing PrettyURLs by SMFHacks
September 12, 2019, 08:50:42 pm

theme by SMFHacks
September 12, 2019, 07:10:51 am

Picture Edit by SMFHacks
August 27, 2019, 11:52:06 am

Getting an error while installing SMF Gallery Pro by SMFHacks
August 18, 2019, 06:54:37 pm

Hashtag Mod Install Error by SMFHacks
August 15, 2019, 08:17:45 am

Rotating Image URLs by SMFHacks
August 05, 2019, 04:26:57 pm

[Mod]Block Proxy VPN On Registration by SMFHacks
August 01, 2019, 10:42:37 pm

[Mod]Nofollow Signature Links by SMFHacks
July 30, 2019, 11:52:28 am

Thinking of getting Ad Seller Pro as well by ajac63
July 28, 2019, 04:46:34 am

Just some questions about Ad Management mod by ajac63
July 26, 2019, 12:12:26 pm

Powered by EzPortal