I have to run some condition in every controller |
I have to run some condition in every controller. i have posted my code below. now i use __construct
how can i make it more nicely. now the full code i have to put in every controller but i want to make it other easier way. Please help i am new in codeigniter but nowdays i loving it. i saw codeigniter before 10 years ago but i ignore it because thats time i was new in php. PHP Code: protected $request;
Hi @mostafiz80 and a warm welcome to the forums.
I have similar problems which I resolve by ensuring all Controllers extend BaseController: PHP Code: class C_home extends BaseController In BaseController use the following method: file: ./app/Classes/BaseController PHP Code: public function initController To test try this in your common View/vheader menu or common View/vFooter: PHP Code: echo '<h6>' .$test_001 .'</h6>';
I would recommend you look into Filters: https://codeigniter.com/user_guide/incom...lters.html
Thanks all of you guys for help. i have done using library. i like to use library.
Now i am stuck in Mysql transaction. The mysql LOCK IN SHARE MODE how will work this query if i use codeigniter transaction. i have to do some transaction on my application.
Transaction lock and unlock the tables , what you have to watch for is dead locks.
To fix dead locks use small optimized queries. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |