Support Forums

Area to display # of members and # of ads

This is a discussion on Area to display # of members and # of ads within the Templates, HTML, CSS, and Design Help forums, part of the General category; Hi everyone, I would love to have a space on my homepage that says you have x number of current ...


Go Back   68 Classifieds Forums > General > Templates, HTML, CSS, and Design Help

Reply
 
Thread Tools Display Modes
Old 03-29-2006, 10:10 PM   #1
Member
 
zman78's Avatar
 
Join Date: Mar 2006
Posts: 53
Rep Power: 25
zman78 is on a distinguished road
Default Area to display # of members and # of ads

Hi everyone,
I would love to have a space on my homepage that says you have x number of current ads and x number of site members. I have seen it in many php programs, and im sure it must be possible. I am running the latest designer version. Can anyone help out on this one?

Zack
zman78 is offline   Reply With Quote
Old 03-29-2006, 10:21 PM   #2
Staff
 
Join Date: Mar 2006
Location: New Jersey
Posts: 2,201
Rep Power: 71
John Snyder is a jewel in the rough
Default

I'm not sure what files are encrypted. Eric are the smarty plugins encrypted? I wrote something to do this but having the designer version means those pages are encrypted.

I guess we could try a smarty file include or something. Give me a minute to see if that works.
__________________
John
68C Staff

68C Downloads | Report a Bug | Knowledge Base
If you have a current support subscription, you can Submit a Support Ticket

Last edited by John Snyder; 03-29-2006 at 10:24 PM.
John Snyder is offline   Reply With Quote
Old 03-29-2006, 10:28 PM   #3
68 Classifieds Staff
 
Eric Barnes's Avatar
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 5,489
Rep Power: 136
Eric Barnes is just really nice Eric Barnes is just really nice
Default

The smarty files should not be encrypted.

I did have a plugin for the total number of listings. I will see if I can find it but I am finally heading home so it will be in the morning.
__________________
Eric Barnes
68 Classifieds Developer
Customer Area | Issue Tracker | Documentation | 68C Mods | 68 @ Twitter | My Modules
Eric Barnes is offline   Reply With Quote
Old 03-29-2006, 10:37 PM   #4
Moderator
 
Chaslie's Avatar
 
Join Date: Mar 2006
Location: Great Ocean Road - Australia
Posts: 723
Rep Power: 38
Chaslie will become famous soon enough
Default

I have the below code inserted into my /templates/default/layout.tpl.php file for the 'date' and 'total number of listings':

Code:
{$smarty.now|date_format:"%A, %e %B, %Y"}<br>and there are
	{total_listings} <a href="toplistings.php?pg=new">entries</a>
__________________
Chaslie


68 Classifieds Important Links
Customer Area | Issue Tracker | User Manuals & Documentation

HTML Help
W3 Schools
Chaslie is offline   Reply With Quote
Old 03-29-2006, 10:53 PM   #5
Staff
 
Join Date: Mar 2006
Location: New Jersey
Posts: 2,201
Rep Power: 71
John Snyder is a jewel in the rough
Default

Quote:
Originally Posted by Chaslie
I have the below code inserted into my /templates/default/layout.tpl.php file for the 'date' and 'total number of listings':

Code:
{$smarty.now|date_format:"%A, %e %B, %Y"}<br>and there are
    {total_listings} <a href="toplistings.php?pg=new">entries</a>
That doesn't work on mysite. Where/How did you come by this bit of code. I don't have that function in the plugins directory. Can you post it here?

should be includes/templates/plugins/functions.total_listings.php or something.
__________________
John
68C Staff

68C Downloads | Report a Bug | Knowledge Base
If you have a current support subscription, you can Submit a Support Ticket
John Snyder is offline   Reply With Quote
Old 03-29-2006, 10:57 PM   #6
Moderator
 
Chaslie's Avatar
 
Join Date: Mar 2006
Location: Great Ocean Road - Australia
Posts: 723
Rep Power: 38
Chaslie will become famous soon enough
Default

With my compliments, John.

includes/templates/plugins/functions.total_listings.php

Code:
{
    global $db;
    
    //get total active listings
    $sSQL="SELECT COUNT(*) AS total FROM ".PREFIX."products WHERE expiration > NOW() AND display = 'Y'";
    $result=$db->query($sSQL);
    $rs=$result->fetch();
    $total_listings=$rs['total'];

    return $total_listings;
}
It's been a busy day, eh?
__________________
Chaslie


68 Classifieds Important Links
Customer Area | Issue Tracker | User Manuals & Documentation

HTML Help
W3 Schools
Chaslie is offline   Reply With Quote
Old 03-29-2006, 11:07 PM   #7
Staff
 
Join Date: Mar 2006
Location: New Jersey
Posts: 2,201
Rep Power: 71
John Snyder is a jewel in the rough
Default

Ya, not too busy though.

What's the function line look like? I am not getting any numbers.
__________________
John
68C Staff

68C Downloads | Report a Bug | Knowledge Base
If you have a current support subscription, you can Submit a Support Ticket
John Snyder is offline   Reply With Quote
Old 03-29-2006, 11:15 PM   #8
Moderator
 
Chaslie's Avatar
 
Join Date: Mar 2006
Location: Great Ocean Road - Australia
Posts: 723
Rep Power: 38
Chaslie will become famous soon enough
Default

Ooops - sorry John.

Code:
function smarty_function_total_listings($params, &$smarty)
__________________
Chaslie


68 Classifieds Important Links
Customer Area | Issue Tracker | User Manuals & Documentation

HTML Help
W3 Schools
Chaslie is offline   Reply With Quote
Old 03-29-2006, 11:21 PM   #9
Staff
 
Join Date: Mar 2006
Location: New Jersey
Posts: 2,201
Rep Power: 71
John Snyder is a jewel in the rough
Default

I'll have to kick myself in the but on that one, have been looking at the screen too long or its getting too late.

For some reason I couldn't see the difference between:

function smarty_function_total_listings($params, &$smarty)

and

function total_listings($params, &$smarty)

Ok, I'll do the same with users and post both plugins for anyone to upload.
__________________
John
68C Staff

68C Downloads | Report a Bug | Knowledge Base
If you have a current support subscription, you can Submit a Support Ticket
John Snyder is offline   Reply With Quote
Old 03-29-2006, 11:44 PM   #10
Staff
 
Join Date: Mar 2006
Location: New Jersey
Posts: 2,201
Rep Power: 71
John Snyder is a jewel in the rough
Default

Ok,

All you do is upload the files and then open templates/default/layout.tpl.php and make the proper call to the function where you want the numbers displayed.

Something like this (layout.tpl.php):

Total Users = {total_users}, Total Ads = {total_listings}

Here are the files:

total_users.zip
total_listings.zip
__________________
John
68C Staff

68C Downloads | Report a Bug | Knowledge Base
If you have a current support subscription, you can Submit a Support Ticket
John Snyder is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
What are members charging for ads? AzHousePro Site Marketing 6 10-05-2006 02:27 PM


All times are GMT -4. The time now is 06:43 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0