Welcome Guest, Not a member yet? Register   Sign In
Can't call URL controller/function/
#1

[eluser]gregor4711[/eluser]
Hi,
I'm new in CI and I have a problem with the call of functions from my controller.

As I understand I can call functions directly like 'www.my_side/my_controller/myfunction/value1/value2' in firefox direcly. But only the index function as default function from the controller works.
In my setup I can't call the function test directly in firefox as an url, why?

Yes, I set the default controller in route.php and base_url in config file.
I have no .htaccess file

Thanks for any advise
Gregor

#####################


Code:
class Pangaea extends Controller {        
        
    function __construct()
    {
        parent::Controller();        
    }
    
function index()
{
echo '<ul>';
foreach ($_POST as $key=>$value)
{
    $cleanVal = $this->input->post($key);
    echo "<li>$key = $cleanVal</li>";
}
echo '</ul>';
    
    
    $data['site_title'] = pangaea_lang .pangaea_vers .pangaea_jb;
        
    $this->load->vars($data);
    
    //session id aus DB holen oder setzen
    $session_id = $this->db_session->userdata('session_id');
    
    $this->load->view('login');
        
}
function test()
{
    
    echo '<ul>';
    foreach ($_POST as $key=>$value)
    {
        $cleanVal = $this->input->post($key);
        echo "<li>$key = $cleanVal</li>";
    }
    echo '</ul>';
}
#2

[eluser]pistolPete[/eluser]
Do you get any error message?
Try
www.my_side/index.php/my_controller/myfunction/value1/value2 .
#3

[eluser]gregor4711[/eluser]
Hi pistolPete,
it works, thaks. I forgot the index.php in the url string.

Cheerio
Gregor




Theme © iAndrew 2016 - Forum software by © MyBB