Recent Entries Sidebar

Creating and modifying plugins.
diroddi
Regular
Posts: 21
Joined: Sun Jun 10, 2007 11:59 pm

Recent Entries Sidebar

Post by diroddi »

Hello -

I would like to have the Recent Entries Sidebar plugin display entries regardless of their category when landing on the front page, but after navigating to a specific entry, display only entries for the category of the entry being viewed.

It appears that part of this can be accomplished with 'Parent Category' when configuring the plugin, although it only displays entries when the category is selected. When selecting a specific entry or landing on the front page nothing is displayed in recent entries.

Thanks
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Recent Entries Sidebar

Post by Don Chambers »

Try this (untested)...

Install the plugin, and configure to show all categories, and for "when to show", select "overview page only".

Install the plugin a SECOND time in the same sidebar (left or right).... This time, select "parent category" and for when, select "extended entry only".
=Don=
diroddi
Regular
Posts: 21
Joined: Sun Jun 10, 2007 11:59 pm

Re: Recent Entries Sidebar

Post by diroddi »

Thanks for the suggestion. Unfortunately no luck. The first install of the plugin works as expected and shows on the overview page only and then disappears when selecting an entry or category. The second install appears as expected but doesn't show any entries.

Any other ideas?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Recent Entries Sidebar

Post by garvinhicking »

Hi!

Don's idea was quite good already, but by default when you view a single blog entry, the "category" does not get set as the current category.

I believe for that to happen, you need to install the categorytemplates ("Extended options/templates for Categories") event plugin, which allows you to forcibly set the categoryID to that of the currently shown entry, which would then make sure that the sidebar plugin knows what the "current category" is...

HOWEVER.

I just patched the recententries plugin to make "Current category" also understand the ID of a single entry and fetch the proper ID.

You can get the updated plugin PHP file here:

http://svn.berlios.de/viewcvs/*checkout ... ision=2641

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Recent Entries Sidebar

Post by Don Chambers »

Garvin - does your recent patch require the categorytemplates plugin?
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Recent Entries Sidebar

Post by garvinhicking »

Hi!
Don Chambers wrote:Garvin - does your recent patch require the categorytemplates plugin?
Nope, it does not have that dependency.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Recent Entries Sidebar

Post by Don Chambers »

garvinhicking wrote:Nope, it does not have that dependency.
Cool - any chance of adding that same functionality to the HTML nugget plugin?
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Recent Entries Sidebar

Post by garvinhicking »

Hi Don!
Don Chambers wrote:
garvinhicking wrote:Nope, it does not have that dependency.
Cool - any chance of adding that same functionality to the HTML nugget plugin?

Uhm...what I patched was which category source the recent entries plugin pulls its data from. How can that be applied to the HTML nugget plugin?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: Recent Entries Sidebar

Post by Don Chambers »

I think I misunderstood your patch when I initially read your message. Nevermind! :lol: :lol:
=Don=
diroddi
Regular
Posts: 21
Joined: Sun Jun 10, 2007 11:59 pm

Re: Recent Entries Sidebar

Post by diroddi »

Hi!

Thank you for your time, I appreciate your help. Sorry for the delay in getting back to test this.

The changes you made work as expected and show recent entries of the parent category when viewing a specific entry, although does not display any entries when selecting a category. In addition, the first install of the plugin that is set to show 'all' categories on the overview page does not show any entries.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Recent Entries Sidebar

Post by garvinhicking »

Hi!

Do you have an URL where to see that?

You could edit the seredipity_plugin_recentries.php file and search for this line around line 159:

Code: Select all

        if ($category != 'none' && !empty($category)) {
and change that to:

Code: Select all

echo "Showing entries for category: " . print_r($category, true) . "<br />\n";
        if ($category != 'none' && !empty($category)) {
And then check what the plugin outputs; I assume that the contents might not be correct?!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
diroddi
Regular
Posts: 21
Joined: Sun Jun 10, 2007 11:59 pm

Re: Recent Entries Sidebar

Post by diroddi »

Hi

I just sent a PM to a QA test environment URL.

I did as you suggested and it shows 'none' when landing on the overview page or navigating to a category. When navigating to a specific entry it shows the category id.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Recent Entries Sidebar

Post by garvinhicking »

Hi!

Hm, "none" should only actually appear when in the plugin configuration you set the dropdown to "no category", so that seems about right. What other configuration options did you set for the plugin?

Maybe you can also edit the file again, and after

Code: Select all

$entries = serendipity_db_query($entries_query);
add:

Code: Select all

echo "Query: " . $entries_query . "<br />\n";
print_r($entries);
That should give me a clue what the query contains to see why it does not return any entries.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
diroddi
Regular
Posts: 21
Joined: Sun Jun 10, 2007 11:59 pm

Re: Recent Entries Sidebar

Post by diroddi »

Hi

I added the code snippet. MySQL returns: Not unique table/alias: 'ec'

Configuration for the 1st install of the plugin:
Title: Plugin 1-All
Number of entries: 5
Skip front page entries: Show all
Dateformatting: %A, %B %e %Y
Category: All categories
Show Random Articles: No
Where should the item be displayed: Overview page only

Configuration for the 2nd install of the plugin:
Title: Plugin 2-Category
Number of entries: 5
Skip front page entries: Show all
Dateformatting: %A, %B %e %Y
Category: Parent category
Show Random Articles: No
Where should the item be displayed: Extended entry only
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Recent Entries Sidebar

Post by garvinhicking »

Hi!

That's only one part, the SQL query itself should also show up?!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply