1
Coding - Application Development / 1.2.3 released
« on: May 03, 2013, 10:34:32 am »
TinyMVC 1.2.3 is released, just a small bug fix.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
<?php
/**
* default.php
*
* default application controller
*
* @package TinyMVC
* @author Monte Ohrt
*/
class Default_Controller extends TinyMVC_Controller
{
function index()
{
// be sure the uri library is autoloaded
$this->__call($this->uri->segment(1),array());
}
function __call($method,$args) {
// create a template path from the path info
// if template exists, display it
$this->load->library('Smarty_Wrapper','smarty');
$tpl_path = $_SERVER['PATH_INFO'];
if(substr($tpl_path,-4) !== '.tpl') {
if(substr($tpl_path,-1)==DS)
$tpl_path .= 'index.tpl';
else
$tpl_path .= '.tpl';
}
if($this->smarty->templateExists($tpl_path)) {
$this->smarty->display($tpl_path);
} else {
$this->smarty->assign('url',$_SERVER['REQUEST_URI']);
$this->smarty->display('error.tpl');
}
}
}
?>
$config['timer'] = true;// set initial time
tmvc::timer('marker1');
// compute stuff here...
// set ending time
tmvc::timer('marker2');
// get the time difference
$mytime = tmvc::timer('marker1','marker2');
/* URL routing, use preg_replace() compatible syntax */
$config['routing']['search'] = array();
$config['routing']['replace'] = array();$config['routing']['search'] = array('!list!');
$config['routing']['replace'] = array('listing');$config['routing']['search'] = array('!/list!');
$config['routing']['replace'] = array('/listing');$config['routing']['search'] = array('!^/groups/(\d+)!');
$config['routing']['replace'] = array('/groups/view/id/${1}');$config['routing']['search'] = array(
'!/list!',
'!^/groups/(\d+)!'
);
$config['routing']['replace'] = array(
'/listing',
'/groups/view/id/${1}'
);
$this->db->select('id,username,email');
$this->db->from('members');
$this->db->where('member_id=1');
$this->db->orwhere('id=?',array($member_id));
$this->db->orwhere('(foo=? or bar=?)',array($foo,$bar));
$this->db->in('status',array('active','inactive'));
$this->db->join('records','members.id=records.member_id','left');
$this->db->groupby('member_id');
$this->db->orderby('username');
$this->db->limit(10);
$this->db->query();
while($row = $this->db->next())
$results[] = $row;helper::debug($var);
helper::redirect('/foo/bar');svn checkout http://tinymvc-php.googlecode.com/svn/trunk/ tinymvc-php-read-only