 | |  | | | Photopost Pro How Do I...? Wondering how to do things in PhotoPost? |
September 4th, 2005, 10:48 AM
|
#1 (permalink)
| | Registered User
Join Date: Dec 2004
Posts: 42
| Most popular photos time limit
is there a way to make most popular photos time sensitive. i mean making them something like "this months most popular photos" or 'this week's..."
thanks
|
| |
September 4th, 2005, 12:18 PM
|
#2 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
You would need to alter the query in pp-inc.php for function display_gallery and add a time restriction to the query to only pull photos from last month or last week etc.
How many photos you trying to display
|
| |
September 4th, 2005, 01:37 PM
|
#3 (permalink)
| | Registered User
Join Date: Dec 2004
Posts: 42
|
my recent and random photos are at 20 and i think the most popularphotos have to be the same because i cannot change the settings individually. the site is www.digitalpick.com and currently i have disabled the most popular photo feature.
the most important part of this question is how i can modify the pp-inc.php to add time function for most popular photos without affecting anything els. could you tell me how, i am not very familiar with coding or php.
|
| |
September 4th, 2005, 08:22 PM
|
#4 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
well in the display_gallery function in pp-inc.php find the query for most_views and you would add something like this to the query
AND date > UNIX_TIMESTAMP( DATE_SUB(NOW(), INTERVAL 14 DAY) )
|
| |
September 4th, 2005, 11:41 PM
|
#5 (permalink)
| | Registered User
Join Date: Dec 2004
Posts: 42
|
i added the above code in and i get an error.
this is how i added it:
case "most_views":
if ( !isset($cat) || empty($catquery) ) {
$group_title = "{$Globals['pp_lang']['popular']}";
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,views,height,width FROM {$Globals['pp_db_prefix']}photos WHERE approved='1' AND storecat='0' ORDER BY views DESC LIMIT $grabnum" AND date > UNIX_TIMESTAMP( DATE_SUB(NOW(), INTERVAL 14 DAY) );
i get the following error:
Parse error: parse error, unexpected T_LNUMBER in ..............
thanks
|
| |
September 5th, 2005, 10:44 AM
|
#6 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
Yeah where is the closing " see how you did not move that. The query has to end with ";
You put the new string in between the ";
|
| |
September 5th, 2005, 12:46 PM
|
#7 (permalink)
| | Registered User
Join Date: Dec 2004
Posts: 42
|
thank you, i got that fixed but now i get another error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/......./pp-inc.php on line 600
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/......./pp-inc.php on line 605
this is line 600:
$numimages = mysql_num_rows( $result );
this is line 605:
while ( list($fid, $fuser, $fuserid, $thiscat, $storecat, $ftitle, $fbigimage, $fviews, $fheight, $fwidth, $) = mysql_fetch_array($result) ) {
|
| |
September 5th, 2005, 12:47 PM
|
#8 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
try p.date in the query not date
|
| |
September 5th, 2005, 01:32 PM
|
#9 (permalink)
| | Registered User
Join Date: Dec 2004
Posts: 42
|
i changed but it doesn't work.
|
| |
September 5th, 2005, 01:58 PM
|
#10 (permalink)
| | Photopost Developer Verified Customer
Join Date: Jun 2002 Location: Abingdon,MD
Posts: 71,941
|
Okay well I am just giving you ideas here we dont support code hacking. Try this as this is what I told you to do.
$query = "SELECT id,user,userid,cat,storecat,title,bigimage,views,height,width FROM {$Globals['pp_db_prefix']}photos WHERE approved='1' AND storecat='0' AND date > UNIX_TIMESTAMP( DATE_SUB(NOW(), INTERVAL 14 DAY) ) ORDER BY views DESC LIMIT $grabnum";
|
| |
September 5th, 2005, 02:51 PM
|
#11 (permalink)
| | Registered User
Join Date: Dec 2004
Posts: 42
|
I want to thank you, that did it. Maybe you should consider adding time feature on next updates. The reason i started this is because some viewers complained that the same pictures show on the most viewed page. Now, at least it changes every so often. Once again thanks a lot.
|
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Rate This Thread | Linear Mode | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -5. The time now is 10:58 AM. | |