Rating code on single entry page / latest rating / erratic appearance
Posted: 17 April 2008 06:07 AM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

I have the following code which works (the code shows the most recent entry which has been rated / commented upon) ...

<div class="latest_rating">{exp:rating:entries weblog="weblogname" orderby_ratings="date" limit="1" dynamic="off"}
{exp
:weblog:entries weblog="weblogname" entry_id="{entry_id}"}
<div class="latest_entry_title"><a href="{title_permalink=template_group/comments}">{title}</a></div>
<
div class="latest_summary_listall">{stars}{rating}{/stars}</div>
<
div class="latest_rating_by">Posted by <span class="orange">{rating_name}</spanon {rating_date format="%d/%m/%y"} at {rating_date format='%h:%i%a'} GMT+1</div>{/exp:weblog:entries}{/exp:rating:entries}</div>

... most of the time. The only page which is doesn’t work (all of the time) is the single entry page (the page for the entry, rating, comment etc.). It’s appearance is best described as ‘erratic’. Sometimes there, sometimes not. The div formatting appears, but there’s nothing turning up.

Ideas as to why and how to fix very welcome.

Thanks.

KCesp

Profile
 
 
Posted: 17 April 2008 06:49 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  700
Joined  2004-03-30

First step is to break this code apart into separate templates. Embed the weblog entries code into its own template and then call it into the main template, passing the necessary variables across.

mk

 Signature 

Mitchell Kimbrough

Profile
 
 
Posted: 17 April 2008 07:09 AM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

Ouch. I thought it would be just a matter of jiggling the code around a little.

I need to get my head around / read-up on your suggested solution ...

Thanks for the quick reply.

KCesp

Profile
 
 
Posted: 17 April 2008 07:12 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1889
Joined  2006-10-18

KCesp,

Try something like this: smile

Main Code:

<div class="latest_rating">{exp:rating:entries weblog="weblogname" orderby_ratings="date" limit="1" dynamic="off"}
{embed
='template_path/to_weblog_entries' entryid="{entry_id}"}
{
/exp:rating:entries}</div>

Weblog Entries Embedded Code:

{exp:weblog:entries weblog="weblogname" entry_id="{embed:entryid}"}
<div class="latest_entry_title"><a href="{title_permalink=template_group/comments}">{title}</a></div>
<
div class="latest_summary_listall">{stars}{rating}{/stars}</div>
<
div class="latest_rating_by">Posted by <span class="orange">{rating_name}</spanon {rating_date format="%d/%m/%y"} at {rating_date format='%h:%i%a'} GMT+1</div>{/exp:weblog:entries}

You might need to go further than that… but see where it gets you wink

 Signature 
Profile
 
 
Posted: 17 April 2008 07:36 AM   [ Ignore ]   [ # 4 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

OK.

In the ‘comments’ template (our single entry page for EE) I have the following code:

<div class="latest_rating">{exp:rating:entries weblog="weblogname" orderby_ratings="date" limit="1" dynamic="off"}
{embed=’template_group/embed_latest_rating’ entryid="{entry_id}"}{/exp:rating:entries}</div>

A new template - called ‘template_group/embed_latest_rating - has been setup and contains the following code (there is nothing else - just this code):

{exp:weblog:entries weblog="weblogname" entry_id="{embed:entryid}"}
<div class="latest_entry_title">{title}</div>
<div class="latest_summary_listall">{stars}{rating}{/stars}</div>
<div class="latest_rating_by">Posted by <span class="orange">{rating_name}</span> on {rating_date format="%d/%m/%y"} at {rating_date format=’%h:%i%a’} GMT+1</div>{/exp:weblog:entries}

Unfortunately, other than the title of the entry which has received the rating, nothing appears other than the code being used.

Further thoughts? Or am I mistaken in the way I have applied your solution?

KCesp

Profile
 
 
Posted: 18 April 2008 05:55 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1889
Joined  2006-10-18

Hmmm… try:

Main Code:

<div class="latest_rating">{exp:rating:entries weblog="weblogname" orderby_ratings="date" limit="1" dynamic="off"}
{embed
='template_path/to_weblog_entries' entryid="{entry_id}"}
{
/exp:rating:entries}</div>

Weblog Entries Embedded Code:

{exp:weblog:entries weblog="weblogname" entry_id="{embed:entryid}"}
<div class="latest_entry_title"><a href="{title_permalink=template_group/comments}">{title}</a></div>
{embed='template_path/to_rating_embed' entryid="{entry_id}"}
{
/exp:weblog:entries}

Rating Embed:

{exp:rating:entries weblog="weblogname" orderby_ratings="date" entry_id="{embed:entryid}" dynamic="off"}
<div class="latest_summary_listall">{stars}{rating}{/stars}</div>
<
div class="latest_rating_by">Posted by <span class="orange">{rating_name}</spanon {rating_date format="%d/%m/%y"} at {rating_date format='%h:%i%a'} GMT+1</div>
{/exp:rating:entries}

 Signature 
Profile
 
 
Posted: 20 April 2008 12:27 PM   [ Ignore ]   [ # 6 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

Hi Pie Man.

Thanks for the code. Have tried ... and still have the same problem. FYI, it doesn’t matter whether the actual entry has been rated or not. Here’s what I have, based on your code ...

In the ‘comments’ template (our single entry page for EE) I have the following code (the ‘main’ code’):

<div class="latest_rating">{exp:rating:entries weblog="weblogname" orderby_ratings="date" limit="1" dynamic="off"}
{embed
='template_group/embed_weblog_entries' entryid="{entry_id}"}{/exp:rating:entries}</div>

Here’s what’s currently in the first embed template (template_group/embed_weblog_entries):

{exp:weblog:entries weblog="weblogname" entry_id="{embed:entryid}"}
<div class="latest_entry_title"><a href="{title_permalink=template_group/comments}">{title}</a></div>
{embed='template_group/embed_rating' entryid="{entry_id}"}
{
/exp:weblog:entries}

And here’s what’s in the second embed template (template_group/embed_rating):

{exp:rating:entries weblog="weblogname" orderby_ratings="date" entry_id="{embed:entryid}" dynamic="off"}
<div class="latest_summary_listall">{stars}{rating}{/stars}</div>
<
div class="latest_rating_by">Posted by <span class="orange">{rating_name}</spanon {rating_date format="%d/%m/%y"} at {rating_date format='%h:%i%a'} GMT+1</div>{/exp:rating:entries}

In summary, the ‘comments’ template - containing the main code - calls for the first embed template, which in turn calls for the second embed template.

Your further thoughts and suggestions are welcome.

Thanks.

KCesp

Profile
 
 
Posted: 21 April 2008 06:11 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1889
Joined  2006-10-18

Try this:

Main Code:

<div class="latest_rating">{exp:rating:entries weblog="weblogname" orderby_ratings="date" limit="1" dynamic="off"}
{exp
:weblog:entries weblog="weblogname" entry_id="{entry_id}"}
<div class="latest_entry_title"><a href="{title_permalink=template_group/comments}">{title}</a></div>
{embed='template_path/to_rating_embed' entryid="{entry_id}"}
{
/exp:weblog:entries}
{
/exp:rating:entries}</div>

Rating Embed:

{exp:rating:entries weblog="weblogname" orderby_ratings="date" entry_id="{embed:entryid}" dynamic="off"}
<div class="latest_summary_listall">{stars}{rating}{/stars}</div>
<
div class="latest_rating_by">Posted by <span class="orange">{rating_name}</spanon {rating_date format="%d/%m/%y"} at {rating_date format='%h:%i%a'} GMT+1</div>
{/exp:rating:entries}

Make sure you also change “weblogname” to the weblog name wink

 Signature 
Profile
 
 
Posted: 21 April 2008 12:49 PM   [ Ignore ]   [ # 8 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

Hello again.

Still not working 100% of the time I’m afraid. It looks to be a random decision as to whether anything appears or not.

Don’t worry, I have been changing / checking path names et al as I have been going along (as is proven by the incidence that sometimes it works, sometimes not). Better that you double check with me though! I don’t mind you asking.

So there we have it. Back to you ... or maybe someone else out there has experienced the same problem and can put us in the right direction?

Thanks again for your time on this.

Profile
 
 
Posted: 22 April 2008 07:30 AM   [ Ignore ]   [ # 9 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1889
Joined  2006-10-18
KCesp - 21 April 2008 12:49 PM

Still not working 100% of the time I’m afraid. It looks to be a random decision as to whether anything appears or not.

So it does work, but only for some entries? smile
Do you notice anything different with certain entries over other ones that might be different? smile

 Signature 
Profile
 
 
Posted: 22 April 2008 12:13 PM   [ Ignore ]   [ # 10 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

Hi Pie Man.

Yes, as alluded to above (my first call for help), that code (as well the others tried) does ‘work’, but only some of the time. It works everywhere all of the time except the ‘comments’ page (the single entry page carrying the entry).

Did I notice anything different? That was one of my first thoughts too ... but nothing looks ‘out of place’. In fact, this segment of code is ‘isolated’ (in as much as it is ‘boxed off’) from the main code which generates the entry and the option to rate and comment.

I’d be happy to PM you with the U&P;to the site so you can have a dig around, if you like. You might spot something which only becomes obvious when you see it. Let me know if you’d like me to do that. If we can get it solved, I’d be happy to post the ‘solution’ here for anyone else having the same problem.

KCesp.

Profile
 
 
Posted: 23 April 2008 06:13 AM   [ Ignore ]   [ # 11 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  1889
Joined  2006-10-18

Sure, I can give it a shot wink

 Signature 
Profile
 
 
Posted: 28 April 2008 08:49 AM   [ Ignore ]   [ # 12 ]
Jr. Member
RankRank
Total Posts:  35
Joined  2008-04-04

Hi Pie Man.

We’ve had a change of mind on this one and will leave it off all pages other than the front (for reasons of ‘screen clutter’).

Shame we couldn’t get a ‘fix’ for it, but I’ll make sure to check to see if the problem resolves itself in future module releases.

Lastly, thanks for your assistance and thought on this.

KCesp.

Profile