Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

[SOLVED]Pull latest blog post except the one that is currently viewed. Please Help.


Go to End


18 Posts   5680 Views

Avatar
dhensby

Community Member, 253 Posts

13 February 2013 at 10:00pm

Edited: 13/02/2013 10:24pm

Hi Juan,

This sounds like something to do with versioning.

There may not be an entry in BlogEntry_Live with ID 739, but that is because the IDs of the *_Live tables aren't 1-1 with the IDs in the draft tables. Instead, RecordID is used in the *_Live tables.

Versioning should take care of this for you with your DO::get() queries, so, is the blog post you're trying to filter published?

If it isn't, publish it or view the site as draft mode.

If it is, then try BlogEntry.RecordID != xxx

If that still isn't working, make sure your site is in 'dev' mode, then add a 'die;' imediately after the DO::get() that isn't working and add '?showqueries' to the end of the url, this will print out all the SQL queries that are run. Then copy the LAST query on the page, save it into a txt file and upload it as an attachment with the next post you leave here.

Dan

Avatar
Juan

Community Member, 18 Posts

14 February 2013 at 3:52pm

now its working..

what i did is i concatenate the ID into the URL. $link?blogid=$ID

return FeedAggregator::posts_by_sport($sportHolder,10, $_GET['blogid']);

and using this query

$posts = DataObject::get('BlogEntry','ParentID IN('.$idList.') AND "BlogEntry".ID != '. (int) $postID,'Date DESC','',$limit);

thank you guys!

Go to Top