The Serendipity Handbook

You can now read the (german) handbook here: PDF - https://github.com/s9y/Book (LaTeX source).

Forum-Information

Before posting about errors, make sure that the answer cannot already be found in our FAQ or by searching this forum!
Posting is restricted to registered users (registering is free and simple!) due to recent spam attacks. When having trouble with this board, contact garvin(-at)s9y(-dot)org.

Board index Plugins Recent Entries Sidebar

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

Postby diroddi » Tue Mar 02, 2010 6:00 pm

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

User avatar
Don Chambers
Regular
 
Posts: 3077
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Tue Mar 02, 2010 8:43 pm

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".

diroddi
Regular
 
Posts: 21
Joined: Sun Jun 10, 2007 11:59 pm

Postby diroddi » Wed Mar 03, 2010 6:14 am

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?

User avatar
garvinhicking
Core Developer
 
Posts: 28944
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Wed Mar 03, 2010 12:47 pm

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/

User avatar
Don Chambers
Regular
 
Posts: 3077
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Wed Mar 03, 2010 9:22 pm

Garvin - does your recent patch require the categorytemplates plugin?

User avatar
garvinhicking
Core Developer
 
Posts: 28944
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Thu Mar 04, 2010 2:35 pm

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/

User avatar
Don Chambers
Regular
 
Posts: 3077
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Thu Mar 04, 2010 3:58 pm

garvinhicking wrote:Nope, it does not have that dependency.


Cool - any chance of adding that same functionality to the HTML nugget plugin?

User avatar
garvinhicking
Core Developer
 
Posts: 28944
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Mon Mar 08, 2010 12:47 pm

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/

User avatar
Don Chambers
Regular
 
Posts: 3077
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA

Postby Don Chambers » Mon Mar 08, 2010 4:14 pm

I think I misunderstood your patch when I initially read your message. Nevermind! :lol: :lol:

diroddi
Regular
 
Posts: 21
Joined: Sun Jun 10, 2007 11:59 pm

Postby diroddi » Tue Mar 09, 2010 5:02 pm

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.

User avatar
garvinhicking
Core Developer
 
Posts: 28944
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Wed Mar 10, 2010 4:23 pm

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

Postby diroddi » Wed Mar 10, 2010 8:09 pm

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.

User avatar
garvinhicking
Core Developer
 
Posts: 28944
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Thu Mar 11, 2010 11:27 am

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

Postby diroddi » Fri Mar 12, 2010 4:11 pm

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

User avatar
garvinhicking
Core Developer
 
Posts: 28944
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany

Postby garvinhicking » Fri Mar 12, 2010 10:46 pm

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/

Next


Return to Plugins

Who is online

Users browsing this forum: No registered users and 2 guests

cron