Browse By Letter (a php question)

2009-10-30 Thread gimperdan...@gmail.com

I am working on a project where I would like to have a menu to search
by Letters.

For instance:

A | B | C | D |E 

and so on...

However I only want to show the letters that correspond to a product
on the database.

So if I have product:

Apple, and Banana

I would show the letters: A  | B

As of right now, I do it in a really bad way.. I have a loop that goes
from A->Z which SELECT COUNTS each letter and throws everything in one
array.

What's a better way to do that? Instead of have 26 queries?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Query (using "greater than")

2009-10-28 Thread gimperdan...@gmail.com

I was following the code and examples from a Book, not the book.cake.
Sorry I wasn't clear on that.

On Oct 6, 1:57 pm, brian  wrote:
> On Tue, Oct 6, 2009 at 12:20 PM, gimperdan...@gmail.com
>
>  wrote:
>
> > thanks!! Maybe the book is outdated or just a typo.
>
> Outdated. The behavior changed awhile ago. It should be edited. If you
> have a Bakery acct. you can edit it yourself. See ('How You Can
> Help'):
>
> http://book.cakephp.org/
>
> If not, what page is that code on?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Select Distinct only for Unique fields?

2009-10-28 Thread gimperdan...@gmail.com

I am having a problem with SELECT DISTINCT

This is what I have in my model:

This works:

$this->find('all', array('fields'=>array('DISTINCT Album.id',
'Album.year'), 'recursive'=>-1));

This Doesn't Work:

$this->find('all', array('fields'=>array('DISTINCT Album.year'),
'recursive'=>-1));


Album_id is a unique (index) field. Is that why it works on the first
one and not on the second one?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: skipping the add() view?

2009-10-23 Thread gimperdan...@gmail.com

Thanks. That's exactly what I had in mind, just couldn't figure out
how to catch the errors. It's a bit of work, just to display errors,
but it will work for now.

On Oct 23, 2:30 pm, Céryl  wrote:
> I struggled with this, excactly this week! I'm doing it by heart right
> now, but I guess you can guess the gist of it.
> Basicly, build the add form at page that you want. Use the 
> $form->create('Model', array('url' => '/controller/add')) to redirect to the
>
> add action of the controller you want after the button-click...
>
> Then to catch and display the validation-errors (assuming you set them
> in your Model), in the add function do this:
>
> if ($this->Model->save($this->data)) {
>         $this->Session->setFlash('Thing stored');} else {
>
>         if (!empty($this->Model->validationErrors)){
>             //Validation error, display errors in Session->Flash()
>             $errors = $this->Product->validationErrors;
>             foreach($errors as $error):
>                 $errortext .= '- '.$error.'';
>             endforeach;
>             $this->Session->setFlash($errortext);
>         } else {
>                //Not stored, but no validation errors, probably a
> database problem
>                 $this->Session->setFlash('Database Problem');
>         }
>
> }
>
> Then redirect to the add/index-page and it'll display the validation
> errors (The text you stored in the model) in a list in the session-
>
> >flash, just make sure you display that...
>
> Hope it helps!
>
> On 23 okt, 19:58, "gimperdan...@gmail.com" 
> wrote:
>
> > I figured I can just do a redirect() but I can't figure out how to
> > pass the validation errors along. Anyone?
>
> > On Oct 23, 1:18 pm, "gimperdan...@gmail.com" 
> > wrote:
>
> > > Ok,
>
> > > Here's the situation:
>
> > > I have a page that allows users to post comments, but this is not a
> > > ADD page...
>
> > > when I create the add() function in the CommentController it
> > > automatically looks for a add.ctp because it assumes that's where my
> > > form was. All the data gets saved, but it doesn't know where to
> > > redirect to...
>
> > > How can I skip the add view? I don't want to create an Add view just
> > > to post a comment's form.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: skipping the add() view?

2009-10-23 Thread gimperdan...@gmail.com

I figured I can just do a redirect() but I can't figure out how to
pass the validation errors along. Anyone?

On Oct 23, 1:18 pm, "gimperdan...@gmail.com" 
wrote:
> Ok,
>
> Here's the situation:
>
> I have a page that allows users to post comments, but this is not a
> ADD page...
>
> when I create the add() function in the CommentController it
> automatically looks for a add.ctp because it assumes that's where my
> form was. All the data gets saved, but it doesn't know where to
> redirect to...
>
> How can I skip the add view? I don't want to create an Add view just
> to post a comment's form.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



skipping the add() view?

2009-10-23 Thread gimperdan...@gmail.com

Ok,

Here's the situation:

I have a page that allows users to post comments, but this is not a
ADD page...

when I create the add() function in the CommentController it
automatically looks for a add.ctp because it assumes that's where my
form was. All the data gets saved, but it doesn't know where to
redirect to...

How can I skip the add view? I don't want to create an Add view just
to post a comment's form.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: need some help with routes...

2009-10-17 Thread gimperdan...@gmail.com

This is all I can come up with.. I am not too good with regular
expressions...

/artist/([^/\.]+)/album/([^/\.]+)/?

On Oct 16, 5:32 pm, lapinski  wrote:
> * matches everything (including /), so your syntax will not only match what
> you wanted, but also match some URLs that you may not want (e.g.
> '/artist/ARTISTNAME/this_is_not_album_name/album/ALBUMNAME').
>
> Lapinski
>
>
>
> gimperdaniel wrote:
>
> > Ok, this is what I have now.. and it works.. can someone just tell me
> > if it's the right way to do it?
>
> > Router::connect('/artist/*/album/*', array('controller' => 'albums',
> > 'action' => 'view'));
>
> > On Oct 15, 6:20 pm, "gimperdan...@gmail.com" 
> > wrote:
> >> I am learning about routes now, I used to write my own routes on mod
> >> rewrites before i came to Cake, so I just need some small guidance
> >> since I already have some knowledge...
>
> >> Here's what I need to accomplish:
>
> >>www.myswebsite.com/artist/ARTISTNAME/album/ALBUMNAME
>
> >> On mod rewrite I just had to sub ARTISTNAME & ALBUNAME for two
> >> variables and get the values through GET... I just need to accomplish
> >> the same using the Router.
>
> >> Both ARTISTNAME and ALBUMNAME are UNIQUE fields in two separate tables.
>
> --
> View this message in 
> context:http://www.nabble.com/need-some-help-with-routes...-tp25916976p259326...
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Having a couple of problems using recursive = 1

2009-10-16 Thread gimperdan...@gmail.com

Ok this is what I have set up:

Artist -> hasMany Album
Album -> belongsTo Artist
Album -> belongsTo Label
Album-> hasMany Track
Label-> hasMany Album
Track-> belongsTo Album

so fa so good

I provide the name of the Artist and the name of the Album and want to
get results from each table:

$this->Album->find('all', array('conditions' => array('Album.slug'=>
$thisAlbum, 'Artist.slug'=>$thisArtist), 'fields'=>array('Album.name',
'Artist.name', 'Label.name'), 'recursive'=>1));

This the array I get:

Array
(
[0] => Array
(
[Album] => Array
(
[name] => The Art Of Breaking
[id] => 1
)

[Artist] => Array
(
[name] => Thousand Foot Krutch
)

[Label] => Array
(
[name] => Tooth & Nail
)

[Track] => Array
(
[0] => Array
(
[id] => 1
[album_id] => 1
[name] => Hand Granade
[lyrics] =>
[slug] => handgranade
[created] => 2009-10-16 22:09:19
[modified] => -00-00 00:00:00
)

[1] => Array
(
[id] => 2
[album_id] => 1
[name] => Breathe
[lyrics] =>
[slug] => breathe
[created] => 2009-10-16 22:55:16
[modified] => -00-00 00:00:00
)

)

)

)


Which is what I want.. except that I cannot specify what fields I want
to select in the table Tracks, because it's a separate query.

Look at the queries:

First:

SELECT `Album`.`name`, `Artist`.`name`, `Label`.`name`, `Album`.`id`
FROM `albums` AS `Album` LEFT JOIN `artists` AS `Artist` ON
(`Album`.`artist_id` = `Artist`.`id`) LEFT JOIN `labels` AS `Label` ON
(`Album`.`label_id` = `Label`.`id`) WHERE `Album`.`slug` =
'theartofbreaking' AND `Artist`.`slug` = 'thousandfootkrutch'

Second:
SELECT `Track`.`id`, `Track`.`album_id`, `Track`.`name`,
`Track`.`lyrics`, `Track`.`slug`, `Track`.`created`,
`Track`.`modified` FROM `tracks` AS `Track` WHERE `Track`.`album_id` =
(1)


Is there a way to tell find() what fields in Track to select? Do I
have to do another find()?
The only thing I can think of is to do recursive = 0 and run another
find() for Track.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: need some help with routes...

2009-10-16 Thread gimperdan...@gmail.com

what's a best solution?

On Oct 16, 5:32 pm, lapinski  wrote:
> * matches everything (including /), so your syntax will not only match what
> you wanted, but also match some URLs that you may not want (e.g.
> '/artist/ARTISTNAME/this_is_not_album_name/album/ALBUMNAME').
>
> Lapinski
>
>
>
> gimperdaniel wrote:
>
> > Ok, this is what I have now.. and it works.. can someone just tell me
> > if it's the right way to do it?
>
> > Router::connect('/artist/*/album/*', array('controller' => 'albums',
> > 'action' => 'view'));
>
> > On Oct 15, 6:20 pm, "gimperdan...@gmail.com" 
> > wrote:
> >> I am learning about routes now, I used to write my own routes on mod
> >> rewrites before i came to Cake, so I just need some small guidance
> >> since I already have some knowledge...
>
> >> Here's what I need to accomplish:
>
> >>www.myswebsite.com/artist/ARTISTNAME/album/ALBUMNAME
>
> >> On mod rewrite I just had to sub ARTISTNAME & ALBUNAME for two
> >> variables and get the values through GET... I just need to accomplish
> >> the same using the Router.
>
> >> Both ARTISTNAME and ALBUMNAME are UNIQUE fields in two separate tables.
>
> --
> View this message in 
> context:http://www.nabble.com/need-some-help-with-routes...-tp25916976p259326...
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: need some help with routes...

2009-10-15 Thread gimperdan...@gmail.com

Ok, this is what I have now.. and it works.. can someone just tell me
if it's the right way to do it?

Router::connect('/artist/*/album/*', array('controller' => 'albums',
'action' => 'view'));

On Oct 15, 6:20 pm, "gimperdan...@gmail.com" 
wrote:
> I am learning about routes now, I used to write my own routes on mod
> rewrites before i came to Cake, so I just need some small guidance
> since I already have some knowledge...
>
> Here's what I need to accomplish:
>
> www.myswebsite.com/artist/ARTISTNAME/album/ALBUMNAME
>
> On mod rewrite I just had to sub ARTISTNAME & ALBUNAME for two
> variables and get the values through GET... I just need to accomplish
> the same using the Router.
>
> Both ARTISTNAME and ALBUMNAME are UNIQUE fields in two separate tables.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



need some help with routes...

2009-10-15 Thread gimperdan...@gmail.com

I am learning about routes now, I used to write my own routes on mod
rewrites before i came to Cake, so I just need some small guidance
since I already have some knowledge...

Here's what I need to accomplish:

www.myswebsite.com/artist/ARTISTNAME/album/ALBUMNAME

On mod rewrite I just had to sub ARTISTNAME & ALBUNAME for two
variables and get the values through GET... I just need to accomplish
the same using the Router.

Both ARTISTNAME and ALBUMNAME are UNIQUE fields in two separate tables.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread gimperdan...@gmail.com

ok, thanks everyone, I got something going on. It works, i just hope
it's the proper way to do it.

On Oct 14, 3:15 pm, Eber Freitas Dias  wrote:
> Hey!
>
> First of all, you never route something to a Model...
>
> Take a look at this portion of the CakePHP 
> Book:http://book.cakephp.org/view/13/Basic-Principles-of-CakePHP
>
> In fact, you should read all the CakePHP Book in order to understand things
> better. For instance, you should need to write any queries in order to get
> the data you want. Try to read something related to MVC as well, and you
> understand CakePHP 
> better:http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
>
> Hope it helps somehow!
>
> On Wed, Oct 14, 2009 at 4:06 PM, gimperdan...@gmail.com <
>
>
>
> gimperdan...@gmail.com> wrote:
>
> > Ok... thanks for the tutorial. It helped some. This is my main problem
> > right now... that in order to use model and controllers they need to
> > be attached to a database table. And I don't always want to have a
> > database table that corresponds to that model.
>
> > For instance:
>
> > I have 3 tables:
>
> > artists
> > albums
> > tracks
>
> > I my home page I want to pull...
>
> > Latest artists added
> > Latest albums added
> > And just a featured artist
>
> > My question is, where would I write the queries? On a element? on a
> > helper? Because if I create a model (and route it to be the index)
> > than that model would need a corresponding database table, which I
> > wouldn't have. Can someone give me an example?
>
> > Thanks!
>
> > On Oct 14, 12:14 pm, red  wrote:
> > > As I understand, you try to build some kind of dashboard. Check this
> > > tutorial, maybe this works for you:
> >http://teknoid.wordpress.com/2008/12/16/how-to-build-a-dashboard-for-...
>
> > > On Oct 14, 5:54 pm, "gimperdan...@gmail.com" 
> > > wrote:
>
> > > > I kinda understand what you're saying, but I am rather lost with some
> > > > concepts in Cake. I have to read more first... Thanks...
>
> > > > PS: legal seu site!
>
> > > > On Oct 14, 11:20 am, Eber Freitas Dias  wrote:
>
> > > > > Hi!
>
> > > > > The fact that "home.ctp" is the default home for your app it doesn't
> > mean
> > > > > you have to use it!
>
> > > > > You can just re declare a new home in your routes using the
> > controller you
> > > > > want. Something like:
>
> > > > > Router::connect('/', array('controller' => 'mycontroller', 'action'
> > =>
> > > > > 'index'));
>
> > > > > The second argument on the connect method works just like the url on
> > your
> > > > > link methods from the html helper.
>
> > > > > There is some basic understanding related to behaviours, components
> > and
> > > > > helpers... See:
>
> > > > > Helpers extends functionality to views.
> > > > > Components extends functionality to controllers.
> > > > > Behaviours extends functionality to models.
>
> > > > > If you need some custom data, instead of using requestAction, I would
> > > > > consider creating a new function on your model and simply calling it
> > > > > instead. You can create as many functions you like in your modesl,
> > and once
> > > > > you start doing that, you won't stop. It makes things really simpler!
>
> > > > > On Wed, Oct 14, 2009 at 11:57 AM, gimperdan...@gmail.com <
>
> > > > > gimperdan...@gmail.com> wrote:
>
> > > > > > Thanks. That helps a little. From what I've been reading it's
> > better
> > > > > > to use Elements for HTML chunks and Helpers for logic. But
> > > > > > requestAction seems like a good option too.
>
> > > > > > On Oct 14, 10:54 am, Céryl  wrote:
> > > > > > > I don't really know the answer, but just to add to that, the
> > home.ctp
> > > > > > > has a controller, it's the pages_controller.
> > > > > > > And also, you can of course use actions from other controllers
> > and
> > > > > > > models in the pages-views by using Cake's requestAction. I use it
> > > > > > > sometimes to get for instance  number of posts, users, pictures
> > or
> > > > > > > whatever on the sites main index page.
>
> > > > > > > On 14 okt, 16:38, "gimperdan...@gmail.com" <
> > gimperdan...@gmail.com>
> > > > > > > wrote:
>
> > > > > > > > On the index of my website I get content from several different
> > tables
> > > > > > > > in the database. Which is best to use? Elements? Behaviors? or
> > > > > > > > Helpers? As far as I understand the index(home.ctp) page
> > doesn't have
> > > > > > > > a  model or controller.
>
> > > > > --
> > > > > Éber Freitas Dias
>
> > > > >www.eberfdias.comwww.dejamps.net
>
> --
> Éber Freitas Dias
>
> www.eberfdias.comwww.dejamps.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread gimperdan...@gmail.com

Ok... thanks for the tutorial. It helped some. This is my main problem
right now... that in order to use model and controllers they need to
be attached to a database table. And I don't always want to have a
database table that corresponds to that model.

For instance:

I have 3 tables:

artists
albums
tracks

I my home page I want to pull...

Latest artists added
Latest albums added
And just a featured artist

My question is, where would I write the queries? On a element? on a
helper? Because if I create a model (and route it to be the index)
than that model would need a corresponding database table, which I
wouldn't have. Can someone give me an example?

Thanks!

On Oct 14, 12:14 pm, red  wrote:
> As I understand, you try to build some kind of dashboard. Check this
> tutorial, maybe this works for 
> you:http://teknoid.wordpress.com/2008/12/16/how-to-build-a-dashboard-for-...
>
> On Oct 14, 5:54 pm, "gimperdan...@gmail.com" 
> wrote:
>
> > I kinda understand what you're saying, but I am rather lost with some
> > concepts in Cake. I have to read more first... Thanks...
>
> > PS: legal seu site!
>
> > On Oct 14, 11:20 am, Eber Freitas Dias  wrote:
>
> > > Hi!
>
> > > The fact that "home.ctp" is the default home for your app it doesn't mean
> > > you have to use it!
>
> > > You can just re declare a new home in your routes using the controller you
> > > want. Something like:
>
> > > Router::connect('/', array('controller' => 'mycontroller', 'action' =>
> > > 'index'));
>
> > > The second argument on the connect method works just like the url on your
> > > link methods from the html helper.
>
> > > There is some basic understanding related to behaviours, components and
> > > helpers... See:
>
> > > Helpers extends functionality to views.
> > > Components extends functionality to controllers.
> > > Behaviours extends functionality to models.
>
> > > If you need some custom data, instead of using requestAction, I would
> > > consider creating a new function on your model and simply calling it
> > > instead. You can create as many functions you like in your modesl, and 
> > > once
> > > you start doing that, you won't stop. It makes things really simpler!
>
> > > On Wed, Oct 14, 2009 at 11:57 AM, gimperdan...@gmail.com <
>
> > > gimperdan...@gmail.com> wrote:
>
> > > > Thanks. That helps a little. From what I've been reading it's better
> > > > to use Elements for HTML chunks and Helpers for logic. But
> > > > requestAction seems like a good option too.
>
> > > > On Oct 14, 10:54 am, Céryl  wrote:
> > > > > I don't really know the answer, but just to add to that, the home.ctp
> > > > > has a controller, it's the pages_controller.
> > > > > And also, you can of course use actions from other controllers and
> > > > > models in the pages-views by using Cake's requestAction. I use it
> > > > > sometimes to get for instance  number of posts, users, pictures or
> > > > > whatever on the sites main index page.
>
> > > > > On 14 okt, 16:38, "gimperdan...@gmail.com" 
> > > > > wrote:
>
> > > > > > On the index of my website I get content from several different 
> > > > > > tables
> > > > > > in the database. Which is best to use? Elements? Behaviors? or
> > > > > > Helpers? As far as I understand the index(home.ctp) page doesn't 
> > > > > > have
> > > > > > a  model or controller.
>
> > > --
> > > Éber Freitas Dias
>
> > >www.eberfdias.comwww.dejamps.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread gimperdan...@gmail.com

I kinda understand what you're saying, but I am rather lost with some
concepts in Cake. I have to read more first... Thanks...

PS: legal seu site!

On Oct 14, 11:20 am, Eber Freitas Dias  wrote:
> Hi!
>
> The fact that "home.ctp" is the default home for your app it doesn't mean
> you have to use it!
>
> You can just re declare a new home in your routes using the controller you
> want. Something like:
>
> Router::connect('/', array('controller' => 'mycontroller', 'action' =>
> 'index'));
>
> The second argument on the connect method works just like the url on your
> link methods from the html helper.
>
> There is some basic understanding related to behaviours, components and
> helpers... See:
>
> Helpers extends functionality to views.
> Components extends functionality to controllers.
> Behaviours extends functionality to models.
>
> If you need some custom data, instead of using requestAction, I would
> consider creating a new function on your model and simply calling it
> instead. You can create as many functions you like in your modesl, and once
> you start doing that, you won't stop. It makes things really simpler!
>
> On Wed, Oct 14, 2009 at 11:57 AM, gimperdan...@gmail.com <
>
>
>
> gimperdan...@gmail.com> wrote:
>
> > Thanks. That helps a little. From what I've been reading it's better
> > to use Elements for HTML chunks and Helpers for logic. But
> > requestAction seems like a good option too.
>
> > On Oct 14, 10:54 am, Céryl  wrote:
> > > I don't really know the answer, but just to add to that, the home.ctp
> > > has a controller, it's the pages_controller.
> > > And also, you can of course use actions from other controllers and
> > > models in the pages-views by using Cake's requestAction. I use it
> > > sometimes to get for instance  number of posts, users, pictures or
> > > whatever on the sites main index page.
>
> > > On 14 okt, 16:38, "gimperdan...@gmail.com" 
> > > wrote:
>
> > > > On the index of my website I get content from several different tables
> > > > in the database. Which is best to use? Elements? Behaviors? or
> > > > Helpers? As far as I understand the index(home.ctp) page doesn't have
> > > > a  model or controller.
>
> --
> Éber Freitas Dias
>
> www.eberfdias.comwww.dejamps.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread gimperdan...@gmail.com

Thanks. That helps a little. From what I've been reading it's better
to use Elements for HTML chunks and Helpers for logic. But
requestAction seems like a good option too.

On Oct 14, 10:54 am, Céryl  wrote:
> I don't really know the answer, but just to add to that, the home.ctp
> has a controller, it's the pages_controller.
> And also, you can of course use actions from other controllers and
> models in the pages-views by using Cake's requestAction. I use it
> sometimes to get for instance  number of posts, users, pictures or
> whatever on the sites main index page.
>
> On 14 okt, 16:38, "gimperdan...@gmail.com" 
> wrote:
>
> > On the index of my website I get content from several different tables
> > in the database. Which is best to use? Elements? Behaviors? or
> > Helpers? As far as I understand the index(home.ctp) page doesn't have
> > a  model or controller.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



What to use? Elements? Behaviors? Helpers?

2009-10-14 Thread gimperdan...@gmail.com

On the index of my website I get content from several different tables
in the database. Which is best to use? Elements? Behaviors? or
Helpers? As far as I understand the index(home.ctp) page doesn't have
a  model or controller.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Query (using "greater than")

2009-10-06 Thread gimperdan...@gmail.com

thanks!! Maybe the book is outdated or just a typo.

On Oct 6, 12:07 pm, Miles J  wrote:
> Almost there, the operators go in the array index, not the value.
>
> return $this->find('all',array(
>
>     'conditions'=>array(
>
>          'DATE(Post.date) >'=> $date,
>          'DATE(Post.date) <'=> $end_date
>
> )));
>
> On Oct 6, 8:52 am, "gimperdan...@gmail.com" 
> wrote:
>
> > I am learning cake using a book, which has been great so far, but I am
> > having problems with one example of the book when it uses the "greater
> > than" and similar operators in a query...
>
> > here's what the books says:
>
> > return $this->find('all',array(
>
> >     'conditions'=>array(
>
> >          'DATE(Post.date)'=> '>'.$date,
> >          'DATE(Post.date)'=>'<'.$end_date
>
> > )));
>
> > here's what cake will query:
>
> > SELECT `Post`.`id`, `Post`.`name`, `Post`.`date`, `Post`.`content`,
> > `Post`.`user_id`, `User`.`id`, `User`.`name`, `User`.`email`,
> > `User`.`firstname`, `User`.`lastname` FROM `posts` AS `Post` LEFT JOIN
> > `users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE DATE
> > (`Post`.`date`) = ' < 2009-12-31 23:59:59'
>
> > You can see at the end of the query that cake doesn't recognize the
> > "<" or the ">" operators... so it just adds the "=" and then the "<"
> > as a string. I am using the latest cake version.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Beginners book!

2009-10-06 Thread gimperdan...@gmail.com

I am new to cake (not to php, but to cake) and thought this book to be
great help. If you know your basic php it really should make cake much
easier to understand.

Beginning CakePHP - From Novice to Professional (Apress)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake Bake Error: I just cant BAKE, please help

2009-10-06 Thread gimperdan...@gmail.com

I don't know if this applies.. but i had problems running Bake because
I have to use a socket to connect to the database. So I had to go to
the database configuration file and add port=> PATH TO SOCKET

On Oct 6, 8:57 am, "Prof. No Time" 
wrote:
> Good day all,
>
> Each time I try baking in cake, I just end up hating cakePHP! Please
> someone help me out.
>
> I downloaded the latest edition 1.2.5 and I tried to study the chapter
> on ACL. While running the cake bake command (On WindowsXP
> Professional, Apache 2.2.8, PHP 5.2.5, what else?), I got the
> following error:
>
> Fatal error: Class 'DATABASE_CONFIG' not found in X:\wamp\www\aclstudy
> \cake\console\libs\tasks\db_config.php on line 265
>
> This error popped up right after it had finished copying the skel
> files and then told me that no db config is found and as such I should
> create one. I entered all the demanded parameters correctly then it
> crashed with the error stated above.
>
> Please kindly put me through on how to tackle this because I'm STUCK!
>
> Regards,
> Prof. No Time
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Query (using "greater than")

2009-10-06 Thread gimperdan...@gmail.com

I am learning cake using a book, which has been great so far, but I am
having problems with one example of the book when it uses the "greater
than" and similar operators in a query...

here's what the books says:

return $this->find('all',array(

'conditions'=>array(

 'DATE(Post.date)'=> '>'.$date,
 'DATE(Post.date)'=>'<'.$end_date

)));



here's what cake will query:

SELECT `Post`.`id`, `Post`.`name`, `Post`.`date`, `Post`.`content`,
`Post`.`user_id`, `User`.`id`, `User`.`name`, `User`.`email`,
`User`.`firstname`, `User`.`lastname` FROM `posts` AS `Post` LEFT JOIN
`users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE DATE
(`Post`.`date`) = ' < 2009-12-31 23:59:59'


You can see at the end of the query that cake doesn't recognize the
"<" or the ">" operators... so it just adds the "=" and then the "<"
as a string. I am using the latest cake version.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



showEmpty?

2009-10-03 Thread gimperdan...@gmail.com

I am new to cake... i have been doing a lot of reading, but somethings
i still can't figure out.

This is what I have:

echo $form->select('State', array('NJ' => New Jersey', 'NY' => 'New
York'));

I want to remove the empty option of this select box. According to the
API I need to add $showEmpty = false to the code above.. but where do
I add it? I tried in several different locations and it won't work.

Thanks

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---