Fast MVC framework with transparent architecture and adaptive desigh for programmers, who want to create their web project rapidly and cleanly for both desktop and mobile platforms
- MVC
- Multilingual
- Adaptive design
- Desktop and mobile version
- Caching
- High performance
- Friendly URLs
- Easy to use
- Easy to update
- PHP 5.4+
- php_pdo extension (default - sqlite)
- mod_rewrite Apache module
- cache - cached pages
- core - core files, please, do not edit them in your project, later you can update this folder, when new version of framework will be released
- data - data files (database for sqlite and other possible files)
- project - your project files, you can edit this files as you need
- model - files for work with data
- controller - files for processing of user actions
- view - templates for pages
- locale - translations, you can edit whem with Poedit editor, more info about translations
- plugins - plugins
- static - css, js files, images and other static information
- temp - temp files
- Copy files into your web files folder
- Set write access for "cache" and "data" folders
- Edit file
project/config.php(set value ofConfig::$base_url) - Installation completed
- Edit routes:
Config::$routes(see standart routes for example), add needed route - Add controller into
project/controller - Add view into
project/view - If necessery, add model into
project/model
The MIT License (MIT) Copyright (c) 2012 mnv
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Welcome: Github
Add new element into Config::routes (file project\config.php)
'orders' => array(
'pattern' =>'/orders',
'controller' => 'order',
'action' => 'index',
),
Create file project\controller\ordercontroller.php
<?php
namespace IrisPHPFramework;
/**
* Order Controller
*/
class OrderController extends Controller {
/**
* Order list page.
*/
function indexAction() {
$this->login_required();
$class_view = get_final_class_name('View');
$view = $class_view::singleton();
$view->assign('order_list', OrderModel::singleton()->get_list(UserModel::singleton()->login));
$view->set_title(_('My orders'));
$view->render("order", "orders");
}
}
?>
Create file project\model\order.php
<?php
namespace IrisPHPFramework;
/**
* Order Model
*/
class OrderModel {
use Singleton;
protected $msg;
function get_list($client_number)
{
$db = DB::singleton();
$query = $db->get_client_order_list('db', $client_number);
if (!$query) {
$this->msg = $db->get_msg();
return false;
}
// Fetch all results and process the data if the row exists.
$results = $query->fetchAll();
return $results;
}
}
?>
Edit project\index.php
...
require_once(Config::project_path().'/model/order.php');
...
Add new method into DB class (file project\db.php)
public function get_client_order_list($db_name, $client) {
$sql = "
select '11227' as docnum, '2013-01-15' as docdate, 1200 as amount, 'Oil change' as claim
union
select '11122' as docnum, '2013-01-13' as docdate, 3120 as amount, null as claim
union
select '11023' as docnum, '2013-01-12' as docdate, 120.45 as amount, null as claim
";
return $this->run_query($sql, array(), $db_name);
}
Create file project\view\order\orders.html.php
<?php namespace IrisPHPFramework; ?>
<?php
$profile = $user->get_profile_info();
$orders = $view->get('order_list');
?>
<h2><?php echo _('My orders'); ?></h2>
<div class="orders">
<table class="table">
<tr>
<th><?php echo _('Order number'); ?></th>
<th><?php echo _('Date'); ?></th>
<th><?php echo _('Amount'); ?></th>
<th><?php echo _('Claim'); ?></th>
</tr>
<?php foreach ($orders as $order_info) { ?>
<tr>
<td><?php echo $view->escape($order_info['docnum']); ?></td>
<td><?php echo $view->escape($order_info['docdate']); ?></td>
<td><?php echo $view->escape($order_info['amount']); ?></td>
<td><?php echo $view->escape($order_info['claim']); ?></td>
</tr>
<?php } ?>
</table>
</div>
Edit files project\view\site\home-d.html.php and project\view\site\home-m.html.php
...
<li><a href="<?php echo $router->prefix_url(); ?>/orders"><?php echo _('My orders'); ?></a></li>
...

