How do i change the default sort order on my pages

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 02-19-2010, 12:48 AM
oobie11's Avatar
Constant Pligger
Pligg Version: 1.0
Pligg Template: Custom, wistie
 
Join Date: Apr 2009
Location: Monterey, CA
Posts: 148
Currently my site has the default sort order of "Recently Popular" when someone first comes to my site. I want it to default at "Top Today". How do I do this?

I tried searching for a solution, but everything I found seems to be for an older version of pligg. I have version 1.0.3b using URL Method 2. I have tried to edit the index.php file by finding and replacing

Quote:
if(isset($_GET['part'])){$search->setmek = $db->escape($_GET['part']);}
with

Quote:
if(isset($_GET['part'])){
$search->setmek = $db->escape($_GET['part']);
}else{
$search->setmek = "today";
}
but it didn't work.
I also tried changing
Quote:
RewriteRule ^published/?$ index.php
in .htaccess to
Quote:
RewriteRule ^published/?$ index.php?part=today
but I was unable to find "RewriteRule ^published/?$ index.php" to change it.
I tried changing
Quote:
RewriteRule ^/?$ index.php
to
Quote:
RewriteRule ^/?$ index.php?part=today
but that makes my categories not work.
Please help. Thank You.
Reply With Quote
  #2 (permalink)  
Old 02-19-2010, 08:27 PM
oobie11's Avatar
Constant Pligger
Pligg Version: 1.0
Pligg Template: Custom, wistie
 
Join Date: Apr 2009
Location: Monterey, CA
Posts: 148
I figured it out. Heres what to do if you want to do something similar.
Open index.php and find the line
Quote:
$search->filterToStatus = "published";
add below this
Quote:
$search->filterToTimeFrame = "today";
$search->orderBy = "link_votes DESC";
This makes it so when someone comes to your site, it will default sort to Today and list the stories from most votes down.
Reply With Quote
  #3 (permalink)  
Old 02-19-2010, 09:00 PM
chuckroast's Avatar
Pligg Developer/Coder/Designer
Pligg Version: SVN
Pligg Template: Social Pro Kit
 
Join Date: Jun 2006
Posts: 5,448
oobie11
Thanks for sharing your experiences and solutions with the community.
Reply With Quote
  #4 (permalink)  
Old 02-20-2010, 06:15 AM
oobie11's Avatar
Constant Pligger
Pligg Version: 1.0
Pligg Template: Custom, wistie
 
Join Date: Apr 2009
Location: Monterey, CA
Posts: 148
Another thing you may want to do if you still have the sort options on your site is
Open sidebar2.tpl and find this
Quote:
<div id="navcontainer">
<ul id="navlist">
{if $setmeka eq "" || $setmeka eq "recent"}<li id="active"><a id="current" href="{$index_url_recent}"><span class="active">{#PLIGG_Visual_Recently_Pop#}</span></a>{else}<li><a href="{$index_url_recent}">{#PLIGG_Visual_Recently _Pop#}</a>{/if}</li>
{if $setmeka eq "today"}<li id="active" href="{$index_url_today}"><a href="{$index_url_today}" id="current"><span class="active">{#PLIGG_Visual_Top_Today#}</span></a>{else}<li><a href="{$index_url_today}">{#PLIGG_Visual_Top_Today #}</a>{/if}</li>
{if $setmeka eq "yesterday"}<li id="active"><a id="current" href="{$index_url_yesterday}"><span class="active">{#PLIGG_Visual_Yesterday#}</span></a>{else}<li><a href="{$index_url_yesterday}">{#PLIGG_Visual_Yeste rday#}</a>{/if}</li>
{if $setmeka eq "week"}<li id="active"><a id="current" href="{$index_url_week}"><span class="active">{#PLIGG_Visual_This_Week#}</span></a>{else}<li><a href="{$index_url_week}">{#PLIGG_Visual_This_Week# }</a>{/if}</li>
{if $setmeka eq "month"}<li id="active"><a id="current" href="{$index_url_month}"><span class="active">{#PLIGG_Visual_This_Month#}</span></a>{else}<li><a href="{$index_url_month}">{#PLIGG_Visual_This_Mont h#}</a>{/if}</li>
{if $setmeka eq "year"}<li id="active"><a id="current" href="{$index_url_year}"><span class="active">{#PLIGG_Visual_This_Year#}</span></a>{else}<li><a href="{$index_url_year}">{#PLIGG_Visual_This_Year# }</a>{/if}</li>
</ul>
</div>
then you want to take this line (from the top most {if} )
Quote:
$setmeka eq "" ||
and put it infront of the
Quote:
$setmeka eq "today"
(the next {if} down)

this will make it so when someone goes to your site, the "current" sort order will be selected to top today.
Reply With Quote
  #5 (permalink)  
Old 03-19-2010, 10:45 AM
New Pligger
Pligg Version: 1.0.3
 
Join Date: Jan 2010
Posts: 10
How about making it possible to change this from within the admin area?
Reply With Quote
  #6 (permalink)  
Old 09-13-2010, 11:17 PM
New Pligger
Pligg Version: 1.1.1
 
Join Date: Aug 2010
Posts: 27
oobie11, thanks very much for this. You've helped me a lot, but one problem remains!

I am trying to have "month" as the default sort order, and using your method worked for that:

Code:
// since this is index, we only want to view "published" stories
$search->filterToStatus = "published";
$search->filterToTimeFrame = "month";
$search->orderBy = "link_votes DESC";
Next, I changed the following in pligg.tpl:

Code:
{if $setmeka eq "recent"}<li id="active"><a id="current" href="{$index_url_recent}"><span class="active">{#PLIGG_Visual_Recently_Pop#}</span></a>{else}<li><a href="{$index_url_recent}">{#PLIGG_Visual_Recently_Pop#}</a>{/if}</li>

{if $setmeka eq "today"}<li id="active" href="{$index_url_today}"><a href="{$index_url_today}" id="current"><span class="active">{#PLIGG_Visual_Top_Today#}</span></a>{else}<li><a href="{$index_url_today}">{#PLIGG_Visual_Top_Today#}</a>{/if}</li>

{if $setmeka eq "yesterday"}<li id="active"><a id="current" href="{$index_url_yesterday}"><span class="active">{#PLIGG_Visual_Yesterday#}</span></a>{else}<li><a href="{$index_url_yesterday}">{#PLIGG_Visual_Yesterday#}</a>{/if}</li>

{if $setmeka eq "week"}<li id="active"><a id="current" href="{$index_url_week}"><span class="active">{#PLIGG_Visual_This_Week#}</span></a>{else}<li><a href="{$index_url_week}">{#PLIGG_Visual_This_Week#}</a>{/if}</li>

{if $setmeka eq "" || $setmeka eq "month"}<li id="active"><a id="current" href="{$index_url_month}"><span class="active">{#PLIGG_Visual_This_Month#}</span></a>{else}<li><a href="{$index_url_month}">{#PLIGG_Visual_This_Month#}</a>{/if}</li>

{if $setmeka eq "year"}<li id="active"><a id="current" href="{$index_url_year}"><span class="active">{#PLIGG_Visual_This_Year#}</span></a>{else}<li><a href="{$index_url_year}">{#PLIGG_Visual_This_Year#}</a>{/if}</li>

{if $setmeka eq "alltime"}<li id="active"><a id="current" href="{$index_url_alltime}"><span class="active">{#PLIGG_Visual_This_All#}</span></a>{else}<li><a href="{$index_url_alltime}">{#PLIGG_Visual_This_All#}</a>{/if}</li>
And everything seems to work now except for one thing. I can't sort by "recent" any longer.

If I enter http://mypliggsite.com/recent/ into the browser, it just redirects to http://mypliggsite.com/ and continues to sort by "month" - so somehow the ability to sort by "recent" has been completely removed.

Ideas?
Reply With Quote
  #7 (permalink)  
Old 09-13-2010, 11:30 PM
New Pligger
Pligg Version: 1.1.1
 
Join Date: Aug 2010
Posts: 27
Even if I change the line to read:

Code:
{if $setmeka eq "recent"}<li id="active"><a id="current" href="/recent/"><span class="active">{#PLIGG_Visual_Recently_Pop#}</span></a>{else}<li><a href="/recent/">{#PLIGG_Visual_Recently_Pop#}</a>{/if}</li>
replacing href="{$index_url_recent}" with href="/recent/" the script still redirects to index.php and sorts by month. So I guess it's a matter of figuring out how to make it so $index_url_recent does not redirect to index.php (I am not a programmer, obviously, so excuse my newbish logic here).

...will keep looking.
Reply With Quote
  #8 (permalink)  
Old 09-14-2010, 01:03 AM
New Pligger
Pligg Version: 1.1.1
 
Join Date: Aug 2010
Posts: 27
Well, I found index_url_recent in libs\smartyvariables.php, but editing that file seems to make no difference.

I changed
Code:
$main_smarty->assign('index_url_recent', getmyurl('maincategory', $pligg_category));
to
Code:
$main_smarty->assign('index_url_recent', getmyurl('index_sort', 'recent', $pligg_category));
and changed
Code:
$main_smarty->assign('index_url_recent', getmyurl('index'));
to
Code:
$main_smarty->assign('index_url_recent', getmyurl('index_sort', 'recent'));
but there is no change.

I am at a loss!

Ideas anyone?
Reply With Quote
  #9 (permalink)  
Old 09-19-2010, 11:46 AM
New Pligger
Pligg Version: 1.1.1
 
Join Date: Aug 2010
Posts: 27
I find it hard to believe that this issue hasn't ever been addressed by the developers!

IMO sort order functionality is probably one of the most important features in a Pligg site, no?

Help!
Reply With Quote
  #10 (permalink)  
Old 09-19-2010, 01:45 PM
chuckroast's Avatar
Pligg Developer/Coder/Designer
Pligg Version: SVN
Pligg Template: Social Pro Kit
 
Join Date: Jun 2006
Posts: 5,448
Quote:
Originally Posted by share View Post
I find it hard to believe that this issue hasn't ever been addressed by the developers!

IMO sort order functionality is probably one of the most important features in a Pligg site, no?

Help!
Pligg already has sorting.
I find it hard to believe that you think the development staff are here to provide you with personal customizations. Maybe it's time for you to actually read the forum rules.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change default sort order of the stories on frontpage? Andtony Questions and Comments 14 03-18-2011 06:01 AM
Sort by, Sort group by - How to change the default? kleinhev Questions and Comments 0 11-18-2009 11:41 AM
After Install Pligg 1.0.0 Pligg_Users Table Doesn' t Exist airweb Questions and Comments 2 07-21-2009 03:59 AM
Installation - Tables never created julientarta Questions and Comments 30 03-23-2009 08:41 PM
9.6 error xbizsky Questions and Comments 28 07-04-2007 04:54 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development