• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How i can executed my controller in the url


i have choosing today the way to coding with CodeIgniter. So i'm a newbie in frameworks, but the framework looks not so hard. I have tried the first Tutorial "static page". Now if i want to call the site in the url i get everytime the error, that this site doesn't exist. I don't know why this is. 

A url looks after the tutorialsite so : /[controller-method]/[arguments]http://example.com/[controller-class]/[controller-method]/[arguments]

I executed all at xampp local. And if i executed it like this i get everytime the error.

My Path to the framework folder is this :http://localhost/php/frameworks/codeigniter/
Now if i want to executing my controller with the method the url must be like this: http://localhost/php/frameworks/codeigniter/pages/view

But if i load this url i get everytime the error, that this object can't get found.

The Code is:

PHP Code:

class Pages extends CI_Controller{

    public function 
view($page 'header'){

// APPPATH = application folder

if(!file_exists(APPPATH "views/templates/" $page ".php")){
show_404(); // ->shows 404 error site

$data = [];

$data["title"] = ucfirst($page); // ucfirst sorgt dafür das der erste buchstabe ein Großbuchstabe ist

        //seite laden/aufrufen


My 2 view-datas looks so:

PHP Code:
<!DOCTYPE html>
title><? echo $title?></title>
            <p>Titel dieser Seite lautet <? echo $title?></p> 

PHP Code:
        <p>copyright @stef</p>


Hope you can help me.


I have solved id. The problem was the missing routes.

Did you setup your base_url in the config.php file?
Did you setup your routes in the routes.php file?
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.