Welcome Guest, Not a member yet? Register   Sign In
  Help Please, Validation Problems..
Posted by: El Forum - 08-26-2007, 09:02 PM - No Replies

[eluser]LifeSteala[/eluser]
Hi, I am almost there with my validation but it doesn't validate at all. This controller is ClientContact, and has a view, which has a form action of clientcontact/process (this is where it does the processing of form after validation. But, it doesn't validate. Any ideas??

Code:
<?php

class ClientContact extends Controller {

    function ClientContact()
    {
        parent::Controller();
        
        // Load URL Helper
        $this->load->helper(array('form', 'url'));
    }
    
    function index()
    {
        // Load Validation
        $this->load->library('validation');

        // Set Rules
        $rules['record_description']    = "required";
        $rules['record_next_action_external']    = "required";
        $this->validation->set_rules($rules);
        
        // Set Fields
        $fields['record_description'] = "Description";
        $fields['record_next_action_external']    = "External";
        $this->validation->set_fields($fields);

        $data['link'] = array('clientcontact' => 'Client Contact','invoices' => 'Invoices');    
        $data['attributes'] = array('id' => 'client_contact', 'name' => 'clientcontactform', );
        
        // Database queries
        $data['clients_query'] = $this->db->get('clients');
        $data['personnel_query'] = $this->db->get('personnel');
        
        $this->db->select('*');
        $this->db->from('record_event');
        $this->db->join('record_area', 'record_area.area_id=record_event.area_id');
        
        $data['event_query'] = $this->db->get();
        if ($this->validation->run() == false)
        {
            $this->validation->error_string = "Wrong";
            $this->load->view('ClientContact', $data);
        }
        else
        {
            $data['message'] = "Successful";
            $this->load->view('Success', $data);
        }

    }
    
    function process()
    {
            $data = array('event_id' => $_POST['event_id'],
                          'client_id' => $_POST['client_id'],
                          'record_description' => addslashes($_POST['record_description']),
                          'record_next_action' => addslashes($_POST['record_next_action']),
                          'record_next_action_due' => $_POST['record_next_action_due'],
                          'record_next_action_internal' => $_POST['record_next_action_internal'],
                          'record_next_action_external' => $_POST['record_next_action_external']);
    
    }
}
?>


  question about directory structure
Posted by: El Forum - 08-26-2007, 06:07 PM - No Replies

[eluser]杨帅[/eluser]
hi everyone, I'm new to codeigniter, but i found it very interesting. i wanna move my application to codeigniter. now i have a question, where should i put my css js and image files? i think i should make folders such as styles scripts or images under the system/application/views folder, right?
most appreciative of every advice.


  Calling controller's action from a hook
Posted by: El Forum - 08-26-2007, 04:07 PM - No Replies

[eluser]Unknown[/eluser]
I have written a hook, that makes layouts for me, but I've to take some data from others controllers than I'm execute right now. According another thread on the forum in the hook I've got:

Code:
include_once(BASEPATH.'application/controllers/nameOfController.php');
$controller=new $nameOfController();
$controller->action();

It's working unless I'd like to call a model, and execute a query.

In controler's action, that I'd like to call i've got:

Code:
$CI=get_instance();
$CI->load->model('someModel');
$someData=$CI->someModel->getSomeData($someId);
return $CI->load->view($someId,$items,true);

In model I've got very simple code:

Code:
$this->db->query('set names utf8;');
$someDataResource=$this->db->query("
select * from articles;
        ");
return $someDataResource->result_array();

I get an error that I don't have atribute db.

When I call the controller and action by URI it works.

I think, that the problem is initialization of controller, but I don't have any idea how to solve the problem.


  Extending core: Retrieval of config values does not work
Posted by: El Forum - 08-26-2007, 12:36 PM - No Replies

[eluser]Martin Penev[/eluser]
Hi guys,

I'am extending the language core script by using the attached script. And for some functions, I need to use some config values (stored in the config.php).

Somehow I just cannot use any CI objects and functions and I won't know why. How or what do I need to write in order to use CI's functions and config values?

Code:
<?php

class MY_Language extends CI_Language
{

    function My_Language()
    {
        parent::CI_Language();    
        $CI =& get_instance(); //<--- is this right?
    }
    
    function checkLanguageCookie()
    {
        //what code to retrieve a config value?
    }
    
    
}

?&gt;


  Open source CI applications?
Posted by: El Forum - 08-26-2007, 11:50 AM - No Replies

[eluser]feri_soft[/eluser]
Are there any open source code igniter applications so i can have a look at them for easier learning. Thanks!


  How to detect a Ajax request?
Posted by: El Forum - 08-26-2007, 10:19 AM - No Replies

[eluser]camille roux[/eluser]
Hello,

I'd like to use Ajax (surely Mootools) on my website, so I need a function to detect whether a request is from Ajax or not, because I want not to send the same data in each case.
Do you know how to do that?

Thank you


  strange rendering problem
Posted by: El Forum - 08-26-2007, 09:36 AM - No Replies

[eluser]Unknown[/eluser]
Hello everyone, Undecided

I'm having a strange issue with my code igniter installation. First of all, i'm not sure exactly what is good debugging information is relevent to this issue, so i'm gonna tell you what i know!, i'll start with my platform, i'm using a mac where i'm running apache 1.3, mysql 5.0.24, php5.2.2.

Now, i have multiple installations of CI since i'm trying many different settings/plugins side by side. The way i'm doing this is by using this as a Vhost:

<Directory "/Users/me/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

and having many dirs as such,

/Users/me/Sites/config1
/Users/me/Sites/config2
/Users/me/Sites/config3

Which would mean my different sites would be.

httpd://127.0.0.1/config1
httpd://127.0.0.1/config2
httpd://127.0.0.1/config3

Okay, so far so good?!!!!,

It seems that my code igniter is not rendering ANYTHING with alternative php syntax, i have this as my page title
&lt;?=$html_title?&gt;
and this in my username password feilds.
&lt;?=$user_name?&gt;
&lt;?=$password?&gt;

Also here is my log file,
[Sun Aug 26 08:43:54 2007] [error] [client 127.0.0.1] File does not exist: /Users/me/Sites/conf1/<
[Sun Aug 26 09:04:55 2007] [error] [client 127.0.0.1] File does not exist: /Users/me/Sites/conf1/<
[Sun Aug 26 09:11:06 2007] [error] [client 127.0.0.1] File does not exist: /Users/me/Sites/conf1/<

it seems like a bad php/apache configuration of somesort!!!!!!!, any stab at what it could be? :coolhmm:


  Stupid question about include()
Posted by: El Forum - 08-26-2007, 08:57 AM - No Replies

[eluser]Phoenixheart[/eluser]
(Sorry, but I am new to CI)
Assuming I have a controller at projects.php, in which I have GetProjects() function. Also I have a view called projects_view.php.
I wanted to call GetProjects() along with the view. So in projects_view.php I put this code:

Code:
// my HTML here
&lt;?php
    include('index.php/projects/GetProjects');
?&gt;
// my HTML here
But I received this error:
Code:
Message: include(index.php/projects/GetProjects) [function.include]: failed to open stream: No such file or directory
Does it mean we can't use php's include() with CI's URI? Or am I doing something wrong?
Thanks in advance!


  Drop Down Menus & Validation
Posted by: El Forum - 08-26-2007, 08:39 AM - No Replies

[eluser]Kemik[/eluser]
Hello,

How is the best way of protecting data from being submitted using a drop down menu? I posted my site to be tested on PHP Freaks and found that by saving the source of files, they could edit the drop down menu values and then using their new html file to submit any value they liked using my drop down fields.

Could I just use normal rules like I do with text fields?


  Calling Model Function in the View
Posted by: El Forum - 08-26-2007, 07:14 AM - No Replies

[eluser]Gnurpreet[/eluser]
Hi,
Can I call a function from a model to directly into the view? I have loaded it in the controller, but want to call the function in the view only.

Here's the situation...
I have a showing a piece of content in the view, but I have to show the name of the user who posted it (which comes from a different table and thus a different user model ). Now, in the view, I have the ID of the user, but I want to show his username.

This in the view does not work

Code:
echo "Posted by ".$this->User_model->get_username($list->user_id);

I have loaded the view in the controller, but still.

Here is the model code
Code:
class User_model extends Model
{
    function User_model()
    {
        parent::Model();
    }
    
    function get_username($user_id)
    {
        $this->db->where("id", $user_id);
        $user_data = $this->db->get("user");
        return($user_data['username']);        
    }
}

any pointers?


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

Username
  

Password
  





Latest Threads
hot-reload side effects s...
by PaulC
16 minutes ago
Setting baseURL in Regist...
by grimpirate
Yesterday, 02:20 PM
CRUD Code Generator
by DeanE10
Yesterday, 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
intermittent smtp failure...
by InsiteFX
05-11-2025, 11:30 PM
MVC vs MVCS vs CodeIgnite...
by FlavioSuar
05-10-2025, 10:33 AM

Forum Statistics
» Members: 146,349
» Latest member: Superfast Removals
» Forum threads: 78,390
» Forum posts: 379,458

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB