Page 1 of 1

Entries.tpl Modification

Posted: Sun Feb 19, 2006 11:34 pm
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.

Re: Entries.tpl Modification

Posted: Mon Feb 20, 2006 11:26 am
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

Posted: Mon Feb 20, 2006 1:04 pm
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!

Posted: Mon Feb 20, 2006 1:18 pm
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

Posted: Mon Feb 20, 2006 1:23 pm
by kes601
Hi,

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

Thanks!

Posted: Mon Feb 20, 2006 1:34 pm
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

Posted: Mon Feb 20, 2006 2:15 pm
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.

Posted: Mon Feb 20, 2006 2:58 pm
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

Posted: Mon Feb 20, 2006 4:17 pm
by kes601
Thanks,

That took care of it!