Skip to main content

Posts

Codeigniter php frameworks: controllers part 3

codeIgniter Codeigniter php frameworks  will be go to the part 3 of controllers. You have to read the previous part to follow this post. Okay, now let’s talk about passing URI segments to your function. If your URI contains more than two segments they will be passed to your function as parameter. For the example, let’s say you have a URI like this  example.com/index.php/ products / shoes / sandals / 123 . Your function will be passed URI segments number 3 and 4 (“sandals” and “123”). To easy learning,  Codeigniter php frameworks  will be show you the example of function who have the passing URI segments. <?php class Products extends CI_Controller { public function shoes($sandals, $id) { echo $sandals; echo $id; } } ?> Before closing this part of controllers, I have important things about this feature. If you are using URI Routing (will be discuss in another post) fe...

Codeigniter php frameworks: controllers part 2

codeIgniter Codeigniter php frameworks will be continues the part to of controllers, if you have not read the part 1 of controllers . Please read it before you read this. Now we were learn about functions. In the part 1, we give you the example of simple code right? Now you look these code, and you will se the function name is index(). The “index” function is always loaded by default if the second segment of the URI is empty. Another way to show your “Hello World” message would be like this example.com/index.php/ blog / index / . The second segment of the URI determines which function in the controller gets called. Let’s try it. Codeigniter php frameworks would you to add new function to your controller. If you don’t have any idea to build something, you can follow this code to your controller. <?php class Blog extends CI_Controller {                 public function index() {  ...

Codeigniter php frameworks: controllers part 1

codeIgniter Codeigniter php frameworks , in the previous post we talk about codeigniter URLs . Now, we will learn about controllers. What is controller? Controller is simply a class file that is named in a way that can be associated with a URI. Consider this URI for example, example.com/index.php/ blog / . In that’s example, codeigniter would attempt to find a controller named blog.php and load it. When a controller’s name matches the first segment of a URI, it will be loaded. Now let’s, try to make a simple controller so you can see it in action. Using your text editor, create a file called blog.php . Codeigniter php frameworks has provided the simple code for controller. Please put the following code in it to file blog.php . <?php class Blog extends CI_Controller {                 public function index(){             ...

Codeigniter php frameworks: reserved names

codeIgniter Codeigniter php frameworks in the previous post were talk about controllers until 7 parts. Now I will give your information about Reserved Names in codeigniter. What is “reserved names”? In the order to help out, codeigniter uses a series of function and names in its operation. Because of this, some names cannot be used by a developer. Following is a list of reserved names that cannot be used. The first is Controllers names. Since your controller classes will extends the main application controller you must be careful not to name your functions identically to the ones used by that class, otherwise your local functions will override them. Codeigniter php frameworks have list of reserved names. Do not name your controller any of these: ·          Controller ·          CI_Base ·          _ci_initialize ·      ...

Codeigniter php frameworks: views part 2

codeIgniter Codeigniter php frameworks , in the previous part of Views , we talk about what is Views , and how to creating a view . Now I’m going to teach you about loading a view . To load a particular view file you will use the following function, like this “ $this->load->view(' name '); ”. Where name is the name of your view file. Note: The .php file extension does not need to be specified unless you use something other than .php . Now, open the controller file you made earlier called blog.php , and replace the echo statement with the view loading function: If you visit your site using the using you did earlier you should see your new view. The URL was similar to this, example.com/index.php/ blog / . Codeigniter php frameworks was finished talk about loading a view . Now let’s talk about loading multiple views , codeigniter will intelligently handle multiple calls to $this->load->view from within a controller. If more than call happens they w...

Codeigniter php frameworks: views part 1

codeIgniter Codeigniter php frameworks, in the previous post is talking about Reserved Names. And now we will teach you about Views . What is “Views”? in codeigniter view is a simply webpage, or a page fragment, like a header, footer, sidebar, etc. In fact, views can flexibly be embedded within other views if you need this type of hierarcy. Views are never called directly, they must be loaded by a controller. Remember that in an MVC framework, the controller acts as the traffic cop, so it is responsible for fetching a particular view. Codeigniter php frameworks , If you have not read the controllers page you should do before continuing. Using the example controller you created in the controller page. Now, let’s try to creating a view . Using your text editor, create a file called blogview.php, and save the file in your application/views/ folder. And put this code into it. Okay, I think enough for views part 1, see you in the part 2 of views, please stay at Codeign...

codeigniter php frameworks

codeIgniter  first step to learn Codeigniter with Codeigniter php frameworks Codeigniter php frameworks is a blog created for discusses and learns about Codeigniter . What is Codeigniter? Codeigniter a powerful PHP framework with a very small footprint, build for php coders who need a simple and elegant toolkit to create full featured web applications. Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task . In this blog, I try to help you understanding about Codeigniter. To follow learning sections in this blog, first you must have a Codeigniter latest package. To find it you do not need to go anywhere, because Codeigniter php frameworks have provide...