Wenn $this->numberOfRows gerade ist, wird die if Anweisung durchgeführt:
$delimiter = 1;
if( $this->numbersOfRow & 1 )
{
$delimiter = 2;
}
Wenn $this->numberOfRows gerade ist, wird die if Anweisung durchgeführt:
$delimiter = 1;
if( $this->numbersOfRow & 1 )
{
$delimiter = 2;
}
find . -type d -name .svn |xargs rm -rf
echo "flush_all" | nc localhost 11211
Dieser Code kommt in das app_model.php
/**
* Get Enum Values
* Snippet v0.1.3
* http://cakeforge.org/snippet/detail.php?type=snippet&id=112
*
* Gets the enum values for MySQL 4 and 5 to use in selectTag()
*/
function getEnumValues($columnName=null, $respectDefault=false) {
if ($columnName==null) { return array(); } //no field specified
//Get the name of the table
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$tableName = $db->fullTableName($this, false);
//Get the values for the specified column (database and version specific, needs testing)
$result = $this->query("SHOW COLUMNS FROM {$tableName} LIKE '{$columnName}'");
//figure out where in the result our Types are (this varies between mysql versions)
$types = null;
if ( isset( $result[0]['COLUMNS']['Type'] ) ) { $types = $result[0]['COLUMNS']['Type']; $default = $result[0]['COLUMNS']['Default']; } //MySQL 5
elseif ( isset( $result[0][0]['Type'] ) ) { $types = $result[0][0]['Type']; $default = $result[0][0]['Default']; } //MySQL 4
else { return array(); } //types return not accounted for
//Get the values
$values = explode("','", preg_replace("/(enum)\('(.+?)'\)/","\\2", $types) );
if($respectDefault){
$assoc_values = array("$default"=>Inflector::humanize($default));
foreach ( $values as $value ) {
if($value==$default){ continue; }
$assoc_values[$value] = Inflector::humanize($value);
}
}
else{
$assoc_values = array();
foreach ( $values as $value ) {
$assoc_values[$value] = Inflector::humanize($value);
}
}
return $assoc_values;
} //end getEnumValues
In dem Controller holt man sich die Werte dann so:
$this->set('value', $this->Model->getEnumValues('field'));
und in der View kommt das hinein:
echo $form->input('value', array('options' => $kind, 'label' => 'value:'));
function getNewest( $limit = 50 ) {
$data = $this->find('all',
array(
'order' => $this->name .'.id DESC',
'limit' => $limit)
);
return $data;
}
![]() |
People in Palestine are trapped inside a Wall. “We are human beings, just like you, with a sense of humour, and lust for life”.The text on the image is inside the wall. No Photoshop. |
gefunden auf: http://flowplayer.org/tools/release-notes/
nuts and bolts hat eine Liste mit einigen Tipps zu CakePHP zusammengestellt.
zu den Cake Tipps
function process_url( $url ) {
$processed_url = parse_url( $url );
$query_string = $processed_url[ 'query' ];
$query_string = explode( '&', $query_string );
$args = array( ); // return array
foreach( $query_string as $chunk ) {
$chunk = explode( '=', $chunk );
if ( count( $chunk ) == 2 ) {
list( $key, $val ) = $chunk;
$args[ $key ] = urldecode( $val );
}
}
return $args;
}
$url = 'http://maps.google.de/maps?f=q&source=s_q&hl=de&geocode=&q=tiergarten,+berlin&sll=52.485699,13.348826&sspn=0.020071,0.045404&ie=UTF8&hq=&hnear=Tiergarten+Berlin&z=14';
$result = process_url( $url );
print_r( $result );
Auf der Seite von switchonthecode wird in einem Tutorial beschrieben wie die Pagination von cakePHP eingesetzt werden kann.