How to create home page in codeigniter
How do I find my homepage in CodeIgniter?
You’d use something like $this->uri->uri_string() to see what the current URL is, and compare that to what your homepage URL woud be (typically an empty string, or “index. php”). Code: if($this->uri->uri_string() == ”) echo ‘This is homepage‘);
How do I add a page in CI?
The first thing in creation of static page is setting up a controller.
- A controller is a class that helps delegate work.
- For this you have to create a file pages. php in CodeIgniter/application/controllers i.e. the path of pages.
- Write the following code inside pages. php file:
How can I add header and footer in PHP?
You don’t need php tags in these files if you just have html. You can do it by using include_once() function in php. Construct a header part in the name of header. php and construct the footer part by footer.
HOW include external php file in codeigniter?
Simply follow the below steps.
- Step 1:- Create a duplicate copy of Codeigniter’s root index.php file and name it as external.php.
- Step 2:- Now open the PHP file of external script from where you want to access the Codeigniter instance.
- Step 3:-
HOW include header file in codeigniter?
Here is how I do that:
- The template library. Create a template. php in your system/applications/libraries/ folder.
- Load the library in you controller(s): $this->load->library(‘template’);
- Create a new template.php file in your system/applications/views folder. The contents of that template.php can be something like this: