Writing plugin, needing tips :)

Discussion corner for Developers of Serendipity.
Post Reply
Boris

Writing plugin, needing tips :)

Post by Boris »

Hi,

I'm currently writing a Lucene-based Index&Search-plugin with Zend_Search_Lucene. Currently the whole core stuff (indexing, searching, deleting and updating of entries) is working quite good.

Now it comes to the finer (read: harder :)) parts, at least for me as I don't know much of the s9y-internals. I need a way to display the search-result with the current template. I had a look into the static-page-plugin, but this seems to be very low level.
Then I tried serendipity_printEntries, but this outputs nothing in my current context. I'm currently using it in a function which is called by entries_header.
Any hints how I could implement that in an (quite easy) way?


Garvin hinted a while ago in a PN, that he could imagine to implement some kind of search-abstraction to allow different search-plugins. But until that's available, I'm looking for a sane solution to display my results in a nice a. (currently it's only plain text).
Boris

Post by Boris »

Here's a link to that code if it helps:

http://nopaste.tshw.de/1171813036fd13d/
(show() starts in line 94)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I believe the easiest way would be to hook into the frontend_fetchentries function, and if possible manipulate the $eventData to fetch the SQL resultset.

If that can't be done, you can resort to the frontend_entryproperties event hook and just inject your resultset datainto the eventData array?

If that also don't help, you'll need to do something like what you initially tried. If I read your code correctly, you are simply missing an smarty fetch call from your results. The printEntries() method only assigns variables into an ENTRIES variable, but your method doesn'T seem to call any $serendipity['smarty']->display() call, or an serendipity_smarty_fetch('CONTENT', 'content.tpl'); call. The 'show()' method needs to output data to the browser; you could try an 'echo' as well, AFAIK.

I'm a bit short on time so I can't execute your plugin. But if you are not able to proceed any further let me know, and I'll have a deeper look.

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/
Boris

Post by Boris »

Thanks.
garvinhicking wrote:I'm a bit short on time so I can't execute your plugin.
I think/hope one of these hints will work. Otherwise I'll get in touch with you again.
Post Reply