Welcome Guest, Not a member yet? Register   Sign In
Why i need to put evrything in a index function
#1

[eluser]Achmed1[/eluser]
Hi all.

I got a question i want to build example a blog or something. Why i can't example put it in a order of functions example one functions validates the form one functions add something to the database. Why i need always to put evrything in a index function is it not possible to do something like this example in order.

Code:
<?php
class Register extends CI_Controller {

    function register()
    {
        Some functions
                
    }

    
    public function index()
    {
        view code here
    }
public function validate()
    {
        validate code here
    }

public function othercode()
    {
        other code
    }
public function here all the functions togetter()
    {
        here all the functions together in one page
    }



  

}
?>
#2

[eluser]darrentaytay[/eluser]
You can make as many functions as you like and call them using:

Code:
$this->validate();
$this->othercode();

etc.
#3

[eluser]Achmed1[/eluser]
[quote author="darrentaytay" date="1306003957"]You can make as many functions as you like and call them using:

Code:
$this->validate();
$this->othercode();

etc.[/quote]

Thanks for the info, But example i got a form with <?php echo form_open('index.php/register/validation'); ?> i need to put all the fucntions in the validation function ?
#4

[eluser]4ever[/eluser]
You can call a function hello by example c:/localhost/ci/site/hello or index function in class site:
c:/localhost/ci/site
#5

[eluser]ramm[/eluser]
[quote author="Achmed1" date="1306004746"]Thanks for the info, But example i got a form with <?php echo form_open('index.php/register/validation'); ?> i need to put all the fucntions in the validation function ?[/quote]

Yes, for that example you will have a controller called "register.php" with a function called "validation".

It is everything here: http://ellislab.com/codeigniter/user-guide/




Theme © iAndrew 2016 - Forum software by © MyBB