Show Entries Plugin

Creating and modifying plugins.
azel
Regular
Posts: 265
Joined: Thu Apr 21, 2005 4:28 am
Contact:

Show Entries Plugin

Post by azel »

Okay....I need help. I'm trying to get this plugin to work, but apparently my settings are wrong.

I set up a new category to post entries to this category only in the sidebar. What exactly am I supposed to put for the category ID - the number itself? The number plus the title of the category? I've tried this both ways, but I can't get anything to post under my sidebar, which is entitled "Mini Blog". It posts to the main content with nothing showing under Mini Blog.

Can someone help me out? I feel stupid that I can't get stuff to work on Serendipity these days.

Thanks in advance.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Show Entries Plugin

Post by garvinhicking »

Hi!

You need to enter the categoryid there; you can get that ID when you hover about the category name in the "Manage Categories" section!

HTH,
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/
azel
Regular
Posts: 265
Joined: Thu Apr 21, 2005 4:28 am
Contact:

Post by azel »

>_< But is the category ID just the number itself? Can you give me an example?

Here is a screenshot of my settings: http://aetheric-shade.org/images/settings.jpg

There I've tried posting under Mini Blog. It doesn't work. The entry shows up on the main page and not on my sidebar. http://aetheric-shade.org

Thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Yes, the number itself is right.

It seems that either the template file is not parsed, or that the fetchEntries function is failing. Maybe you could just try to edit the plugin_showentries.tpl file from the plugin and add some HTML at the top of the file, just to see if that is then shown in your sidebar.

If it is not shown, the plugin cannot parse your template file because it might not have read permission.

If that HTML is shown it just means that the fetchEntries() function itself is failing; in this case could you please open your serendipity_plugin_showentries.php file and search this:

Code: Select all

        $entries     = serendipity_fetchEntries(null, true, $limit, false, false, 'timestamp DESC', '', false, true);
After that line, add this:

Code: Select all

print_r($entries);
And then we'll see furhter. :)

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/
azel
Regular
Posts: 265
Joined: Thu Apr 21, 2005 4:28 am
Contact:

Post by azel »

Thanks Garvin!

Here goes:

I tried adding HTML into my showentries.tpl file, but there was no HTML output under my MiniBlog sidebar.

I CHMODed my permissions to 766 on the plugin folder itself and the showentries TPL/PHP also.

Oops! I'm running Serendipity 1.0-beta2 and using version 1.4 of the Show Entries Plugin.

I guess it just doesn't like me. ^^;;
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Did you add that "print_r" code like I suggested? Which output does it produce?

Maybe you could add a

Code: Select all

echo "Fetch Result:<br />";
before the print_r and see if that is outputted?

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/
azel
Regular
Posts: 265
Joined: Thu Apr 21, 2005 4:28 am
Contact:

Post by azel »

The print_r code produces this under the sidebar:

Fetch Result:
1

Thanks!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Oh, that's quite un-good.

Please edit your include/functions_entries.inc.php function and locate the serendipity_fetchEntries() function.

There you see this code (or something similar):

Code: Select all

   $ret = serendipity_db_query($query, $fetch_single, 'assoc');
alter that to:

Code: Select all

   $ret = serendipity_db_query($query, $fetch_single, 'assoc');
   echo "Q: $query<br />\n";
This should show you the SQL code used to fetch the entry listing in the sidebar (also for the main entries, but discard that output). With that SQL we should find why the query is failing (you might want to execute the SQL code in something like phpMyAdmin and see if it yields an error)

Best 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/
azel
Regular
Posts: 265
Joined: Thu Apr 21, 2005 4:28 am
Contact:

Post by azel »

Well hrm....added that code to my functions_entries_inc.php, but without result when I post a new entry to the specified category.

As to querying the code on phpMyAdmin, here is the result:

MySQL said:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$ret = serendipity_db_query($query, $fetch_single, 'assoc')' at line 1

Maybe my server doesn't like this plugin? I'm using Dreamhost, which is an excellent, excellent host. Never had any problems out of them.

This is frustrating.. Thanks for being patient and trying to help me, Garvin!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

No, not the code I pasted should be tried in phpMyAdmin; you should see that "Q: SELECT ..." output on the Frontend of your blog! Not when posting an entry, but when viewing your entries on the frontpage! That must show up if you saved my code in the page; else no entries would show up at all on your blog!

What's your URL? It should not have to do anything with your server...

Best 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/
azel
Regular
Posts: 265
Joined: Thu Apr 21, 2005 4:28 am
Contact:

Post by azel »

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

Post by garvinhicking »

Hi!

Do you still have that "echo "Q: $sql" part in your code? Can you paste your current include/functions_entries.inc.php file on http://nopaste.php-q.net?

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/
azel
Regular
Posts: 265
Joined: Thu Apr 21, 2005 4:28 am
Contact:

Post by azel »

Whoops, it looks like when I changed that line, it did not save. I added the line again, and now this shows up on the sidebar:

Q: SELECT e.id, e.title, e.timestamp, e.comments, e.exflag, e.authorid, e.trackbacks, e.isdraft, e.allow_comments, e.last_modified, a.realname AS author, a.email , e.body, e.extended FROM serendipity_entries AS e LEFT JOIN serendipity_authors a ON e.authorid = a.authorid LEFT JOIN serendipity_entrycat ec ON e.id = ec.entryid LEFT JOIN serendipity_category c ON ec.categoryid = c.categoryid LEFT JOIN serendipity_authorgroups AS acl_a ON acl_a.authorid = 1 LEFT JOIN serendipity_access AS acl_acc ON ( acl_acc.artifact_mode = 'read' AND acl_acc.artifact_type = 'category' AND acl_acc.artifact_id = c.categoryid ) WHERE isdraft = 'false' AND ( c.category_left BETWEEN 5 AND 6) AND e.timestamp <= 1147870490 AND ( c.categoryid IS NULL OR ( acl_acc.groupid = acl_a.groupid OR acl_acc.groupid = 0) OR ( acl_acc.artifact_id IS NULL ) ) GROUP BY e.id ORDER BY timestamp DESC LIMIT 15, 15
Fetch Result:
1

Will still upload the file though, just in case.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I think I found the problem, that happens because of the "LIMIT 15, 15" statement.

To fix this, please try to edit your serendipity_plugin_showentries.php file. Please replace it with this content:

http://nopaste.php-q.net/212711

HTH,
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/
azel
Regular
Posts: 265
Joined: Thu Apr 21, 2005 4:28 am
Contact:

Post by azel »

An error shows up on the sidebar now:

Parse error: syntax error, unexpected T_VARIABLE in /home/.alina/azel/aetheric-shade.org/plugins/serendipity_plugin_showentries/serendipity_plugin_showentries.php on line 90
Post Reply