How to load File.php to Index on Codeigniter

Share on :
We previously have discussed about how to use codeigniter Easily. Now we will discuss about syantax php to load the php files into the mainpage. I'll explain a little bit the function of codeigniter. codeigniter useful to allow users to build a website with php files. One of the function codeigniter is a load php files on directory "view" into mainpage or we can say index.php. index only do loading conten from directory "view" so when index.php is executed on browser. it just refreshes  content with no background. so any profits faster loading due to load only on the content. Least one function that I know of codeigniter. back to the php syntax to load the main page or index. php syntax please see below


See the following Code here :
<?php if (!empty($page)): ?> <?php $this->load->view($page); ?> <?php else: ?> <?php $this->load->view('error_page'); ?> <?php endif; ?>

Explanation of the above code is as follows :

syntax "page" is useful to give the declaration on the directory "controllers" then please create a file with a name error_page.php to refine the code above
  • You should put it on a page of content that you created in index.php. Please see the picture below 


Then please go to the directory controller. as did the declaration of the previous article I explained how to use codeigniter Easily to set of  declaration.

0 comments on How to load File.php to Index on Codeigniter :

Post a Comment and Don't Spam!

 
Protected by Copyscape Duplicate Content Software
Related Posts Plugin for WordPress, Blogger...