star rating

Author Message

Bienvenu Isaac Kanyinda

Wednesday 22 April 2009 7:37:03 am

use datatype star rating of how to replace the result by the numbers of images.
where there are 2 / 5 that we can have 2 images of different colors than the other 3

{def $rating=$attribute.content
     $rating_url=concat('/starrating/collect/',$attribute.id,'/',$attribute.version,'/')}

<ul class="star-rating">
<li id="rating_percent_{$attribute.id}" class="current-rating" style="width:{$rating.rounded_average|div(5)|mul(100)}%;">Currently {$rating.rounded_average|wash}/5 Stars.</li>
{if $rating.has_rated|not}
{for 1 to 5 as $num}
{if $var|eq('o')}

<li></li>
{else}
<li><a href={concat($rating_url,$num)|ezurl} id="sr_{$attribute.id}_{$num}" title="Rate {$num} stars out of 5" class="stars-{$num}" rel="nofollow" onfocus="this.blur();">{$num}</a></li>
{/if}
{/for}
{/if}
</ul>
{literal}
<script type="text/javascript">
 var tsh = document.getElementById("rien");{/literal}
 tsh.innerHTML={$rating.number}
 {literal}
 var etoile = document.getElementById("tv_moyenne");{/literal}
 etoile.innerHTML={$rating.rounded_average|wash}
 
  </script>
 {*Rating: <strong><span id="average_{$attribute.id}">{$rating.rounded_average|wash}</span></strong>/5 (<span id="total_{$attribute.id}">{$rating.number|wash}</span> votes cast)
<p id="has_rated_{$attribute.id}">{if $rating.has_rated}Thank you for your rating!{/if}</p>*}
{if $rating.has_rated|not}
{def $hasXajaxAccess=fetch('user','has_access_to',hash('module','xajax','function','all'))}
{if $hasXajaxAccess}{run-once}{xajax_javascript()}{/run-once}{/if}
{run-once}{xajax_javascript()}{/run-once}
<script type="text/javascript">

 function starrating_init_{$attribute.id}() {ldelim}
{for 1 to 5 as $num}
   YAHOO.util.Event.addListener("sr_{$attribute.id}_{$num}", "click", function(e){ldelim}
     YAHOO.util.Event.preventDefault(e);
     xajax_starrating({$attribute.id}, {$attribute.version}, {$num});
{rdelim});

{/for}
 {rdelim}

 YAHOO.util.Event.onDOMReady(starrating_init_{$attribute.id});

 function starrating_clear_{$attribute.id}() {ldelim}
{for 1 to 5 as $num}
   YAHOO.util.Event.removeListener("sr_{$attribute.id}_{$num}", "click");

{/for}
 {rdelim}

</script>
{/if}

Petit poisson deviendra grand pourvu que Dieu lui prĂȘte vie.
Petit oiseau volera un jour de ses propres ailes pourvu que Dieu lui ajoute le nombre de jours sur terre.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 03:44:27
Script start
Timing: Jan 31 2025 03:44:27
Module start 'layout'
Timing: Jan 31 2025 03:44:27
Module start 'content'
Timing: Jan 31 2025 03:44:28
Module end 'content'
Timing: Jan 31 2025 03:44:28
Script end

Main resources:

Total runtime0.9240 sec
Peak memory usage8,192.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 588.0078151.1953
Module start 'layout' 0.00560.0043 739.2031220.6406
Module start 'content' 0.00990.9133 959.84384,380.0234
Module end 'content' 0.92320.0008 5,339.86727.8906
Script end 0.9240  5,347.7578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3579160.0002
Check MTime0.00120.1265160.0001
Mysql Total
Database connection0.00110.116710.0011
Mysqli_queries0.829089.7224460.0180
Looping result0.00040.0484440.0000
Template Total0.841891.120.4209
Template load0.00190.207620.0010
Template processing0.839890.891420.4199
Template load and register function0.00150.157810.0015
states
state_id_array0.00620.670610.0062
state_identifier_array0.00170.186020.0009
Override
Cache load0.00160.168570.0002
Sytem overhead
Fetch class attribute can translate value0.00180.194710.0018
Fetch class attribute name0.00160.175220.0008
XML
Image XML parsing0.00190.202410.0019
class_abstraction
Instantiating content class attribute0.00000.000620.0000
General
dbfile0.02072.2359160.0013
String conversion0.00000.000840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 7
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs