codeigniter-helpers

CodeIgniter helper in the view

怎甘沉沦 提交于 2019-12-23 09:19:30
问题 Is it a good workaround and would it be possible to use helper classes in the view, in CodeIgniter. I have a situation when I have to extract with regulars expression from a text couple of strings and generate outputs on matches. I would not like to do this directly in the view and I would like to use for this purpose a helper. application --view ---myview.php and here I should call the helper and return results for example I want to extract from the text the type of processor, than I pass

Codeigniter: user defined helper function does not load

浪尽此生 提交于 2019-12-23 03:59:09
问题 I made a custom helper extending the system string_helper.php. I placed it in my /application/helpers directory, called it MY_string_helper.php as required, unit-tested its functions. Now, when I try to call one of its functions from a model, it does not work. The functions in the default string helper work, instead. It looks like my extension is not loaded for some reasons. Thanks a lot, and happy holidays. Edit: even funnier. I saved the file as categories_helper.php in the system/helpers

Should I extend Controller or Create Helper?

痴心易碎 提交于 2019-12-12 04:58:56
问题 I need to access some functions in multiple controllers in a CodeIgniter application. At the moments the functions are really basic and a few, For example: generate_random_key() //just a random string is_logged() //check if user is logged or not logged_user_only() //if unlogged, redirect unlogged_user_only() //if logged, redirect As these functions are related to login, I can either put them in a helper file and place in Application/helpers/login_helper.php OR i can extend the CI_Controller,

CodeIgniter: Create new helper?

柔情痞子 提交于 2019-11-26 02:40:21
问题 I need to loop lot of arrays in different ways and display it in a page. The arrays are generated by a module class. I know that its better not to include functions on \'views\' and I want to know where to insert the functions file. I know I can \'extend\' the helpers, but I don\'t want to extend a helper. I want to kind of create a helper with my loop functions.. Lets call it loops_helper.php 回答1: A CodeIgniter helper is a PHP file with multiple functions. It is not a class Create a file and