Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hi there. I am working on my own blog where user can rate the post and vote other products. But I am having trouble with both the star rating and voting. Both the scripts works with the last post but it doesn't work with the previous posts. And also for the star rating I can only rate up-to 4 stars. 5th star is not working. Please help me. Here is my script.
Code: Select all
<?php require_once( 'couch/cms.php' ); ?>
<cms:template title='Rate'>
    <cms:editable type='vote_updown' search_type='decimal' name='my_vote' label='Votes Casted' />
    <cms:editable type='vote_stars' search_type='decimal' allow_zero_stars='0' name='my_stars' />
<!DOCTYPE html>
    <link rel="stylesheet" href="//">
    <link href="//" rel="stylesheet" id="bootstrap-css">
        .rating {
    /* :not(:checked) is a filter, so that browsers that don’t support :checked don’t
      follow these rules. Every browser that supports :checked also supports :not(), so
      it doesn’t make the test unnecessarily selective */
    .rating:not(:checked) > input {
    .rating:not(:checked) > label {
        /* padding:0 .1em; */
        /* line-height:1.2; */
    .rating:not(:checked) > label:before {
        content: '★ ';
    .rating > input:checked ~ label {
        color: dodgerblue;
    .rating:not(:checked) > label:hover,
    .rating:not(:checked) > label:hover ~ label {
        color: dodgerblue;
    .rating > input:checked + label:hover,
    .rating > input:checked + label:hover ~ label,
    .rating > input:checked ~ label:hover,
    .rating > input:checked ~ label:hover ~ label,
    .rating > label:hover ~ input:checked ~ label {
        color: dodgerblue;
    .rating > label:active {
    <cms:form masterpage=k_template_name mode='edit' page_id=k_page_id anchor='0' method='post'>
        <cms:if k_success>
            <cms:db_persist_form my_stars=frm_stars />
            <cms:redirect k_page_link />
        <div class="rating">
            <cms:input type='radio' id="star" name="stars" opt_values='5 | 4 | 3 | 2 | 1' />
            <input type="submit" name="submit" value="Vote" />
    <cms:form masterpage=k_template_name mode='edit' page_id=k_page_id anchor='0' method='post'>
        <cms:if k_success>
            <cms:if "<cms:gpc 'vote_up' />">
                <cms:db_persist_form my_vote='1' />
                <cms:else_if "<cms:gpc 'vote_down' />" />
                <cms:db_persist_form my_vote='-1' />
            <cms:if k_success>
                <cms:set_flash name='success_msg' value="Thanks for your feedback!" />
                <cms:redirect k_page_link />
        <button type="submit" name='vote_up' class="detail-banner-btn" value="1">
            <i class="fa fa-thumbs-o-up"></i> Like (<cms:show_votes 'my_vote'>
                <cms:show count_up />
        <button type="submit" name='vote_down' class="detail-banner-btn" value="1">
            <i class="fa fa-thumbs-o-down"></i> Dislike (<cms:show_votes 'my_vote'>
                <cms:show count_down />
        <cms:input type='hidden' name='tmp' />
    <cms:show_votes 'my_stars'>
        <br />
            <cms:dump />
    <cms:show_votes 'my_vote'>
        <cms:dump />
<script src="//"></script>
<script src="//"></script>
<script type="text/javascript">
$(document).ready(function() {
    // make following action fire when radio button changes
    $('input[type=radio]').change(function() {
        // find the submit button and click it on the previous action
<?php COUCH::invoke(); ?>

Thank you for your help and sorry for my english.
Can anyone help me?
upadesh wrote: Can anyone help me?

I can, but I did not find you in my list of donators, so wait for @KK to respond when he has extra free time.
3 posts Page 1 of 1

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests