The findByYear() function is messed up in the book. Thought I would post the correction to remind myself.
Correct!
function findByYear($year=null) {
$date = $year.'-01-01 00:00:00';
$end_date = $year.'-12-31 23:59:59';
return $this->find('all',
array(
'conditions' =>
array(
'DATE(Post.date) >' => $date,
'DATE(Post.date) <' => $end_date
)
)
);
}
Incorrect!
function findByYear($year=null) {
$date = $year.'-01-01 00:00:00';
$end_date = $year.'-12-31 23:59:59';
return $this->find('all',
array(
'conditions' =>
array(
'DATE(Post.date)' => '>'.$date,
'DATE(Post.date)' => '<'.$end_date
)
)
);
}
Found this blog post concerning setting up the Cakephp view extension (.ctp) to use the same highlighting as (.php).
blog
I didn’t find his solution that helpful, but one of the comments said to add this to my ‘.vimrc’ file in my home directory.
if has(”autocmd”)
autocmd BufEnter *.ctp set syn=php
endif
And since we are on the topic here is how my .vimrc is setup
set tabstop=2
set shiftwidth=2
set expandtab
if has("autocmd")
autocmd BufEnter *.ctp set syn=php
endif
syn on
-later
This tutorial assumes that you installed the basic LAMP stack that ubuntu comes with. It is also assumed that this is a development installation of CakePHP
1) Download CakePHP. My directory after I uncompress it is called ‘cake_1.2.1.8004′
*optional
2) Rename ‘cake_1.2.1.8004′ to ‘cake’
3) Move the ‘cake’ directory into ‘/var/www/’ so your full path becomes ‘/var/www/cake/’
4) Enable mod_rewrite
username@ubuntu:/$ sudo a2enmod rewrite
Enabling module rewrite.
Run '/etc/init.d/apache2 restart' to activate new configuration!
5) Enable appropriate rules in ‘/etc/apache2/sites-available/default’
username@ubuntu:/$ sudo vi /etc/apache2/sites-available/default
5a) Change the following
Directory /
Options FollowSymLinks
AllowOverride None
/Directory
To
Directory /
Options FollowSymLinks
AllowOverride All
Directory
5b) Change the following
Directory /var/www/
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
Directory
To
Directory /var/www/
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
/Directory
6) Restart apache2
username@ubuntu:/$ sudo /etc/init.d/apache2 restart
default screenshot
So, in my free time I am trying to write a web app for some folks at the District. I selected Cakephp as the framework for two reasons.
- I know PHP
- It was suggested to me
- Ok, here is a third. It is freakin easy.
I needed something to develop in rapidly and am making progress with cake by leaps and bounds. The only thing that has really slowed me down is rolling my own RBAC. If there was a library to do this type of security, it would make life a lot easier.
The application itself is a Position Control System. With budget cuts at a state level, monitoring FTE with greater clarity and control is becoming very important. The complexities go beyond a normal system because of the way FTE can be transferred in a School District. I haven’t worked yet on how to calc these complexities, I only have identified them. But. I figure my solution will probably be interesting to some.
Once I have some code built, I will share.
-later