Welcome Guest, Not a member yet? Register   Sign In
Including non CodeIgniter scripts
#1

[eluser]PHP Creative[/eluser]
I am using a php/ajax star rating script. When I try to include it into a view using a php include it creates php conflicts with CodeIgniter. The script works perfectly outside CodeIgniter

My question is there anyway to include other scripts without creating conflicts with CodeIgniter.
#2

[eluser]jedd[/eluser]
Quote:My question is there anyway to include other scripts without creating conflicts with CodeIgniter.

If I answered : yes ... would you find that irritating, or would the comfort of having an answer as vague as 'conflicts with CodeIgniter' offset that?
#3

[eluser]PHP Creative[/eluser]
lol
#4

[eluser]Tom Schlick[/eluser]
we need alot more information. please post the script along with your code that you used to try to integrate it. you can't just say it doesn't work help me.
#5

[eluser]PHP Creative[/eluser]
This is the code in question - http://msteigerwalt.com/widgets/ratings/v1.2/

Quote:A PHP Error was encountered
Severity: Notice

Message: Undefined index: vote

Filename: CodeIgniter_1.7.1/ratings.php

Line Number: 247

Code:
if ($_POST['vote'] && $_POST['id']) {
    $r = new RabidRatings();
    $r->doVote($_POST['id'], $_POST['vote']);
};


The error comes from this section ratings.php (above).

I am simply including demo.php into a view.
#6

[eluser]Tom Schlick[/eluser]
try

Code:
$this->input->post('vote');

and where are you including the rabid ratings? if its a php class then make it a library and use the load library function
#7

[eluser]PHP Creative[/eluser]
Thanks very much.

Code:
<?php require_once("ratings.php"); $rr = new RabidRatings(); ?>
                
<<<javacript/css files>>>



    &lt;?php
        for ($i = 1; $i < 5; $i++) {
            $rr->showStars("myArticle$i");
        }
    ?&gt;




I dont think it can be a library because it is called in the javascript...

Code:
window.addEvent('domready', function(e) {
    var rating = new RabidRatings({url:'ratings.php'});
});
#8

[eluser]garymardell[/eluser]
It may take abit of shuffling code around to make it work the ci way. Have whatever class there is as a library and anything being called by javascript as a controller.
#9

[eluser]KieranA[/eluser]
Take into account that "if ($_POST['var'])" will return an Notice error, to fix that you can use the CodeIgniter post - However on the included script you could just change that statement to "if (isset($_POST['var']))" and no errors would occur, and it would allow you to post the value of 0 too.
#10

[eluser]TheIgniter[/eluser]
Excuse me! I'm stuck, i create the rabid librarie but i dont know how call the rating librarie from the js :

Code:
window.addEvent('domready', function(e) {
    var rating = new RabidRatings({url:'ratings.php'});
});

Please, could you guys help me.


Fixed :

I create a controller to load the librarie and editing the url in the js file to :
Code:
var rating = new RabidRatings({url:'http://localhost/project/index.php/yourcontroller/loadlib'});




Theme © iAndrew 2016 - Forum software by © MyBB