I am using the Ratings module hooked to Pagemaster. When a Pagemaster publication is viewed, the rating for that particular publication is shown at the top of the page. In a block, there is a list of other publications with their titles and ratings for each.
In that block, I want to use a different ratings template so I can use smaller star images for the ratings. How can I do this?
Thanks.
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- rgasch created topic »Using PageUtil::addVar() to load script code« 11:48 AM
- michiel responded to »password problem« 10:01 AM
- mazdev responded to »Hide "Register new account" and change template to 3 col« 07:50 AM
- mesteele101 created topic »Zikula 1.3.3 - Site Search 1.5.2 - Unable to turn off plug-ins« 07:48 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Ratings alternate template
-
- Rank: Registered User
- Registered: Mar 09, 2010
- Last visit: May 26, 2010
- Posts: 24
-
- Rank: Team Member
- Registered: Sep 05, 2006
- Last visit: May 06, 2010
- Posts: 78
Hello,
You've to personalize this template:
modules/Ratings/pntemplates/ratings_user_display.htm
But be careful, that will modify the ratings template for all the others module.
edited by: Yokav, datetimebrief -
- Rank: Registered User
- Registered: Mar 09, 2010
- Last visit: May 26, 2010
- Posts: 24
Thank you.
But how can I specify different images for different uses? In my scenario above, I mentioned that I want to use a different layout and images for the ratings shown in a block. Is there any way at all to do this or am I stuck with one? -
- Rank: Team Member
- Registered: Sep 05, 2006
- Last visit: May 06, 2010
- Posts: 78
Correct me if I'm wrong:
1. you want a personalized template for ratings only into a particular block, not for all the ratings.
2. you want to personalized it depending on the user's group.
It's possible but not the most thing to do.
You will have to personalize the PHP code of the particular block because actually he calls a function of the Ratings module with the defaults parameters, if you do that you will be able to set as parameter the name of a particular template and then personalize the ratings only for this block.
And about the personalize ratings depending on the user's group, this should be done into the same template too. -
- Rank: Registered User
- Registered: Mar 09, 2010
- Last visit: May 26, 2010
- Posts: 24
1. Yes
2. No
Here is a sample of what I want to do: http://screencast.com/t/NDg2YzRjNDct
There is a rating shown right above the video. Other videos are listed in a block on the right side, each of which shows a rating. As you can see from the screenshot above, I need the stars above the video to be different than the stars in the block.
Thank you, Yokav, for your interest in helping me.
edited by: FiddleFaddle, datetimebrief -
- Rank: Team Member
- Registered: Sep 05, 2006
- Last visit: May 06, 2010
- Posts: 78
You're welcome, I'm working actually on the Ratings module so it's easier for me to help you.
Then for your particular case, you can't modify directly the main template or all the "stars" will me modified. You will have to modify the PHP call to the ratings hook for the block or the video to use a different template for this one. -
- Rank: Developer
- Registered: Aug 05, 2003
- Last visit: May 06, 2010
- Posts: 187
An idea is setting up a switch for templates i think.
I made something similar for scribite! ...
The Ratings module can check for (existing) templates in the following order (followed by source module and perhaps extended with functions and so on):
1. ratings_user_display_pagemaster_view.htm -> function "view" from pagemaster
2. ratings_user_display_pagemaster.htm -> when called from module pagemaster
3. ratings_user_display_blocks_bidXY.htm -> when called for Block with id XY
4. ratings_user_display_blocks.htm -> when called from Blocks
5. ratings_user_display.htm (as last fallback and default)
This would be an extremly flexible system with many possibilities for admins. Just create a special template for every situation ;)
I like that idea for any "hooked" module ....
Sven
--
| scribite! | TNGz | piwik | zweet | -
- Rank: Team Member
- Registered: Sep 05, 2006
- Last visit: May 06, 2010
- Posts: 78
Hmmm yes really interesting!
I wanted to introduce a new "feature" split the current template which contain all the ratings type into different templates depending on the rating type. But now that you purpose this new feature, I'm not really sure that's always a good idea as we will have many more templates...it could become a little confusing. -
- Rank: Registered User
- Registered: Mar 09, 2010
- Last visit: May 26, 2010
- Posts: 24
Yes, I like hilope's idea. That would be terrific!
When will you be done? LOL
Seriously, can I pay you to add that? If so, how much and when could you do it?
edited by: FiddleFaddle, datetimebrief -
- Rank: Registered User
- Registered: Mar 09, 2010
- Last visit: May 26, 2010
- Posts: 24
Ok, so I'd like to add a check in the code to determine which template to show. Basically, a hack to get me by for now.
I'm looking at lines 60-66 in pnuser.php:Code
// RNG: add template override option
$template = 'ratings_user_display.htm';
$tplOverride = null;
if (isset($args['extrainfo']['template'])) {
$tplOverride = $args['extrainfo']['template'] . '/' . $template;
}
// RNG End
I would like to add a conditional statement that checks if the item is being displayed in a block. If so, it would use a different template. Something like:Code
if ($whatever = block) {
$template = 'ratings_user_block_display.htm';
} else {
$template = 'ratings_user_display.htm';
}
Any ideas? Thanks!
edited by: FiddleFaddle, datetimebrief -
- Rank: Registered User
- Registered: Mar 09, 2010
- Last visit: May 26, 2010
- Posts: 24
Better yet, I've posted a bid request at zikulapro.com.
http://zikulapro.com/index.php?module=zikula&func=viewpub&tid=11&pid=61 -
**unknown user**
- Rank: Helper
- Registered: Mar 16, 2002
- Last visit: May 18, 2010
- Posts: 985
I was starting to write a plugin with options for pagemaster... it's not done yet [read 'not enough hours in one day ATM'] but maybe it's useful to start with for someone...
http://www.igor.vc/_…ter_ratingCount.txt
- Igor -
- Rank: Registered User
- Registered: Mar 09, 2010
- Last visit: May 26, 2010
- Posts: 24
Quote
I was starting to write a plugin with options for pagemaster... it's not done yet [read 'not enough hours in one day ATM'] but maybe it's useful to start with for someone...
I used this and it works great! I simply altered the images and their locations in the plugin and it works flawlessly. Thanks Igor!
- Moderated by:
- Support
