Entries.tpl Modification

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
kes601
Regular
Posts: 5
Joined: Sun Feb 19, 2006 3:44 pm

Entries.tpl Modification

Post by kes601 »

I'm trying to get the communityrating plugin to display my rating of a product on the main page instead of having people have to click into the article. I have modified the entries.tpl file as follows(only showing edited part):

<div class="serendipity_entry_body">
{$entry.body}
{communityrating_show data=$entry.properties type="IMDB"}
</div>


I would think that this would add the rating to the main page of the Blog, however it only shows when you click into the article.

I assume maybe I am missing somethingstupid and am hoping someone can help me out.

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

Re: Entries.tpl Modification

Post by garvinhicking »

Basically your idea is proper, and it should work.

But it seems that the data is somehow missing - can you please edit the 'smarty.inc.php' file of the plugin?

There, modify this code:

Code: Select all

function communityrating_serendipity_show($params, &$smarty) {
    static $images = array();
    global $serendipity;

    if (empty($params['type'])) {
    	$params['type'] = 'IMDB';
    }
to this:

Code: Select all

function communityrating_serendipity_show($params, &$smarty) {
    static $images = array();
    global $serendipity;

    if (empty($params['type'])) {
    	$params['type'] = 'IMDB';
    }
    print_r($params);
Notice the added print_r, that should give you verbose output and can indicate that maybe some of it is missing...please tell me the output of that once on the overview page and once on the detailed entry page, or tell me your url when you have made the modification.

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/
kes601
Regular
Posts: 5
Joined: Sun Feb 19, 2006 3:44 pm

Post by kes601 »

Hi,

Thanks for the quick response. Here are the results I get:

From the Overview Page:

Code: Select all

Text from the article...Array ( [data] => [type] => IMDB )
From the Detailed Page:
From the Overview Page:

Code: Select all

Text from the article... Array ( [data] => Array ( [cr_IMDB_id] => tt0349467 [cr_IMDB_rating] => 5 [ep_cache_body] =>
Same text from the article... [ep_cache_extended] => ) [type] => IMDB ) 
Thanks again for any help!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hm, it seems that your $entry array does not have the $entry.properties set when being in the overview page.

Can you tell me which serendipity version you are using, and which event plugins in which order you have installed? It might be that one is interfering...

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/
kes601
Regular
Posts: 5
Joined: Sun Feb 19, 2006 3:44 pm

Post by kes601 »

Hi,

I am using Serendipity 1.0-beta1 and Community Rating version 1.04.

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

Post by garvinhicking »

But you must surely also have other event plugins installed? Please tell me of those!

Also, can you please use a service like http://nopaste.php-q.net/ to paste the full contents of your entries.tpl file?

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/
kes601
Regular
Posts: 5
Joined: Sun Feb 19, 2006 3:44 pm

Post by kes601 »

Hi,

All of the Event Plugins I have installed are:

Markup: Serendipity
version: 1.1

Markup: Emoticate
version: 1.2

Markup: NL2BR
version: 1.3

Browser Compatibility
version: 1.0

Spam Protector
version: 1.31

Spartacus
version: 2.5

Podcast
version: 0.6

Community Rating
version: 1.04

And here is the link to the code from my entries.tpl file:
http://nopaste.php-q.net/193172

Thanks again for all your help.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Thanks for that, it helped me find the cause. The problem is that you need the "serendipity_event_entryproperties" ("Extended properties for entries") plugin so that the $entry.properties array is existing. That plugin is distributed with serendipity, and you can easily install it from your event plugin configuration.

Actually, I'm surprised that it did work on the extended display! :-)

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/
kes601
Regular
Posts: 5
Joined: Sun Feb 19, 2006 3:44 pm

Post by kes601 »

Thanks,

That took care of it!
Post Reply