bobby
bobby

Reputation: 305

Not able to add a link in code igniter

I am a beginner to Wamp server. I am trying to design a website with project name as "helloall" in netbeans IDE.

In the views folder I have two files layout1.php and layout2.php.

I am trying to call layout2.php from layout1.php in the below style.

 <div id="logo"> <a href="layout2.php" title="layoutishere"><span>LAYOUT2</span></a> </div> 

But I am facing the below error, for which I am not able to find the reason. The requested URL /helloall/layout2.php was not found on this server.

Do I need to change anything in the configuration? I am using all the default configurations.

Upvotes: 0

Views: 93

Answers (1)

Filippo oretti
Filippo oretti

Reputation: 49817

as per Codeigniter standard you have to follow the MVC pattern so:

Model -> Controller ->view

now, assuming you want to visualize layout2.php view you have 2 chances:

1 - load view directly where you need $this->load->view('layout2');

2 - create url function ad hoc kind of www.site.com/layout/layout1 and www.site.com/layout/layout2:

controller layout.php

    class Layout extends CI_Controller {

        function layout1(){
            $this->load->view('layout1');
    }
        function layout2(){
            $this->load->view('layout2');
    }
}

i really suggest you to look at How To Create a Controller in Codeigniter Doc

Upvotes: 3

Related Questions