Skip to main content

Posts

Codeigniter php frameworks: views part 3

codeIgniter Codeigniter php frameworks will be start to views part 3, if you haven’t read the , please read it before. In part 3, we will be teaching you about Storing Views within Sub-folders and Adding Dynamic Data to the view . Firstly is Storing Views within Sub-folders , your view files can also be stored within sub-folders if you prefer that type of organization. When doing so you will need to include the folder name loading the view, like this $this->load->view(' folder_name/file_name '); . Now let’s change our learning to Adding Dynamic Data to the View . Data is passed from the controller to the view by way of an array or an object in the second parameter of the view loading function. Codeigniter php frameworks have example using an array. So you can copy it to your controller file with your text editor. using array variables. using object variables. FYI, if you use an object, the class variables will be returned into array elements....

Codeigniter php frameworks: installation codeigniter part 1

codeIgniter Codeigniter php frameworks  is back. I think, I must show you how to install codeigniter in your server, Or you can see at user guide codeigniter. First, download the latest version codeigniter from codeigniter.com , the same steps as I told in previous post . After that unzip the package, and upload the codeigniter folders and files to your server. Normaly the index.php file will be at your root. After that open the application/config/config.php file with your own text editor and set your base URL. If you intend to use encryption or sessions, set your encryption key. Keep in mind that the steps described by Codigniter php frameworks is references from http://codeigniter.com/user_guide/ . In the first paragraph you know how to install it, in the second paragraph Codeigniter php frameworks will be show you how to set the base url to automatically, you just have to change this variable $config[‘base_url’] at config.php file into this text bellow: $conf...

Codeigniter php frameworks: codeigniter URLs part 2

codeIgniter Codeigniter php frameworks will be next to part two of codeigniter URLs. If you have not read the part one of codeigniter URLs, please follow this link to read it. Okay back to the lesson, now we talk about Adding a URL suffix. To active it you can find this configuration at config/config.php , you can specify that will be added to all URLs generated by codeigniter. for example, if the URL is example.com/index.php/products/view/shoes , you can optionally add a suffix, like .asp , making the page appear to be of a certain type like this example.com/index.php/products/view/shoes.asp . And the last lesson of codeigniter URLs is Enabling Query Strings, in some cases you might prefer to use query strings URLs like this index.php?c=products&m=view&id=345 . Codeigniter optionally supports this capability, which can be enabled in your application/config.php file. Codeigniter php frameworks will be show you the config file preview. The preview will be like th...

Codeigniter php frameworks: codeigniter URLs part 1

codeIgniter Codeigniter php frameworks will teach you about codeigniter URLs. If you not understand about installing codeigniter, please follow the previous post . The codeigniter URLs feature is designed to be search engine and human friendly. For the example is example.com/ news / article / my_article . Firstly is URI Segment, the segment in the URL is following with the Model-View-Controller(MVC). And for the structure  is example.com/ class / function / ID . Class is the first segment represents the controller class that should be invoke. Function is the second segment represents the class function, or method, that should be called. And ID is the third, and any additional segment, represents  the ID and any variables that will be passed to the controller. For the second learn about codeigniter URLs is How to removing the index.php. what is index.php? index.php is the main file to default appear to your URL. The actually codeigniter URL is example.com/ index....

Codeigniter php frameworks: controllers part 7

codeIgniter Codeigniter php frameworks , we will continue the next part or the last part of controllers, now is part number 7, didn’t read the part 6, please read these part first. In the part 7 we will learn about class constructors , if you intend to use a constructor in any of your controllers, you must place the following line of code like this parent::__construct(); .The reason this line is necessary is because your local constructor will be overriding the one in the parent controller class so we need to manually call it. <?php class Blog extends CI_Controller {        public function __construct() {              parent::__construct();             // Your own constructor code        } } ?> Constructors are useful if you need to set some default values, or run a default process w...

Codeigniter php frameworks: controllers part 6

Codeigniter php frameworks is back, now we going to learn controllers part 6, about private function and organizing your controllers into sub-folders . If you not have read the previous part , please read it before read this post. Okay about private function , in some cases you may want certain functions hidden from public access. To make a function private, simply add an underscore as the name prefix and it will not be served via a URL request. For example, if you were to have a function like this. private function _utility() {   // some code } Trying to access it via the URL, like this example.com/index.php/blog/_utility/ will not work. Now Codeigniter php frameworks talk about organizing your controllers into sub-folders, if you are building a large application you might find it convenient to organize your controllers into sub-folders. Codeigniter permits you to do this. Simply create folders within your application/controllers directory and place your control...

Codeigniter php frameworks: controllers part 5

odeigniter php frameworks will be learn about processing output of controllers in the title of “Codeigniter php frameworks: controllers part 5”. I think you must follow previous part of controllers to know about codeigniter controllers. We have learn about controller in the part 1 , 2 , 3 , and 4 .  I suggest you to read these part before you read this part. Now let’s go to the lesson of part 5. Processing output , codeigniter has an output class that takes care of sending your final rendered data to the web browser automatically. More information on this can be found in the View and Output Class in the next lesson of Codeigniter php frameworks .   In some cases, however, you might want to post-process the finalized data in some way and send it to the browser yourself. Codeigniter permits you to add a function named _output() to your controller that will receive the finalized output data. For important information, if your controller contains a function named _out...