1776 Posts in 498 Topics by 533 members
Blog Module
SilverStripe Forums » Blog Module » order blog by sort not by date
Discuss the Blog Module.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1252 Views |
-
order blog by sort not by date

7 October 2010 at 11:50am
/blog/code/BlogEntry.php
// By specifying a callback, you can alter the SQL, or sort on something other than date.
if($retrieveCallback) return call_user_func($retrieveCallback, 'BlogEntry', $filter, $limit, $order);How do you specify?
Thanks!
C.b -
Re: order blog by sort not by date

7 October 2010 at 5:23pm
Hi prawnstar,
Which version of blog are you using?
This is in BlogTree class now tag 0.4.1.
What it does is calling a function that you define in order to get blog entries sorted by a different criteria.
hope it helps.
cheers
-
Re: order blog by sort not by date

8 October 2010 at 4:54am
Thanks Carlos!
I was using 0.4.0, but I'm downloading 0.4.1 now.
C.b
-
Re: order blog by sort not by date

8 October 2010 at 5:37am
Hi Carlos,
I downloaded 0.4.1 but still don't see a way to change this behavior without changing the function inside the /blog/code/BlogTree.php file. Is there no way to change this without hacking the script?
I'm extending the BlogHolder class. Can it be overridden there?
Thanks!
Chris.b -
Re: order blog by sort not by date

8 October 2010 at 2:32pm Last edited: 8 October 2010 2:33pm
hi prawnstar,
you can do this
class MyClass extends Page {
function MyFunc(){
// return entries sorted by something....
}
}then in your code (where you want to return the entries something like this:
$blog = DataObject::get_one('BlogHolder');
$entries = $blog->Entries('','','',array('MyClass','MyFunc'),'');
In this way you can create your own function and return entries sorted by whatever you want without change the core code.
Hope it helps
cheers
Carlos
| 1252 Views | ||
|
Page:
1
|
Go to Top |


