Category Archives: CODE IGNITER

MYSQL Crosstab Query

CREATE MYSQL TABLE CREATE TABLE `tblProductToy` ( `ID` int(11) NOT NULL auto_increment, `Toy` varchar(32) default NULL, `DateShipped` varchar(10) default NULL, `NumberShipped` int(11) default NULL, PRIMARY KEY (`ID`) ) INSERT THESE DATA insert into tblProductToy (Toy, DateShipped, NumberShipped) values (‘Water Pistol’, … Continue reading

Posted in CODE IGNITER, MYSQL | Leave a comment

How to Show Linux Version

Linux Command: Show Linux Version [a] uname – Print kernel and system information. [b] lsb_release – Print distribution-specific information. [c] /proc/version file – Print running kernel information. How to check linux kernel version number? Open a shell prompt (or a … Continue reading

Posted in CODE IGNITER, LINUX | Leave a comment

DATABASE BASE MENU IN CODEIGNITER!

— — Database name: `dyn_menus` — — Parts of this source code is from PyroCMS — Because I am modifing it to use this new menu — This will also work stand alone with the code below — Like I said this is not finished yet! — — you may use it under the GPL v3 Licence. — ——————————————————– — — Table structure for table `dyn_menu` — DROP TABLE IF EXISTS `dyn_menu`; CREATE TABLE IF NOT EXISTS `dyn_menu` ( `id`                int(11)            NOT NULL    AUTO_INCREMENT, `title`            varchar(100)    NOT NULL    DEFAULT ”, `link_type`        varchar(20)        NOT NULL    DEFAULT ‘uri’, `page_id`            int(11)            NOT NULL    DEFAULT ‘0’, `module_name`        varchar(50)        NOT NULL    DEFAULT ”, `url`                varchar(255)    NOT NULL    DEFAULT ”, `uri`                varchar(255)    NOT NULL    DEFAULT ”, `dyn_group_id`    int(11)            NOT NULL    DEFAULT ‘0’, `position`        int(5)            NOT NULL    DEFAULT ‘0’, `target`            varchar(10)                    DEFAULT NULL, `parent_id`        int(11)            NOT NULL    DEFAULT ‘0’, `is_parent`        tinyint(1)        NOT NULL    DEFAULT ‘0’, `show_menu`        enum(‘0′,’1’)    NOT NULL    DEFAULT ‘1’, PRIMARY KEY (`id`), KEY `dyn_group_id – normal` (`dyn_group_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; — — Dumping data for table `dyn_menu` — INSERT INTO `dyn_menu` (`id`, `title`, `link_type`, `page_id`, `module_name`, `url`, `uri`, `dyn_group_id`, `position`, `target`, `parent_id`, `is_parent`, `show_menu`) VALUES (1,  ‘Category 1’,             ‘page’, 1,  ”, ‘http://www.category1.com’,    ”, 1, 0, ”, 0, 1, ‘1’), (2,  ‘Category 2’,             ‘page’, 2,  ”, ‘http://www.category2.com’,    ”, 1, 0, ”, 0, 0, ‘1’), (3,  ‘Category 3’,             ‘page’, 3,  ”, ‘http://www.category3.com’,    ”, 1, 0, ”, 0, 0, ‘1’), (4,  ‘Category 4’,             ‘page’, 4,  ”, ‘http://www.category4.com’,    ”, 1, 0, ”, 0, 0, ‘1’), (5,  ‘Category 1 – 1’,         ‘page’, 5,  ”, ‘http://www.category11.com’,   ”, 1, 0, ”, 1, 0, ‘1’), … Continue reading

Posted in CODE IGNITER | Leave a comment

ADD ERROR LOG FILE IN CODEIGNITER

Edit your application/config/config.php to enable error logs choose “threshold options 1 to 4” to OFF choose “0”. /* |————————————————————————– | Error Logging Threshold |————————————————————————– | | If you have enabled error logging, you can set an error threshold to | … Continue reading

Posted in CODE IGNITER | Leave a comment

MAKING HOOKS IN CODEIGNITER AND RUN BENCHMARK EVERYPAGE!

/* Location: ./application/config/hooks.php */ <?php if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’); /* | ————————————————————————- | Hooks | ————————————————————————- | This file lets you define “hooks” to extend CI without hacking the core | files. Please see the … Continue reading

Posted in CODE IGNITER | Leave a comment

CREATING A SIMPLE MENU LIBRARY IN CODEIGNITER

MY CLASS: /application/libraries/mymenu.php <?php if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’); class Mymenu { function show_menu(){ $CI = &get_instance(); $CI->load->helper(‘url’); $menu = “<ul>”; $menu .= “<li>”; $menu .= anchor(“books/main”,”List of Books”); $menu .= “</li>”; $menu .= “<li>”; $menu … Continue reading

Posted in CODE IGNITER | Leave a comment

MULTIPLE SUB-FOLDER LINK UP TO 2-3 SUBFOLDER IN CODEIGNITER

put this in your /application/core NAME: MY_Router.php set_directory($segments[0]); $segments = array_slice($segments, 1); /* ———– ADDED CODE ———— */ while(count($segments) > 0 && is_dir(APPPATH.’controllers/’.$this->directory.$segments[0])) { // Set the directory and remove it from the segment array $this->set_directory($this->directory . $segments[0]); $segments = … Continue reading

Posted in CODE IGNITER | Leave a comment