Skip to content

Instantly share code, notes, and snippets.

Avatar

CakePHP Italia Tutorial cakephp-tutorial

View GitHub Profile
View redirect.php
<?php
Route::redirect('/articoli/*',
  'http://www.google.it',
  array('status' => 302)
);
View routes.php
<?php
Router::redirect('/articoli/:id',
array(
'controller' => 'posts',
'action' => 'view'
),
array(
'status' => 302,
'persist' => array('id'),
)
View routes.php
<?php
Router::connect('/blog/articoli/:id',
array(
'controller' => 'posts',
'action' => 'view'
),
array(
'id' => '[0-9]+',
'pass' => array('id')
)
View view.php
<?php
echo $this->Html->link('Articolo 3', array('action' => 'posts',  'action' => 'view', 3, '?' => array('queryKey001' => 'queryValue001'), '#' => 'idAncora'));
View controller.php
<?php
$url = Router::url(array('controller' => 'posts', 'action' => 'view', 3));
View controller.php
<?php
$this->redirect(array('controller' => 'posts', 'action' => 'view', 3));
View view.php
<?php echo $this->Html->link('Articolo 3', array('action' => 'posts',  'action' => 'view', 3 ));
View routes.php
<?php
Router::connect('/articoli/:id',
array(
'controller' => 'posts',
'action' => 'view'
),
array(
'id' => '[0-9]+',
'pass' => array('id')
)
View view.php
<?php
$this->Customtime->timeLeft(date('2014-12-15 18:20:15'));
# 'Oggi alle 18:20'
$this->Customtime->timeLeft(date('2014-12-18 15:20:15'));
# 'Tra 3 giorni alle 15:20'
$this->Customtime->timeLeft(date('2014-12-21 08:20:15'));
# 'Tra 6 giorni alle 08:20'
View view.php
<?php
echo $this->Customtime->timeAgo(date('2014-12-15 15:20:15'));
# '1 ora fa'
echo $this->Customtime->timeAgo(date('2014-12-15 08:20:15'));
# 'Oggi alle 08:20'
echo $this->Customtime->timeAgo(date('2014-11-14 20:20:15'));
# '14 Novembre'
You can’t perform that action at this time.