ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How to include this Ajax rating tool?

April 28, 2008 5:48am

Subscribe [0]
  • #1 / Apr 28, 2008 5:48am

    Lindstrom

    30 posts

    Hi,

    I tried to include this nice script in one of my templates: http://boedesign.com/lab/ajax-star-rating/

    In the template I inserted all commands for the script but I only get a crashed site and an error message like this:

    Warning: include(<a href="http://mysite.com/ajax/star_rating/includes/rating_functions.php">http://mysite.com/ajax/star_rating/includes/rating_functions.php</a>) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in /var/www/vhosts/mysite/httpdocs/cms/system/core/core.functions.php(637) : eval()'d code on line 1
    
    Warning: include() [function.include]: Failed opening 'http://mysite.com/ajax/star_rating/includes/rating_functions.php' for inclusion (include_path='.:') in /var/www/vhosts/mysite/httpdocs/cms/system/core/core.functions.php(637) : eval()'d code on line 1
    
    Warning: include(<a href="http://mysite.com/ajax/star_rating/includes/rating_functions.php&#41">http://mysite.com/ajax/star_rating/includes/rating_functions.php&#41</a>; [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in /var/www/vhosts/mysite/httpdocs/cms/system/core/core.functions.php(637) : eval()'d code on line 10
    
    Warning: include() [function.include]: Failed opening 'http://mysite.com/ajax/star_rating/includes/rating_functions.php' for inclusion (include_path='.:') in /var/www/vhosts/mysite/httpdocs/cms/system/core/core.functions.php(637) : eval()'d code on line 10
    {embed="mysite/header"}
    
    Fatal error: Call to undefined function pullRating() in /var/www/vhosts/mysite/httpdocs/cms/system/core/core.functions.php(637) : eval()'d code on line 48

    In template preferences I allowed PHP for this template with the output option.

    Has anyone an idea?

    Thanks and regards…

    Moderator’s note: Edited out the name of the system directory. Moved to Tech Support.

  • #2 / Apr 28, 2008 7:19am

    Ingmar

    29245 posts

    Your include() is failing, you’re getting a 401 error. Try putting it outside of a protected directory.

  • #3 / Apr 28, 2008 7:36am

    Lindstrom

    30 posts

    There is an example file included and when I go to this site outsite of EE the script works fine. The problem appears in EE only. How can I avoid this 401 error.

  • #4 / Apr 28, 2008 11:23am

    Robin Sowell

    13255 posts

    Is this plugin designed for EE- does it have any docs?  As Ingmar notes- it’s getting a 401 when trying to include it- I’d move the file and see if it works.  But- if it’s the one I’m thinking of, there may be some docs on the setup- the answer may well be there.  Got any links to documentation?

  • #5 / Apr 28, 2008 11:47am

    Lindstrom

    30 posts

    Thanks. This is no plugin - it is simply a free Ajax rating script. I just want to try it whether it is possible to combine it with blog-entries or comments. As I wrote the script works fine where it is when I use it not through EE. So EE has a problem with it. I implemented it with this instructions:

    The tags that MUST appear on your page(s) are as follows:
    
    <? include("includes/rating_functions.php"); ?>
    
    <link href="css/rating_style.css" rel="stylesheet" type="text/css" media="all">
    
    < script type="text/javascript" src="js/rating_update.js">
    
    
    
    Now to call the rating bar we simply insert this PHP snippet.
    
    <? echo pullRating(35,false,false,false,NULL); ?>
  • #6 / Apr 28, 2008 12:42pm

    Robin Sowell

    13255 posts

    OK- not sure you want to run it this way, but can test to see if it works- move the whole includes folder into the core folder real quick- see if that makes a lick of difference.  Use a full path to try and include.

  • #7 / Apr 28, 2008 2:37pm

    Lindstrom

    30 posts

    Ok, I moved the “include” folder into the core folder and made absolute paths. Now there is only one error left at the position where the stars should appear:

    Fatal error: Call to undefined function pullRating() in /var/www/vhosts/mydomain.com/httpdocs/syscore/core/core.functions.php(637) : eval()'d code on line 62

    Any idea?

    By the way, the same message appears now in the example file (outside of EE) too.

  • #8 / Apr 28, 2008 4:19pm

    Ingmar

    29245 posts

    No, we can’t answer that question without kowing your code. It looks like pullRating() is not a defined function, but we can’t say anything apart from that. If that error appears outside of EE, too, it is probably a general PHP problem.

  • #9 / Apr 29, 2008 6:59am

    macpro

    85 posts

    Away from that question:
    Does any one know a real good working “Ajax Star Rating” solution for EE? And how to implement it?

    cheers

  • #10 / Apr 29, 2008 7:05am

    Ingmar

    29245 posts

    I know Solspace has a Rating module, but it is not free.

    Moved to Howto.

  • #11 / Apr 29, 2008 7:28am

    macpro

    85 posts

    Thanx Ingmar,

    i’ll give Solspaces Rating Tool a try!

  • #12 / Apr 29, 2008 7:40am

    Lindstrom

    30 posts

    The Solspace module is nice but not Ajax. If you want to use it like the script I tried you will have to combine it with jQuery or another framework.

  • #13 / Apr 29, 2008 8:28am

    Ingmar

    29245 posts

    It’s actually quite easy to do that by using the “template” parameter:

    When you provide the ‘template’ parameter, you tell the Rating module what template to use to format messages returned by the module for successful and unsuccessful actions. You will most likely be using the ‘template’ parameter to enable AJAX functionality.

    See the Solspace docs for details, or visit their forums.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases