Jul 7, 2009 8
CakePHP :: Forgotten Password
Sometimes people forget. Usually it is when they need to get into their account or behind the nice ACL system you have setup. So, how do you handle the forgotten passwords? Read the rest of this entry »
Jul 7, 2009 8
Sometimes people forget. Usually it is when they need to get into their account or behind the nice ACL system you have setup. So, how do you handle the forgotten passwords? Read the rest of this entry »
Feb 24, 2009 3
So, it seems that cake is more awesome than me. And the Temporary hack I have below is over-ruled by cakephp. Thanks to Matt @ pseudocoder what I should have looked for is find $this->Model->(‘list’) and it would bypass the ‘foreach’ loop. Excellent.
The CakePHP Way
Many thanks to Matt in the comment below, he pointed me to the real Cake way to do this. So, ignore my tmporary hack. It’s easy.
4c51b03abb8641_
One of the reasons I love CakePHP is its ease of use. Once you speak its language everything flows together like a river.
Sometimes though I have fallen into hacking cake to make it do what I’d like. It used to be because I didn’t know it enough. Sometimes now it is because I need specifics in my views. And sometimes it was because I wanted a html options box, but cake didn’t have the data in the format I wanted it.
So this is my hack I did today.
It seems to be the one thing with the FormHelper that got me a little stuck. I was trying to set up a options box. The way we have been doing this is looping a ‘real box’ out in the view – using the cake returned arrays and then using ‘foreach’ to loop out the data we needed.
I wasn’t really a fan of that idea, so I had a go at hacking together a mid point. I’m sure someone will know a much better ‘cake’ way of doing this – and if you do, please leave a comment. But here is what I am calling a temporary hack (basically it make my cake mind feel like I haven’t wronged cakephp).
Temporary Hack : FormHelper Options Box in view
I am going to send the view a $var with a key-value paired array. So I find a list of all the Arbiters (a master list). That have a status of USER (see Mark Story’s Bitmasks). The ‘contain’ will return just the Arbiter data, nothing related. And return just the fields I need for the loop.
Then I just use a ‘foreach’ loop to push the found fields into the $var array I had setup. And using $this->set it goes to the view.
4c51b03abb8642_
4c51b03abb8643_
As I said, I reckon this is a hack:
So I am waiting for someone to correct me. But until then I do have this temporary hack kicking out the jams.
Recent Comments