Codeigniter Code Tricks:
1) There is an optional second parameter in $this->uri->segment()
We can find second parameter in a url by this code
$robot = $this->uri->segment(3);
There is an optional second parameter that permits you to set your own default value if the segment is missing.
$robot = $this->uri->segment(3, 'calculon');
2) Any library can have a configuration file
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp1.mailserver.ca';
$config['smtp_user'] = 'username';
$config['smtp_pass'] = 'password';
$config['smtp_port'] = '25';
3) View’s can be returned as data with a third parameter
$page = $this->load->view('view', $data, TRUE);$pdf = build_pdf($page);
// OR
$this->load->helper('download');$view_data = $this->load->view('xml_template', $data, TRUE);
force_download($data['page_title'].'.xml', $view_data);
1) There is an optional second parameter in $this->uri->segment()
We can find second parameter in a url by this code
$robot = $this->uri->segment(3);
There is an optional second parameter that permits you to set your own default value if the segment is missing.
$robot = $this->uri->segment(3, 'calculon');
2) Any library can have a configuration file
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp1.mailserver.ca';
$config['smtp_user'] = 'username';
$config['smtp_pass'] = 'password';
$config['smtp_port'] = '25';
3) View’s can be returned as data with a third parameter
$page = $this->load->view('view', $data, TRUE);$pdf = build_pdf($page);
// OR
$this->load->helper('download');$view_data = $this->load->view('xml_template', $data, TRUE);
force_download($data['page_title'].'.xml', $view_data);
No comments:
Post a Comment