|
|
#1 |
|
Junior Member
Join Date: May 2007
Location: Charlotte, NC
Posts: 11
Rep Power: 9 ![]() |
I'm having a problem that I have seen discussed here before, but the solution is not working for me. I would like to limit the number of displays when people click on �New Listijngs�. It currently shows ALL Listings. Can someone help me limit this?
V3.1.7 Designer Default template Below is the code I am using. The [$number=4] should limit my displays to 4. However, all �new� listings are being displayed. (Note: I have even changed the 4 to �4� but that didn�t solve my problem. Any help would be much appreciated! <?php /** * smarty_function_new_listings * * This function is useful for generating a vertical table of new listings. * * All source code & content (c) Copyright 2006, 68 Classifieds * unless specifically noted otherwise. * * @package 68classifieds * @author Eric Barnes * @copyright 68 Classifieds * @link http://www.68classifieds.com * @$Revision: 1.3 $ * @Updated: $Date: 2006/05/26 13:14:08 $ */ function smarty_function_new_listings($params, &$smarty) { global $db; $table_attr = 'border="1"'; $tr_attr = ''; $td_attr = ''; $number=4; $trailpad = ' '; $img_break = '<br />'; $date_format = '%B %e, %Y %I:%M %p'; foreach ($params as $_key=>$_value) { switch ($_key) { case 'number': $$_key = (int)$_value; break; case 'table_attr': case 'img_break': case 'date_format': $$_key = (string)$_value; break; case 'tr_attr': case 'td_attr': $$_key = $_value; break; } } $sSQL="SELECT p.id, p.owner, p.title, p.featured, p.section, p.description, p.price, p.dateadded, p.expiration, p.pHighlighted, p.pBold, u.state, u.city, u.country FROM ".PREFIX."products AS p LEFT JOIN ".PREFIX."users AS u ON p.owner = u.id WHERE p.expiration > NOW() AND p.display = 'Y' ORDER BY p.dateadded DESC LIMIT ".$number; $result=$db->query($sSQL); $i=0; while($row=$result->fetch())
|
|
|
|
|
|
#2 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110 ![]() |
When you are calling this function can you make sure you do not have a number associated with it or it is also number=4?
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
#3 |
|
Moderator
Join Date: Mar 2006
Posts: 4,114
Rep Power: 100 ![]() ![]() |
You may also want to try and delete the contents of /templates_c
__________________
Larry. (Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free) Set your site apart from the competition with one of my modules...... Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module 68 Classifieds Important Links Customer Area | Issue Tracker | Knowledge Base | User Manuals |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Jun 2006
Posts: 172
Rep Power: 15 ![]() |
NOW:
Code:
ORDER BY p.dateadded DESC LIMIT ".$number; Code:
ORDER BY p.dateadded DESC LIMIT ".$number."";
__________________
Greg 3.1.4 Designer Last edited by gregbatch; 05-11-2007 at 04:53 PM. Reason: additional notes |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: May 2007
Location: Charlotte, NC
Posts: 11
Rep Power: 9 ![]() |
Thanks for all of your help, but none of these changes worked for me. In fact, I'm really confused. Being an old "tester of programming code" I deleted the "function.new_listings" file just to see what would happen. We'll the program still displayed ALL of the New Listings EVEN without the "function.new_listings" file being there. Why wouldn't I get an error when I attempt to produce the New Listings if the file was gone? Could the program be pulling information from a different file besides the "function.new_listings"? That would explain why none of my changes seem to be working. I'm using the Developer version of the program so I can't access the "toplistings.php" page to see what is going on. Guess I'll be up late tonight trying to figure this out. Any ideas?
|
|
|
|
|
|
#6 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110 ![]() |
From that last response I think you are looking in the wrong place. The smarty function is only used by placing code in the template file. For example:
Code:
{new_listings number=4}
Here is the actual limit clause: PHP Code:
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: May 2007
Location: Charlotte, NC
Posts: 11
Rep Power: 9 ![]() |
Sounds like we're heading in the right direction! But, when I open "toplistings.php" in the root directory" I see what looks like scrambled data:
(example of what I see, 4+oV5CfIvrml3ToJ8f5oV/0Dzu//XX ZhDyAlqOQiGIAA8SJmvvAqGH68eZh6180XcWEeiKOHncQH 6ZZlF+x9PlwF7CPINyOaXaaqcaZ/IniQ/qZqQh13bywZGSU P4NTojtuEHLVXdAe9UN+xed4zDPbEnudB4xVzv6fDYvvjQno EuSlcwwBss4zZSo0p5lGIMG/+U4ZU/UFTEF/HLC55QGyVbu wJRuV+e6+CBIikTxj69j+8y/FlQH+qFtC8/X2VJf0S7yXgg EfsIaraXVmhJCPZyyvmVB6O1Fz9FRzhFweVa/huc sK2Ry4D+IlgW08o7) I naturally assumed this is because I have the Designer version of the program and many of the PHP files have been protected. Or, am I looking in the wrong place or have a done something else wrong? |
|
|
|
|
|
#8 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110 ![]() |
Yes with the Designer edition that file is encoded. The only work arounds that I can think of are to either purchase the Developer edition or some how use the external.php file with an rss parser to display x amount of new listings.
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: May 2007
Location: Charlotte, NC
Posts: 11
Rep Power: 9 ![]() |
Thanks for your help. I was thinking about getting the Developers version at some point anyway.
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Limit number of ads by usergroups? | z0rg | v3.1 Questions & Support | 2 | 11-28-2006 09:39 AM |