mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-16 18:53:26 +02:00
First public release of MyAAC
This commit is contained in:
36
system/libs/dwoo/Dwoo/Adapters/CodeIgniter/README
Normal file
36
system/libs/dwoo/Dwoo/Adapters/CodeIgniter/README
Normal file
@@ -0,0 +1,36 @@
|
||||
CodeIgniter/Dwoo adapater
|
||||
-------------------------
|
||||
Integration of Dwoo into Codeigniter (1.7.0 >)
|
||||
|
||||
Links:
|
||||
Dwoo - http://dwoo.org
|
||||
CodeIgniter - http://codeigniter.com
|
||||
|
||||
Installation:
|
||||
1) Extract package into your application directory (i.e. $webroot/application or
|
||||
$webroot/system/application)
|
||||
2) Change the parameters in config/dwootemplate.php
|
||||
3) Create the compile and cache directory you set in your config file in step 2
|
||||
and give it the correct rights (chmod 777 when on *nix)
|
||||
4) Extract/copy the Dwoo package into application/libraries/dwoo
|
||||
5) Browse to : http://[yoururl]/dwoowelcome
|
||||
|
||||
|
||||
Version info
|
||||
1.0.2 [11-03-2009] Fixed a problem with $data attribute (which Dwoo also used)
|
||||
1.0.1 [12-11-2008] Removed some & in the dwootemplate
|
||||
Changed licencse
|
||||
Changed 'output' in 'get' in the dwootemplate (line 122)
|
||||
1.0.0 [11-11-2008] Initial release
|
||||
|
||||
|
||||
Questions/Remarks?
|
||||
mail to: stefan.verstege@newmedia.nl
|
||||
IM me on GTALK: verstege@gmail.com
|
||||
Contact me on the Dwoo forums: stefanv
|
||||
|
||||
---------[ copyright notice ]-----------------------------------------------------------------------
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
|
||||
License http://dwoo.org/LICENSE Modified BSD License
|
@@ -0,0 +1,12 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
// The name of the directory where templates are located.
|
||||
$config['template_dir'] = dirname(FCPATH) . '/../application/views/';
|
||||
|
||||
// The directory where compiled templates are located
|
||||
$config['compileDir'] = dirname(FCPATH) . '/../compile/';
|
||||
|
||||
//This tells Dwoo whether or not to cache the output of the templates to the $cache_dir.
|
||||
$config['caching'] = 0;
|
||||
$config['cacheDir'] = dirname(FCPATH) . '/../cache/';
|
||||
$config['cacheTime'] = 0;
|
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class Dwoowelcome extends Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::Controller();
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
$this->load->library('Dwootemplate');
|
||||
$this->dwootemplate->assign('itshowlate', date('H:i:s'));
|
||||
$this->dwootemplate->display('dwoowelcome.tpl');
|
||||
}
|
||||
}
|
@@ -0,0 +1,172 @@
|
||||
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
require "dwoo/dwooAutoload.php";
|
||||
|
||||
/**
|
||||
* Creates an template interface from Codeigniter to DWOO.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied warranty.
|
||||
* In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
*
|
||||
*
|
||||
* @author Stefan Verstege <stefan.verstege@newmedia.nl>
|
||||
* @copyright Copyright (c) 2008, Stefan Verstege
|
||||
* @license http://dwoo.org/LICENSE Modified BSD License
|
||||
* @link http://www.newmedia.nl/
|
||||
* @version 1.1.0
|
||||
* @date 2009-07-18
|
||||
* @package Dwoo
|
||||
*
|
||||
* @uses the dwoo package from http://dwoo.org
|
||||
*/
|
||||
class Dwootemplate extends Dwoo {
|
||||
protected $dwoo_data = array();
|
||||
|
||||
/**
|
||||
* Constructor for the DwooTemplate engine
|
||||
*
|
||||
*/
|
||||
public function __construct() {
|
||||
// Call parents constructor
|
||||
parent::__construct();
|
||||
|
||||
// Set the config settings
|
||||
$this->initialize();
|
||||
|
||||
// Assign some defaults to dwoo
|
||||
$CI = get_instance();
|
||||
$this->dwoo_data = new Dwoo_Data();
|
||||
$this->dwoo_data->js_files = array();
|
||||
$this->dwoo_data->css_files = array();
|
||||
$this->dwoo_data->CI = $CI;
|
||||
$this->dwoo_data->site_url = $CI->config->site_url(); // so we can get the full path to CI easily
|
||||
$this->dwoo_data->uniqid = uniqid();
|
||||
$this->dwoo_data->timestamp = mktime();
|
||||
|
||||
log_message('debug', "Dwoo Template Class Initialized");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assign data to dwoo data object
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function assign($key, $value) {
|
||||
$this->dwoo_data->$key = $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add Javascript files to template
|
||||
*
|
||||
* @param string $js
|
||||
*/
|
||||
public function add_js($js) {
|
||||
$current = $this->dwoo_data->js_files;
|
||||
$current[] = $js;
|
||||
$this->dwoo_data->js_files = $current;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add Css stylesheets to template
|
||||
*
|
||||
* @param string $css
|
||||
*/
|
||||
public function add_css($css) {
|
||||
$current = $this->dwoo_data->css_files;
|
||||
$current[] = $css;
|
||||
$this->dwoo_data->css_files = $current;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display or return the compiled template
|
||||
* Since we assign the results to the standard CI output module
|
||||
* you can also use the helper from CI in your templates!!
|
||||
*
|
||||
* @param string $sTemplate
|
||||
* @param boolean $return
|
||||
* @return mixed
|
||||
*/
|
||||
public function display($sTemplate, $return = FALSE) {
|
||||
// Start benchmark
|
||||
$CI = get_instance();
|
||||
$CI->benchmark->mark('dwoo_parse_start');
|
||||
|
||||
// Check if file exists
|
||||
if ( !file_exists($this->template_dir . $sTemplate ) ) {
|
||||
$message = sprintf('Template file \'%s\' not found.', $sTemplate);
|
||||
show_error($message);
|
||||
log_message('error', $message);
|
||||
}
|
||||
|
||||
// Create new template
|
||||
$tpl = new Dwoo_Template_File($this->template_dir . $sTemplate);
|
||||
|
||||
// render the template
|
||||
$template = $this->get($tpl, $this->dwoo_data);
|
||||
|
||||
// Finish benchmark
|
||||
$CI->benchmark->mark('dwoo_parse_end');
|
||||
|
||||
// Return results or not ?
|
||||
if ($return == FALSE) {
|
||||
$CI->output->final_output = $template;
|
||||
} else {
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Toggle Codeigniter profiler on/off
|
||||
*
|
||||
*/
|
||||
public function enable_profiler($toggle = TRUE) {
|
||||
$CI = get_instance();
|
||||
$CI->output->enable_profiler($toggle);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set http header
|
||||
*
|
||||
* @example $this->output->set_header("HTTP/1.1 200 OK");
|
||||
* @example $this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_update).' GMT');
|
||||
* @param string $header
|
||||
*/
|
||||
public function set_header($header) {
|
||||
$CI = get_instance();
|
||||
$CI->output->set_header($header);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set status header
|
||||
*
|
||||
* @example $this->output->set_status_header('401');
|
||||
* @example // Sets the header as: Unauthorized
|
||||
* @param string $header
|
||||
*/
|
||||
public function set_status_header($header) {
|
||||
$CI = get_instance();
|
||||
$CI->output->set_status_header($header);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assign the dwootemplate config items to the instance
|
||||
*
|
||||
*/
|
||||
private function initialize() {
|
||||
$CI = get_instance();
|
||||
$CI->config->load('dwootemplate', TRUE);
|
||||
$config = $CI->config->item('dwootemplate');
|
||||
foreach ($config as $key => $val) {
|
||||
$this->$key = $val;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
{extends "page.tpl"}
|
||||
|
||||
{block "title"}
|
||||
Welcome to Dwoo-ed CodeIgniter
|
||||
{/block}
|
||||
|
||||
{block "content"}
|
||||
<h1>Welcome to Dwoo-ed CodeIgniter!</h1>
|
||||
|
||||
<p>The page you are looking at is being generated dynamically by <b>CodeIgniter</b> in combination with the 'Smarty-killer' <b>Dwoo</b> template engine.
|
||||
The page is rendered at {$itshowlate} by the Dwoo_compiler.</p>
|
||||
|
||||
<p>If you would like to edit this page you'll find it located at:</p>
|
||||
<code>application/views/dwoowelcome.tpl</code>
|
||||
|
||||
<p>The corresponding controller for this page is found at:</p>
|
||||
<code>application/controllers/dwoowelcome.php</code>
|
||||
|
||||
<p>The library for Dwoo integration can be found at:</p>
|
||||
<code>application/libraries/Dwootemplate.php</code>
|
||||
|
||||
<p>If you are exploring Dwoo for the very first time, you should start by reading the {anchor uri='http://dwoo.org/' title='Dwoo website'}.</p>
|
||||
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the {anchor uri='http://codeigniter.com/user_guide/' title='User Guide'}.</p>
|
||||
|
||||
<pre>
|
||||
<b>Usage</b>:
|
||||
$this->load->library('Dwootemplate');
|
||||
$this->dwootemplate->assign('test', 'test');
|
||||
$this->dwootemplate->display('dwoowelcome.tpl');
|
||||
</pre>
|
||||
{/block}
|
57
system/libs/dwoo/Dwoo/Adapters/CodeIgniter/views/page.tpl
Normal file
57
system/libs/dwoo/Dwoo/Adapters/CodeIgniter/views/page.tpl
Normal file
@@ -0,0 +1,57 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>{block "title"}Here come the title{/block}</title>
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
body {
|
||||
background-color: #fff;
|
||||
margin: 40px;
|
||||
font-family: Lucida Grande, Verdana, Sans-serif;
|
||||
font-size: 14px;
|
||||
color: #4F5155;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #003399;
|
||||
background-color: transparent;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #444;
|
||||
background-color: transparent;
|
||||
border-bottom: 1px solid #D0D0D0;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin: 24px 0 2px 0;
|
||||
padding: 5px 0 6px 0;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Monaco, Verdana, Sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #D0D0D0;
|
||||
color: #002166;
|
||||
display: block;
|
||||
margin: 14px 0 14px 0;
|
||||
padding: 12px 10px 12px 10px;
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: Monaco, Verdana, Sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #D0D0D0;
|
||||
color: #B9BAA4;
|
||||
display: block;
|
||||
margin: 14px 0 14px 0;
|
||||
padding: 12px 10px 12px 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{block "content"}Here comes the content{/block}
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user