acloudtree

Tag cakephp

Beginning Cakephp – Errata : Pg 106

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
			)
		)
	);
}

Ubuntu + VIM + CakePHP 1.2 + .ctp syntax highlighting

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

Cakephp

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.

  1.  I know PHP
  2. It was suggested to me
  3. 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

Copyright © Jared Folkins
Programming, Computers, Writing, Economics, and Life

Powered by WordPress