- default layout uses the new cssTag and charsetTag

- default set of routes no longer routes all unknown requests to Pages controller (/pages/* is used now for that)
- Pages::index is used as default home, I'll try to make it read all the controllers and methods and present them as a website menu
- added tag definitions for cssTag and charsetTag
- extended NeatArray class with some more methods
- DbFactory auto-loads database configuration
- missing error message added (for no action set)
- /logs directory added (at least, I hope)

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@165 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
pies 2005-05-23 23:08:43 +00:00
parent 8e0af6609a
commit 1f8dd75a34
11 changed files with 102 additions and 8 deletions

View file

@ -2,8 +2,8 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
<head>
<title><?=$title_for_layout?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="<?=$BASE?>/css/default.css" />
<?=$this->charsetTag('UTF-8')?>
<?=$this->cssTag('default')?>
</head>
<body>

View file

@ -48,6 +48,6 @@ $Route->connect ('/test', array('controller'=>'Tests', 'action'=>'test_all'));
* Now we connect the rest of Pages controller's urls
* This needs to be the last one, as it takes in any and all remaining urls
*/
$Route->connect ('/*', array('controller'=>'Pages', 'action'=>'view'));
$Route->connect ('/pages/*', array('controller'=>'Pages', 'action'=>'view'));
?>

View file

@ -44,4 +44,9 @@ $Route->connect ('/', array('controller'=>'Pages', 'action'=>'index'));
*/
$Route->connect ('/test', array('controller'=>'Tests', 'action'=>'test_all'));
/**
* Now we connect the rest of Pages controller's urls
* This needs to be the last one, as it takes in any and all remaining urls
*/
$Route->connect ('/pages/*', array('controller'=>'Pages', 'action'=>'view'));
?>

View file

@ -125,4 +125,14 @@ define('TAG_TABLE_CELL', '<td%s>%s</td>');
*/
define('TAG_TABLE_ROW', '<tr%s>%s</tr>');
/**
* Tag template for a CSS meta-tag.
*/
define('TAG_CSS', '<link rel="%s" type="text/css" href="%s" />');
/**
* Tag template for a charset meta-tag.
*/
define('TAG_CHARSET', '<meta http-equiv="Content-Type" content="text/html; charset=%s" />');
?>

View file

@ -238,7 +238,7 @@ class NeatArray {
* @access public
* @uses NeatArray::value
*/
function NeatArray ($value) {
function NeatArray ($value=array()) {
$this->value = $value;
}
@ -277,6 +277,73 @@ class NeatArray {
}
$this->value = $out;
}
/**
* Adds elements from the supplied array to itself.
*
* @param string $array
* @return bool
* @access public
* @uses NeatArray::value
*/
function add ($value) {
return ($this->value = $this->plus($value))? true: false;
}
/**
* Returns itself merged with supplied array.
*
* @param string $array
* @return array
* @access public
* @uses NeatArray::value
*/
function plus ($value) {
return array_merge($this->value, (is_array($value)? $value: array($value)));
}
/**
* Counts repeating words.
*
* @param int $sortedBy 1 sorts by values, 2 by keys, default null (no sort)
* @return array
* @access public
* @uses NeatArray::value
*/
function totals ($sortedBy=1,$reverse=true) {
$out = array();
foreach ($this->value as $val)
isset($out[$val])? $out[$val]++: $out[$val] = 1;
if ($sortedBy == 1) {
$reverse? arsort($out, SORT_NUMERIC): asort($out, SORT_NUMERIC);
}
if ($sortedBy == 2) {
$reverse? krsort($out, SORT_STRING): ksort($out, SORT_STRING);
}
return $out;
}
function filter ($with) {
return $this->value = array_filter($this->value, $with);
}
/**
* Passes each of it's values thrue a specified function or method.
*
* @return array
* @access public
* @uses NeatArray::value
*/
function walk ($with) {
array_walk($this->value, $with);
return $this->value;
}
}
?>

View file

@ -325,7 +325,7 @@ class DBO extends Object {
}
/**
* Enter description here...
* Checks if it's connected to the database
*
* @return unknown
*/
@ -334,7 +334,7 @@ class DBO extends Object {
}
/**
* Enter description here...
* Prepares an array of data values by quoting them etc.
*
* @return unknown
*/

View file

@ -33,6 +33,7 @@
*
*/
uses('object');
config('database');
/**
* Enter description here...

View file

@ -41,6 +41,12 @@ define ('ERROR_UNKNOWN_DATABASE_DRIVER', '[DbFactory] Specified database driver
*/
define ('ERROR_NO_CONTROLLER_SET', '[Dispatcher] No default controller, can\'t continue, check routes config');
/**
* Enter description here...
*
*/
define ('ERROR_NO_ACTION_SET', '[Dispatcher] No default action, can\'t continue, check routes config');
/**
* Enter description here...
*

View file

@ -78,9 +78,12 @@ class Flay extends Object {
* @param unknown_type $text
* @return unknown
*/
function toHtml ($text=null) {
function toHtml ($text=null, $stripTags=false) {
$text = $text? $text: $this->text;
if ($stripTags)
$text = strip_tags($text);
// trim whitespace and disable all HTML
$text = str_replace('<', '&lt;', str_replace('>', '&gt;', trim($text)));

View file

@ -263,12 +263,14 @@ class Model extends Object {
}
/**
* Enter description here...
* Reads table info (column names and types) from the db
*
* @return array
*/
function loadInfo () {
if (empty($this->_table_info))
$this->_table_info = new NeatArray($this->db->fields($this->table));
return $this->_table_info;
}
/**

0
logs/put_logs_here Normal file
View file