What is this helper do? |
[eluser]solid9[/eluser]
Hi guys I just got the codes from this link below, http://codeigniter.com/wiki/Add_Edit_Views The helper codes, Code: function field($validation, $database = NULL, $last = ''){ Let me try to guess. If $validation is set then do nothing else if $database is not set do $last. What is the use of $database if it is already auto-loaded? And what the hell is $last do? So in you opinion what does the codes do? Thanks in advanced.
[eluser]mrahsanahmad[/eluser]
Every thing works fine. However if I change now() (function of date helper) in the last line to : Code: anchor(some address,some string); which is a function of html helper, I get error Call to undefined function anchor() Code: $this->CI->html->anchor(some address,some string) Code: $this->CI->date->now I have been trying to solve this for hours now. First, I dont understand why should now() function work without the following prefix Code: $this->CI->date to use any library function, I always use the following and this always works Code: $this->CI->load->library(myLibrary); Qs1. Why does helper function such as now() (from date helper) does not require a prefix Qs2. Assuming that helper functions do not require a prefix, why does this fails in the case of html... Please guide me so I can move on ![]()
[eluser]solid9[/eluser]
@mrahsanahmad These codes are like black hole. If some one will try to play with it, they will be trap LOL ha ha ha I don't understand why they put codes like this in the WIKI if it don't work at all. I guess the codes are very old, it doesn't work any more in the latest version of CI.
[eluser]InsiteFX[/eluser]
NOTE: This is using the old CI Validation Library and all $validation will need to be changed to $form_validation etc! anchor is not an html helper it is in the url helper! Helpers are global to CI
[eluser]solid9[/eluser]
Okay I updated everything to match the latest version of CI. But when I try to run the script it echo the field helper why it echo the field helper? Code: function field($form_validation, $database = NULL, $last = ''){ $value = (isset($form_validation)) ? $form_validation : ((isset($database)) ? $database : $last); return $value; } Thanks in advanced.
[eluser]solid9[/eluser]
Okay it's running now. Just fixed the helper Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
[eluser]InsiteFX[/eluser]
It's basically do the same as this in the Form_validation library. Code: <?php echo validation_errors(); ?> |
Welcome Guest, Not a member yet? Register Sign In |