Fork me on GitHub

Ratings alternate template  Bottom

  • 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.
  • 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
  • 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?
  • 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.
  • 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. icon_smile



    edited by: FiddleFaddle, datetimebrief
  • 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.
  • 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 |
  • 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.
  • Yes, I like hilope's idea. That would be terrific!

    When will you be done? LOL icon_wink icon_razz

    Seriously, can I pay you to add that? If so, how much and when could you do it?



    edited by: FiddleFaddle, datetimebrief
  • 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
  • Better yet, I've posted a bid request at zikulapro.com.

    http://zikulapro.com/index.php?module=zikula&func=viewpub&tid=11&pid=61
  • 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
  • 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!

    icon_cool

This list is based on users active over the last 60 minutes.