Welcome Guest, Not a member yet? Register   Sign In
  TinyAjax callback function
Posted by: El Forum - 08-22-2007, 10:47 AM - No Replies

[eluser]snaggy[/eluser]
In TinyAjax (library for CI) you can set a callback function like this:

$this->tinyajax->exportFunction("create_user",array('username','password'),'reload',$this);

reload is the callback function, and it works. But when I pass the function variables through javascript, like this:

$this->tinyajax->exportFunction("delete_user",null,'reload',$this);

and in [removed]

onclick="delete_user('username')"

the callback function doesn't work anymore (the delete_user php function works and the user is deleted, but the javascript callback function in not called)

Anyone has any idea? Is this a TinyAjax bug? I'm not experienced enough to debug it if it is, though

hope I'll be able to solve this problem
bye


  Compiler?
Posted by: El Forum - 08-22-2007, 10:43 AM - No Replies

[eluser]Unknown[/eluser]
I'm brand spanking new to php and codeigniter, and I think codeigniter can help me use and learn php faster.

I saw the video tutorial that codeigniter.com posted on the main page, but when I installed codeigniter to my php server, and use a browser to open up the installed codeigniter that way, but I can't seem to have the same compiler or editor just like in the tutorial video.

I hope you guy know what I mean...


  including image in a page.
Posted by: El Forum - 08-22-2007, 09:47 AM - No Replies

[eluser]Unknown[/eluser]
hi

i have root folder and in the folder i have placed a image folder , CSS folder and a view.php file,i have included images and CSS from the proper folder and included in my view.php file . its works fine when i view the page without keeping the in CI view folder,but when i keep the root folder in the CI's view folder,i can only see the text of view.php, its not included css and images.( there is no prob in controller,i have called the view file from controller.)

how can i solve it,or what initiative should i have to take for desired result ?

Tanvir.


  How to Handle Forgotten Passwords
Posted by: El Forum - 08-22-2007, 09:43 AM - No Replies

[eluser]Michael Wales[/eluser]
I've published a new article on my blog called Handling Forgotten Passwords. It should prove useful to anyone that prefers to roll their own authentication system (no offense to the various third-party offerings).

I'll be posting some code examples, based out of Code Igniter, related to this issue as well, in the coming days.

Plus, Episode 2 of Ignited will be hitting the blog this week as well - not sure on a specific day, but I'll be sure to let you guys know.

I did a test run and I was around the 18 minute mark getting the database up, controller, a view, and then passing data to that view - we'll see how it goes.


  A problem with routing (multiple wildcards?)
Posted by: El Forum - 08-22-2007, 06:58 AM - No Replies

[eluser]#1313[/eluser]
Hello everybody, another newbie coming up!

My site has a cars catalogue, and i want to produce following URIs for my cars:

Code:
http://site.com/cars/lamborgini
and for specific models:
Code:
http://site.com/cars/lamborgini/murcielago

I have following functions in my Cars controller, car_maker() and car_model(), and a simple rule in routes.php:
Code:
$route['cars/:any'] = "cars/car_maker";
which succesfully sends control to car_maker function. Great, i can read about Lamborginis.

But now i want to read a page about Lamborgini Murcielado. I want to add a routing rule to launch car_model function, but i don't know how to write a rule with multiple wildcard characters properly. I tried
Code:
$route['cars/:any/:any'] = "cars/car_maker/car_model";
but this isn't working. How do i do this?


  extending CI_Validation class with MY_Validation class to add validation functions.
Posted by: El Forum - 08-22-2007, 06:47 AM - No Replies

[eluser]flyer[/eluser]
Hi all,

Really struggling to get to grips with a customised MY_Validation. The situation is I want a customised function similar to xss_clean which basically converts a text input string to a modified version (e.g. 'Bob' going to 'Hello Bob Hello'). I also want the validation function to be globally accessible i.e. not just a callback function within the Controller.

To this end I created a very simple custom MY_Validation.php vaguely following the patterns of the xss_clean function:

Code:
MY_Validation.php:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

class MY_Validation extends CI_Validation {

    function MY_Validation()
    {
        parent::CI_Validation();
    }
    
    
    function customise_string( $str )
    {
        $_POST[$this->_current_field] = "Hello " + $str + " Hello";
    }
}
?>
The idea is if I can do this simple conversion, I can then move onto more complex modifications.

The code then used in the controller is:
Code:
function customiseStr()
    {
            $this->load->helper(array('form', 'url'));
            $this->load->library('validation');
            
            $rules['customStr'] = "required|customise_string";
            $this->validation->set_rules($rules);
            
            $fields['customStr'] = "Customised String";
            $this->validation->set_fields($fields);
            
            $this->validation->run();
            $this->load->view('content/customiseStr_view' );
    }
and the view is:
Code:
<html>
<head>
<title></title>
</head>
<body>

<?=$this->validation->error_string; ?>
<?=form_open    ('content/customiseStr' );?>
<?php
$customStr_value = ($this->validation->customStr == '') ? "String not yet entered" : $this->validation->customStr;
?>
<h5>Custom String:</h5>
&lt;?=form_input   ('customStr', $customStr_value)?&gt;
&lt;?=form_submit('submit', 'Customise')?&gt;
&lt;?=form_close()?&gt;

&lt;/body&gt;
&lt;/html&gt;

All looks very simple and as if it should work. Note the form simply submits to itself, then puts the modified string if available into the text input box. If I change customise_string to xss_clean in the $rules['customStr'] definition then works exactly how expected. i.e. on submit the string is xss_clean'ed then returned to the form and displayed in the text input box.

When the customise_string function is called in the MY_Validation class, I have been able to determine that before the $_POST variable is changed it equals the correct posted value, i.e. inputed string. But after is changed it equals null.

Is the problem that I need to treat the global $_POST in a special way when modifying it? Or is my code wrong in some other way?

Many thanks in advance.

Eddie


  URI - Passing text
Posted by: El Forum - 08-22-2007, 06:05 AM - No Replies

[eluser]Kemik[/eluser]
Hello,

Is it possible to pass text via the URI?

E.g.

http://www.domain.com/index.php/game/comps/r6v

game = controller
comps = function
r6v = text trying to pass

I've been able to pass numeric values but whenever I try text I get the variable = 0.

E.g.

Code:
$game_id = $this->uri->segment(3, 0);
        
if ($game_id == 0) {
   show_error('No Game ID passed');
}
        
echo $game_id;

It always says No Game ID passed. If I remove that show_error I still get 0.

At first I thought it was just because I had put it inside the index() function with segment(2, 0) but then when I moved it to it's own function I still get 0.


  access main directory, how?
Posted by: El Forum - 08-22-2007, 04:01 AM - No Replies

[eluser]snaggy[/eluser]
Here's my problem: in my view file to import for example css I write

http://www.mysite.com/themes/my_theme/cs...s_file.css

but it should be enough this

/themes/my_theme/css/my_css_file.css

still it doesn't work, not even in JS or images or whatever else. I have no .htaccess file.

what could be causing this?


another question, I'd like to put my view file (actually through the parser) in the theme directory, or at least create a view file that loads the current theme from that directory. How can this be done? My goal is to create a simple way to add/change theme to the site


bye


  Question about partials
Posted by: El Forum - 08-22-2007, 01:12 AM - No Replies

[eluser]emperius[/eluser]
I have some code that I need to use in few layouts.

Is there something like render partial in codeigniter?


  error: Do not recognize Prototype.js library, or any othr .js file
Posted by: El Forum - 08-21-2007, 10:03 PM - No Replies

[eluser]Unknown[/eluser]
Im doing an Ajax app, and Im using the Prototype library (in JavaScript) to comunicate with the server. When I include this library in my PHP pages, which are in the View folder of the framework(Codeigniter), I get a message saying that the functions in that library are not recognized, and the same happens with my custom .js libraries.
My question is, What changes do I have to do to the framework to fix this error?
Im adding my libraries in the same folder my pages are (the View folder, inside Application folder).


Plz someone cast some light on this subject. Thx.


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
Changing Session cookie -...
by codeus
5 hours ago
hot-reload side effects s...
by PaulC
Today, 02:44 AM
using app/Config/App.php ...
by sam547
Yesterday, 03:04 PM
Setting baseURL in Regist...
by grimpirate
05-15-2025, 02:20 PM
CRUD Code Generator
by DeanE10
05-15-2025, 05:31 AM
CodeIgniter.com - Report ...
by Harry Lyre
05-14-2025, 04:26 AM
Missing closing bracket w...
by abf
05-13-2025, 07:27 PM
Update from 4.6.0 to 4.6....
by FlavioSuar
05-13-2025, 04:17 AM
Sessions old files are de...
by InsiteFX
05-12-2025, 10:30 PM
Ajax post failing with Ty...
by PaulC
05-12-2025, 12:23 AM

Forum Statistics
» Members: 146,588
» Latest member: 889aco
» Forum threads: 78,392
» Forum posts: 379,465

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB