Re: Best practice for changing entity in afterSave

2014-10-08 Thread Rob Cowie
OK, so I was being stupid.

I had missed adding the field to the entity $_accessible array.

I have it all working, thanks.

On Wednesday, 8 October 2014 09:15:40 UTC+1, Rob Cowie wrote:
>
> That is exactly the case. The entity returned by the save function does 
> not have the changes applied in the afterSave.
>
> I'll put an example on Github to demonstrate my problem.
>
>
>
> On Tuesday, 7 October 2014 15:20:10 UTC+1, heavyKevy wrote:
>>
>> It seems to me that the entity used to save the record in the save call 
>> is updated and available in the controller after the save call is 
>> complete...
>> Are you saying that modifications in that Entity are not showing up in 
>> the controller afterwards?
>>
>> On Monday, October 6, 2014 4:34:41 PM UTC+7, Rob Cowie wrote:
>>>
>>> Hi all, back again with another question:
>>>
>>> In our old 1.3 app, I used $this->someValue = $someData; in an afterSave 
>>> function to pass values back up to a controller.
>>>
>>> I have tried to use a $entity->set('someValue', $someData); in an 
>>> afterSave in the new cake3 table model, but this entity does not appear to 
>>> be available to me back at the controller layer. 
>>>
>>> Has any one got any pointers as to the correct way to achieve this (That 
>>> is, get a value at the controller, that has been set at the table model in 
>>> afterSave)?
>>>
>>> Thanks in advance.
>>>
>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Best practice for changing entity in afterSave

2014-10-08 Thread Rob Cowie
That is exactly the case. The entity returned by the save function does not 
have the changes applied in the afterSave.

I'll put an example on Github to demonstrate my problem.



On Tuesday, 7 October 2014 15:20:10 UTC+1, heavyKevy wrote:
>
> It seems to me that the entity used to save the record in the save call is 
> updated and available in the controller after the save call is complete...
> Are you saying that modifications in that Entity are not showing up in the 
> controller afterwards?
>
> On Monday, October 6, 2014 4:34:41 PM UTC+7, Rob Cowie wrote:
>>
>> Hi all, back again with another question:
>>
>> In our old 1.3 app, I used $this->someValue = $someData; in an afterSave 
>> function to pass values back up to a controller.
>>
>> I have tried to use a $entity->set('someValue', $someData); in an 
>> afterSave in the new cake3 table model, but this entity does not appear to 
>> be available to me back at the controller layer. 
>>
>> Has any one got any pointers as to the correct way to achieve this (That 
>> is, get a value at the controller, that has been set at the table model in 
>> afterSave)?
>>
>> Thanks in advance.
>>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Best practice for changing entity in afterSave

2014-10-07 Thread heavyKevy
It seems to me that the entity used to save the record in the save call is 
updated and available in the controller after the save call is complete...
Are you saying that modifications in that Entity are not showing up in the 
controller afterwards?

On Monday, October 6, 2014 4:34:41 PM UTC+7, Rob Cowie wrote:
>
> Hi all, back again with another question:
>
> In our old 1.3 app, I used $this->someValue = $someData; in an afterSave 
> function to pass values back up to a controller.
>
> I have tried to use a $entity->set('someValue', $someData); in an 
> afterSave in the new cake3 table model, but this entity does not appear to 
> be available to me back at the controller layer. 
>
> Has any one got any pointers as to the correct way to achieve this (That 
> is, get a value at the controller, that has been set at the table model in 
> afterSave)?
>
> Thanks in advance.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Best practice to get menu array

2014-09-19 Thread Dario Savella
By the look of it what you need is a Plugin and inside the Models for the 
tables you mentioned and at least an Helper to produce the HTML output.
I recently used the MenuBuilder Plugin. You will have to add the logic to 
retrieve the menu from your Models though.

On Saturday, September 13, 2014 10:57:21 AM UTC+2, Sam Clauw wrote:
>
> I have 2 tables which hold pages information: "pages" and "cms_pages". Now 
> I want to build a menu on every website page with the records within. 
> What's the best practice for this?
>
> Should I make a behavior that loads in the "pages" and "cms_pages" model? 
> If yes, where (and how) should I make the call to that behavior? In the 
> AppModel class?
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Best practice to get menu array

2014-09-18 Thread Sam Clauw
Can I bump my topic again? :)
I realy hope I'll find an answer on this one, it's all about keeping the 
MVC as clear as possible ;)

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Best practice: using class on all pages

2014-08-14 Thread Sam Clauw
Okay, outputting an  structure with an element is indeed very 
usefull. It can appear in multiple areas on the template files. I 
understand that I should do something like:

echo $this->element('mainmanu', array(
'tree' => array(...),
'active' => array(...)
));

The tree array holds the records and should be calculated with a given 
depth.
The active array holds the parent nodes of the active node.

So far so good I guess? But what do you exactly mean with getting the data 
with a request action?
Sorry if this is a silly question :)

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Best practice: using class on all pages

2014-08-10 Thread thanat
I would use element for rendering and request action to get the correct 
data for menu. 

On Monday, August 11, 2014 12:26:47 AM UTC+2, Sam Clauw wrote:
>
> I want to write a class that use a left value and a depth value so it can 
> print an  output for a menu. I want it to be able in my CMS plugin 
> AND in my front-end pages. My question is: where should I put that class? 
> Some options I've been thinking on:
>
>1. Everything in AppModel.php (disadvantage: file will be too long if 
>there are other functions here).
>2. Making a behavior and call it's functions in a helper.
>
> Is one of the above options OK to use, or is there a better way to do so?
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Best Practice Question - Components

2013-11-06 Thread Reuben Helms
I would say that calculations, and verification of amounts would be perfect
functionality to place on the model.  You wouldn't normally need a
controller to determine the sum of items in an order, so why put it in a
controller.

For a shopping cart, you still might use a model to store the cart contents
and cart items.  You might query the cart to see what the total value is.
 This is not a calculation that the controller would need to make, so you
wouldn't need to do it in a component either.  All business logic for an
entity should stay with the entity, and the model is the perfect place for
that.

What you might put in the component is functionality to load a cart that is
attached to the session, or clear the cart from the session, if the user
requests it, or save cart modifications to the session at the end the
controller lifecycle.

Interesting to note, in CakePHP 3.0, the model will be split between an
Entity and a Table.  The Table will take care of the schema, and typical
database/CRUD operations, while the Entity will concentrate more on the
business logic side of things.

Regards
Reuben Helms


On Thu, Nov 7, 2013 at 10:08 AM, Kristen M  wrote:

> Yeah, the point of the exercise is to do things the "Cake Way" and take
> advantage of all things automagical and Cake. ;)
>
> After puzzling over the docs for a bit and realizing it's not bad form to
> have a controller use multiple models, I decided that splitting the
> existing classes into a model and a component was probably the "correct"
> solution. The model handles all the data, while the component contains
> common functions all controllers that use the model will need, like
> calculations and verification of amounts.
>
>
>
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "CakePHP" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/cake-php/M6i0tin0b5Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Best Practice Question - Components

2013-11-06 Thread Kristen M
Yeah, the point of the exercise is to do things the "Cake Way" and take 
advantage of all things automagical and Cake. ;) 

After puzzling over the docs for a bit and realizing it's not bad form to 
have a controller use multiple models, I decided that splitting the 
existing classes into a model and a component was probably the "correct" 
solution. The model handles all the data, while the component contains 
common functions all controllers that use the model will need, like 
calculations and verification of amounts. 




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Best Practice Question - Components

2013-11-05 Thread Reuben
If you have existing class that work, then you could include them as Vendor 
code, and have your controllers call their find and save functions.

However, doing things the CakePHP way, you'll probably want to convert 
those classes to Models, rather than Components. Models are where your 
business logic and validation rules go.

I used to think that anything required by more than one controller should 
go into a component, but I'm thinking that components are for things that 
need to plug into the controller lifecycle.

On Wednesday, 6 November 2013 06:03:19 UTC+10, Kristen M wrote:
>
> I'm not a new programmer (I'd say advanced beginner/intermediate) but I'm 
> quite new to Cake and MVC in general. 
>
> I've decided best way to learn CakePHP and MVC is to take an existing 
> (functional, live) project and port it to Cake for kicks. Get the grand 
> tour of all the basics. 
>
> In my existing project I have a number of utility classes that are used by 
> the other classes. 2 of them are an Item class and a Banking class. Item 
> obviously contains all the information about a user's inventory, plus 
> handles updating/deducting items, as well as using items. Banking does just 
> that- tracks a user's currency and handles transactions. Banking is used 
> between the Shop systems, Item is used by Shop and various action classes. 
> So I need a way to share their functionality between all the various other 
> controllers that require them. 
>
> Simple example would be the user wants to buy an item from the shop, have 
> to verify the item is in stock, the item's price, that the player has the 
> currency to pay for it, deliver the item, deduct the payment and deduct the 
> item from shop inventory. While a different Controller (say, Toll Bridge) 
> needs the Banking functions to verify the user has the funds to pay the 
> toll, then debit the transaction.
>
> It SOUNDS like what I need to do is to create Banking & Item Components, 
> then the other controllers can make use of them as needed. However, this 
> would also require including various queries to chat with the database. The 
> CakePHP example on Components only shows a simple math operation with 
> passed params, and says nothing about if using Components as little 
> "bundles" of functionality that involve their own validations and database 
> interactions (although this is strongly implied) There is some conversation 
> on the 'net that what actually needs to happen is Banking and Item should 
> be controllers, and they get imported as needed. 
>
> What's the best way to go about this? 
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Best practice for Helpers

2013-07-16 Thread Tilen Majerle
Second way. Because you can modify returned data before print/echo.

--
Lep pozdrav, Tilen Majerle
http://majerle.eu


2013/7/16 David Suna 

> As a best practice, should a helper output content or return the content
> to the View?
>
> In other words, should the call to the helper be:
> $this->MyHelper->someMethod($DataForHelper);
>
> or
>
> echo $this->MyHelper->someMethod($DataForHelper);
>
> Most of the built in helpers seem to prefer the latter form.  Is this just
> a style issue or is there a preferred way?
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Best practice to call "cake schema update" without shell

2013-01-29 Thread LDSign
The hoster is 1&1 (Business Pro Shared Host). Ive already tried
accessing the shell via ssh, but it seems Ive no right for that.

I would like to call "cake schema update" on a scheme I have uploaded
to the production/presentation server which is currently in testing
state (so db changes are common). In an optimum way, I would to
migrate the db within the admin-interface with a simple click.

Do you have any hint how I could accomplish this on the given 1&1
host?

Thanks,
Frank



On Jan 29, 10:51 am, euromark  wrote:
> It can. If you got sufficient rights to do that (executable rights for this
> user - www-data probably).
> But I am not sure if thats a very good idea.
> Why not providing shell access here?
>
> Am Dienstag, 29. Januar 2013 05:59:51 UTC+1 schrieb LDSign:
>
>
>
>
>
>
>
>
>
> > Hi
>
> > I would like to call a shell command on a prdouction server without
> > shell access. Whats the best practice of doing that? Can a shell-
> > command being called from a controller?
>
> > Thank you,
> > Frank

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Best practice to call "cake schema update" without shell

2013-01-29 Thread euromark
It can. If you got sufficient rights to do that (executable rights for this 
user - www-data probably).
But I am not sure if thats a very good idea.
Why not providing shell access here?


Am Dienstag, 29. Januar 2013 05:59:51 UTC+1 schrieb LDSign:
>
> Hi 
>
> I would like to call a shell command on a prdouction server without 
> shell access. Whats the best practice of doing that? Can a shell- 
> command being called from a controller? 
>
> Thank you, 
> Frank 
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

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




Re: Best practice for EXTERNAL api?

2013-01-07 Thread Ma'moon
http://book.cakephp.org/2.0/en/models/datasources.html
Check out the example usage of "FarAwaySource"


On Mon, Jan 7, 2013 at 9:59 AM, marcus33cz  wrote:

> Hi all,
>
> I have several external APIs which I'd like to use - such as this one:
> http://www.pinnaclesports.com/apimanual/commands.aspx
>
> The scripts I want to create will use the HttpSocket class (to get the
> data via API) and some model classes such as Match (to save the data in my
> DB).
> The scripts should be run by CRON (and I guess it should be accessible
> manually as well).
>
> Now the question is *where in the structure of cakePHP should I put my
> scripts that get data from the API and save them?*
> *(I think it is not exactly a plugin and I don't want to create another
> model either - because all my models are mapped to a DB table and the API
> wouldn't be.)*
>
> Thanks a lot!
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Best Practice to display data in layout or view

2012-08-11 Thread Mark Wratten
Option 2. is fine for simple stuff, i.e. grab a bunch of data from the 
database and render it, but if there is any complexity to the logic, then 
you end up loading your helpers with application logic, which in a pure MVC 
world belongs in a controller or component. So in that case, requestAction 
would be the purest approach but suffers the overhead of re-initializing 
the environment each time. Ideally, there would be some middle ground 
approach, which currently you have to roll yourself, by instantiating a new 
controller and calling the appropriate method yourself.

Mark

On Saturday, August 11, 2012 2:33:33 AM UTC-4, Sanjeev Divekar wrote:
>
> Hello,
>
> What is the best practice to display data e.g. list of products, events, 
> news in layout?
>
> 1. Element - which requires to call requestAction() and also calls 
> beforeFilter from AppController each time
> 2. Helper - need to use Model class in helper
>
> Regards,
>

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Best Practice to display data in layout or view

2012-08-11 Thread Tilen Majerle
i'm using second option. Model can be created with
ClassRegistry::init('ModelName'); to get model instance :)
--
Lep pozdrav, Tilen Majerle
http://majerle.eu



2012/8/11 sanjeev 

> Hello,
>
> What is the best practice to display data e.g. list of products, events,
> news in layout?
>
> 1. Element - which requires to call requestAction() and also calls
> beforeFilter from AppController each time
> 2. Helper - need to use Model class in helper
>
> Regards,
>
> --
> 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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Best practice output a Dynamic menu

2011-12-12 Thread Perry
you can define a protected variable $showMenu = true in AppController, and
for those controllers who don't need menu, set this vairable to false

and in beforeRender method check this variable to output or not.

On Mon, Dec 12, 2011 at 7:08 PM, MetZ  wrote:

> ;)
>
> That was what I thought about helpers yes..
>
> Helper => will be used to generate the menu
>
> You would suggest to pull the menu + links fra database in
> app_controller beforerender, might work fine not using component for
> this.
>
> As I do not need to get the menues on every page, how would you
> suggest to only use the menu database retrival when needed?
>
> using if this params controller= controller ? or something like that?
> or do you know of a better way ?
>
> Thanks for all help and suggestions this far!
>
> -Tom
>
>
> On 12 Des, 07:17, Perry  wrote:
> > helpers should not get data directly, and I remember cakephp doesn't
> > suggest get data in components neither( i cant' find the refer), why not
> > get menu data in AppController's beforeRender method?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Sun, Dec 11, 2011 at 8:16 PM, MetZ  wrote:
> >
> > > Hi.
> >
> > > I am storing my menues and links(tree behavior) in database. I am
> > > using several themes for the system, and hardcoding menues manuallly
> > > foreach theme is not an option.
> >
> > > I have no problem outputting the menues and links with a component and
> > > helper in my themes, but i am simply wodering about the best practice
> > > to do this?
> >
> > > Example, get menues and links from db in component, generate menu
> > > output with helper.
> >
> > > Or should i do all this in the helper?
> >
> > > Thanks!
> >
> > > tom
> >
> > > On Dec 8, 11:42 pm, Perry  wrote:
> > > > why consider components and helpers?
> >
> > > > do you store your menu structures in database? why not just treat it
> as a
> > > > data and output it directly in layout?
> >
> > > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > > > > Hi all!
> >
> > > > > I am looking for a couple of suggestions.
> >
> > > > > I am currently working on a tree menu part of my app, where
> > > > > administrators can create menues, add links to the menues and move
> the
> > > > > links up and down in the tree.
> >
> > > > > Now, I am looking how to output this menu with links on the
> frontend.
> >
> > > > > Any suggestions on how I should proceed in this?
> >
> > > > > Currently, I am getting my menues and links in a component, I am
> > > > > initializing the "getmenues" function in component from
> > > > > app_controller.php.
> >
> > > > > And in my views, I call a helper to build the menu ul li li /ul
> >
> > > > > Do I need to use a component for this task? Or can I just include
> > > > > everything in the helper? the database calls I mean?
> >
> > > > > I have noe experience with helpers and components from before, so
> > > > > please be gentle with me ;)
> >
> > > > > Thanks for any and all help on this issue!!
> >
> > > > > BTW: Cake  1.3.13
> >
> > > > > -Tom
> >
> > > > > --
> > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > >http://tv.cakephp.org
> > > > > Check out the new CakePHP Questions
> sitehttp://ask.cakephp.organdhelp
> > > > > others with their CakePHP related questions.
> >
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > > group
> > > > > athttp://groups.google.com/group/cake-php
> >
> > > > --
> > > > Perry | 彭琪http://pengqi.me
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
> >
> > --
> > Perry | 彭琪http://pengqi.me
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>



-- 
Perry | 彭琪
http://pengqi.me

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice output a Dynamic menu

2011-12-12 Thread euromark
such components may get their data automatically
that's what some are for, after all :)

even a helper may use data passed down form the controller/component
automatically.
at least in 2.0 - with $_View being officially available now.



On 12 Dez., 12:08, MetZ  wrote:
> ;)
>
> That was what I thought about helpers yes..
>
> Helper => will be used to generate the menu
>
> You would suggest to pull the menu + links fra database in
> app_controller beforerender, might work fine not using component for
> this.
>
> As I do not need to get the menues on every page, how would you
> suggest to only use the menu database retrival when needed?
>
> using if this params controller= controller ? or something like that?
> or do you know of a better way ?
>
> Thanks for all help and suggestions this far!
>
> -Tom
>
> On 12 Des, 07:17, Perry  wrote:
>
>
>
>
>
>
>
> > helpers should not get data directly, and I remember cakephp doesn't
> > suggest get data in components neither( i cant' find the refer), why not
> > get menu data in AppController's beforeRender method?
>
> > On Sun, Dec 11, 2011 at 8:16 PM, MetZ  wrote:
>
> > > Hi.
>
> > > I am storing my menues and links(tree behavior) in database. I am
> > > using several themes for the system, and hardcoding menues manuallly
> > > foreach theme is not an option.
>
> > > I have no problem outputting the menues and links with a component and
> > > helper in my themes, but i am simply wodering about the best practice
> > > to do this?
>
> > > Example, get menues and links from db in component, generate menu
> > > output with helper.
>
> > > Or should i do all this in the helper?
>
> > > Thanks!
>
> > > tom
>
> > > On Dec 8, 11:42 pm, Perry  wrote:
> > > > why consider components and helpers?
>
> > > > do you store your menu structures in database? why not just treat it as 
> > > > a
> > > > data and output it directly in layout?
>
> > > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > > > > Hi all!
>
> > > > > I am looking for a couple of suggestions.
>
> > > > > I am currently working on a tree menu part of my app, where
> > > > > administrators can create menues, add links to the menues and move the
> > > > > links up and down in the tree.
>
> > > > > Now, I am looking how to output this menu with links on the frontend.
>
> > > > > Any suggestions on how I should proceed in this?
>
> > > > > Currently, I am getting my menues and links in a component, I am
> > > > > initializing the "getmenues" function in component from
> > > > > app_controller.php.
>
> > > > > And in my views, I call a helper to build the menu ul li li /ul
>
> > > > > Do I need to use a component for this task? Or can I just include
> > > > > everything in the helper? the database calls I mean?
>
> > > > > I have noe experience with helpers and components from before, so
> > > > > please be gentle with me ;)
>
> > > > > Thanks for any and all help on this issue!!
>
> > > > > BTW: Cake  1.3.13
>
> > > > > -Tom
>
> > > > > --
> > > > > Our newest site for the community: CakePHP Video Tutorials
> > > > >http://tv.cakephp.org
> > > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > > others with their CakePHP related questions.
>
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > > group
> > > > > athttp://groups.google.com/group/cake-php
>
> > > > --
> > > > Perry | 彭琪http://pengqi.me
>
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > others with their CakePHP related questions.
>
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > > athttp://groups.google.com/group/cake-php
>
> > --
> > Perry | 彭琪http://pengqi.me

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice output a Dynamic menu

2011-12-12 Thread MetZ
;)

That was what I thought about helpers yes..

Helper => will be used to generate the menu

You would suggest to pull the menu + links fra database in
app_controller beforerender, might work fine not using component for
this.

As I do not need to get the menues on every page, how would you
suggest to only use the menu database retrival when needed?

using if this params controller= controller ? or something like that?
or do you know of a better way ?

Thanks for all help and suggestions this far!

-Tom


On 12 Des, 07:17, Perry  wrote:
> helpers should not get data directly, and I remember cakephp doesn't
> suggest get data in components neither( i cant' find the refer), why not
> get menu data in AppController's beforeRender method?
>
>
>
>
>
>
>
>
>
> On Sun, Dec 11, 2011 at 8:16 PM, MetZ  wrote:
>
> > Hi.
>
> > I am storing my menues and links(tree behavior) in database. I am
> > using several themes for the system, and hardcoding menues manuallly
> > foreach theme is not an option.
>
> > I have no problem outputting the menues and links with a component and
> > helper in my themes, but i am simply wodering about the best practice
> > to do this?
>
> > Example, get menues and links from db in component, generate menu
> > output with helper.
>
> > Or should i do all this in the helper?
>
> > Thanks!
>
> > tom
>
> > On Dec 8, 11:42 pm, Perry  wrote:
> > > why consider components and helpers?
>
> > > do you store your menu structures in database? why not just treat it as a
> > > data and output it directly in layout?
>
> > > On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > > > Hi all!
>
> > > > I am looking for a couple of suggestions.
>
> > > > I am currently working on a tree menu part of my app, where
> > > > administrators can create menues, add links to the menues and move the
> > > > links up and down in the tree.
>
> > > > Now, I am looking how to output this menu with links on the frontend.
>
> > > > Any suggestions on how I should proceed in this?
>
> > > > Currently, I am getting my menues and links in a component, I am
> > > > initializing the "getmenues" function in component from
> > > > app_controller.php.
>
> > > > And in my views, I call a helper to build the menu ul li li /ul
>
> > > > Do I need to use a component for this task? Or can I just include
> > > > everything in the helper? the database calls I mean?
>
> > > > I have noe experience with helpers and components from before, so
> > > > please be gentle with me ;)
>
> > > > Thanks for any and all help on this issue!!
>
> > > > BTW: Cake  1.3.13
>
> > > > -Tom
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorials
> > > >http://tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > > others with their CakePHP related questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> > group
> > > > athttp://groups.google.com/group/cake-php
>
> > > --
> > > Perry | 彭琪http://pengqi.me
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
>
> --
> Perry | 彭琪http://pengqi.me

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice output a Dynamic menu

2011-12-11 Thread Perry
helpers should not get data directly, and I remember cakephp doesn't
suggest get data in components neither( i cant' find the refer), why not
get menu data in AppController's beforeRender method?

On Sun, Dec 11, 2011 at 8:16 PM, MetZ  wrote:

>
> Hi.
>
> I am storing my menues and links(tree behavior) in database. I am
> using several themes for the system, and hardcoding menues manuallly
> foreach theme is not an option.
>
> I have no problem outputting the menues and links with a component and
> helper in my themes, but i am simply wodering about the best practice
> to do this?
>
> Example, get menues and links from db in component, generate menu
> output with helper.
>
> Or should i do all this in the helper?
>
> Thanks!
>
> tom
>
> On Dec 8, 11:42 pm, Perry  wrote:
> > why consider components and helpers?
> >
> > do you store your menu structures in database? why not just treat it as a
> > data and output it directly in layout?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > > Hi all!
> >
> > > I am looking for a couple of suggestions.
> >
> > > I am currently working on a tree menu part of my app, where
> > > administrators can create menues, add links to the menues and move the
> > > links up and down in the tree.
> >
> > > Now, I am looking how to output this menu with links on the frontend.
> >
> > > Any suggestions on how I should proceed in this?
> >
> > > Currently, I am getting my menues and links in a component, I am
> > > initializing the "getmenues" function in component from
> > > app_controller.php.
> >
> > > And in my views, I call a helper to build the menu ul li li /ul
> >
> > > Do I need to use a component for this task? Or can I just include
> > > everything in the helper? the database calls I mean?
> >
> > > I have noe experience with helpers and components from before, so
> > > please be gentle with me ;)
> >
> > > Thanks for any and all help on this issue!!
> >
> > > BTW: Cake  1.3.13
> >
> > > -Tom
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
> >
> > --
> > Perry | 彭琪http://pengqi.me
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>



-- 
Perry | 彭琪
http://pengqi.me

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice output a Dynamic menu

2011-12-11 Thread MetZ

Hi.

I am storing my menues and links(tree behavior) in database. I am
using several themes for the system, and hardcoding menues manuallly
foreach theme is not an option.

I have no problem outputting the menues and links with a component and
helper in my themes, but i am simply wodering about the best practice
to do this?

Example, get menues and links from db in component, generate menu
output with helper.

Or should i do all this in the helper?

Thanks!

tom

On Dec 8, 11:42 pm, Perry  wrote:
> why consider components and helpers?
>
> do you store your menu structures in database? why not just treat it as a
> data and output it directly in layout?
>
>
>
>
>
>
>
>
>
> On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:
> > Hi all!
>
> > I am looking for a couple of suggestions.
>
> > I am currently working on a tree menu part of my app, where
> > administrators can create menues, add links to the menues and move the
> > links up and down in the tree.
>
> > Now, I am looking how to output this menu with links on the frontend.
>
> > Any suggestions on how I should proceed in this?
>
> > Currently, I am getting my menues and links in a component, I am
> > initializing the "getmenues" function in component from
> > app_controller.php.
>
> > And in my views, I call a helper to build the menu ul li li /ul
>
> > Do I need to use a component for this task? Or can I just include
> > everything in the helper? the database calls I mean?
>
> > I have noe experience with helpers and components from before, so
> > please be gentle with me ;)
>
> > Thanks for any and all help on this issue!!
>
> > BTW: Cake  1.3.13
>
> > -Tom
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php
>
> --
> Perry | 彭琪http://pengqi.me

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice output a Dynamic menu

2011-12-08 Thread Perry
why consider components and helpers?

do you store your menu structures in database? why not just treat it as a
data and output it directly in layout?

On Fri, Dec 9, 2011 at 9:31 AM, MetZ  wrote:

> Hi all!
>
> I am looking for a couple of suggestions.
>
> I am currently working on a tree menu part of my app, where
> administrators can create menues, add links to the menues and move the
> links up and down in the tree.
>
> Now, I am looking how to output this menu with links on the frontend.
>
> Any suggestions on how I should proceed in this?
>
> Currently, I am getting my menues and links in a component, I am
> initializing the "getmenues" function in component from
> app_controller.php.
>
> And in my views, I call a helper to build the menu ul li li /ul
>
> Do I need to use a component for this task? Or can I just include
> everything in the helper? the database calls I mean?
>
> I have noe experience with helpers and components from before, so
> please be gentle with me ;)
>
> Thanks for any and all help on this issue!!
>
> BTW: Cake  1.3.13
>
> -Tom
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>



-- 
Perry | 彭琪
http://pengqi.me

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best Practice (import, used, class registry)

2011-10-27 Thread majna
Shortest one :)

$Model = ClassRegistry::init([Plugin].[Model]);

or 

$posts = ClassRegistry::init('Blog.Post')->find('all');

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice? Building a search string with multiple options

2011-10-06 Thread majna
You can use "named params", as in https://github.com/CakeDC/search

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice for pending/approved flag for comments in a blog

2011-10-06 Thread Austin Pickett
Have you tried using disqus plugin? It works rather smoothly.
On Oct 6, 2011 10:13 AM, "Jeremy Burns | Class Outfit" <
jeremybu...@classoutfit.com> wrote:
> You might want to consider a field for the id of the reviewer, something
to indicate their decision (they might decline it) and the time/date of that
decision.
>
> Jeremy Burns
> Class Outfit
>
> Tel: +44 (0) 208 123 3822
> Mob: +44 (0) 7973 481949
> Skype: jeremy_burns
> http://www.classoutfit.com
>
> On 6 Oct 2011, at 15:08, Boyan Penev wrote:
>
>> Thank you both for the useful help.
>>
>> Regards,
>>
>> Boyan
>>
>> On Thu, Oct 6, 2011 at 3:36 PM, euromark 
wrote:
>>> it seems a simply boolean (tinyint 1) is enough in your case
>>>
>>>
>>> On 6 Okt., 15:14, Zaky Katalan-Ezra  wrote:
 You can review CakeDC comments pluginhttps://github.com/CakeDC/comments







 On Wed, Oct 5, 2011 at 11:02 AM, Boyan  wrote:
> Hello,

> I am trying to develop a blog- like application with Cakephp and have
> a rather general question.
> The comments for each post should be first reviewed by the author of
> the post, before becoming visible (Comment belongsTo Article, Comment
> belongsTo User, Post belongsTo User)

> So my question is- what would be the best way to go about it? Would a
> boolean flag in the sql table for the comments suffice? And if so- is
> it secure enough? Or should I rather use ACL? Or maybe a completely
> different approach?

> Thank you,

> Boyan

> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> others with their CakePHP related questions.

> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this
group
> athttp://groups.google.com/group/cake-php
>>>
>>> --
>>> Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
>>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.
>>>
>>>
>>> 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
>>>
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.
>>
>>
>> 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
>
> --
> Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
others with their CakePHP related questions.
>
>
> 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice for pending/approved flag for comments in a blog

2011-10-06 Thread Jeremy Burns | Class Outfit
You might want to consider a field for the id of the reviewer, something to 
indicate their decision (they might decline it) and the time/date of that 
decision.

Jeremy Burns
Class Outfit

Tel: +44 (0) 208 123 3822
Mob: +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com

On 6 Oct 2011, at 15:08, Boyan Penev wrote:

> Thank you both for the useful help.
> 
> Regards,
> 
> Boyan
> 
> On Thu, Oct 6, 2011 at 3:36 PM, euromark  wrote:
>> it seems a simply boolean (tinyint 1) is enough in your case
>> 
>> 
>> On 6 Okt., 15:14, Zaky Katalan-Ezra  wrote:
>>> You can review CakeDC comments pluginhttps://github.com/CakeDC/comments
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On Wed, Oct 5, 2011 at 11:02 AM, Boyan  wrote:
 Hello,
>>> 
 I am trying to develop a blog- like application with Cakephp and have
 a rather general question.
 The comments for each post should be first reviewed by the author of
 the post, before becoming visible (Comment belongsTo Article, Comment
 belongsTo User, Post belongsTo User)
>>> 
 So my question is- what would be the best way to go about it? Would a
 boolean flag in the sql table for the comments suffice? And if so- is
 it secure enough? Or should I rather use ACL? Or maybe a completely
 different approach?
>>> 
 Thank you,
>>> 
 Boyan
>>> 
 --
 Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
 Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
 others with their CakePHP related questions.
>>> 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 athttp://groups.google.com/group/cake-php
>> 
>> --
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>> 
>> 
>> 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
>> 
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice for pending/approved flag for comments in a blog

2011-10-06 Thread Boyan Penev
Thank you both for the useful help.

Regards,

Boyan

On Thu, Oct 6, 2011 at 3:36 PM, euromark  wrote:
> it seems a simply boolean (tinyint 1) is enough in your case
>
>
> On 6 Okt., 15:14, Zaky Katalan-Ezra  wrote:
>> You can review CakeDC comments pluginhttps://github.com/CakeDC/comments
>>
>>
>>
>>
>>
>>
>>
>> On Wed, Oct 5, 2011 at 11:02 AM, Boyan  wrote:
>> > Hello,
>>
>> > I am trying to develop a blog- like application with Cakephp and have
>> > a rather general question.
>> > The comments for each post should be first reviewed by the author of
>> > the post, before becoming visible (Comment belongsTo Article, Comment
>> > belongsTo User, Post belongsTo User)
>>
>> > So my question is- what would be the best way to go about it? Would a
>> > boolean flag in the sql table for the comments suffice? And if so- is
>> > it secure enough? Or should I rather use ACL? Or maybe a completely
>> > different approach?
>>
>> > Thank you,
>>
>> > Boyan
>>
>> > --
>> > Our newest site for the community: CakePHP Video Tutorials
>> >http://tv.cakephp.org
>> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
>> > others with their CakePHP related questions.
>>
>> > To unsubscribe from this group, send email to
>> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> > athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice for pending/approved flag for comments in a blog

2011-10-06 Thread euromark
it seems a simply boolean (tinyint 1) is enough in your case


On 6 Okt., 15:14, Zaky Katalan-Ezra  wrote:
> You can review CakeDC comments pluginhttps://github.com/CakeDC/comments
>
>
>
>
>
>
>
> On Wed, Oct 5, 2011 at 11:02 AM, Boyan  wrote:
> > Hello,
>
> > I am trying to develop a blog- like application with Cakephp and have
> > a rather general question.
> > The comments for each post should be first reviewed by the author of
> > the post, before becoming visible (Comment belongsTo Article, Comment
> > belongsTo User, Post belongsTo User)
>
> > So my question is- what would be the best way to go about it? Would a
> > boolean flag in the sql table for the comments suffice? And if so- is
> > it secure enough? Or should I rather use ACL? Or maybe a completely
> > different approach?
>
> > Thank you,
>
> > Boyan
>
> > --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice for pending/approved flag for comments in a blog

2011-10-06 Thread Zaky Katalan-Ezra
You can review CakeDC comments plugin
https://github.com/CakeDC/comments

On Wed, Oct 5, 2011 at 11:02 AM, Boyan  wrote:

> Hello,
>
> I am trying to develop a blog- like application with Cakephp and have
> a rather general question.
> The comments for each post should be first reviewed by the author of
> the post, before becoming visible (Comment belongsTo Article, Comment
> belongsTo User, Post belongsTo User)
>
> So my question is- what would be the best way to go about it? Would a
> boolean flag in the sql table for the comments suffice? And if so- is
> it secure enough? Or should I rather use ACL? Or maybe a completely
> different approach?
>
> Thank you,
>
> Boyan
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Best practice query - Where to render element

2010-07-16 Thread cricket
On Thu, Jul 15, 2010 at 5:28 PM, sanedevil  wrote:
> @Nabil, @Sam,
> thanks both for your ideas! I believe for consistency sake thruout the
> app, i'll stick to the controller->view->element chain (comin from a
> J2EE backgrnd, its hard to break conventions and rules :) ) But of
> course as you guys suggested, i can excuse myself in certain cases.

 I missed this thread earlier but I'll just chime in that I often
render elements from the controller. In my case, it's generally for
AJAX calls. On normal page load, the View calls the element (say, a
paged listing of Users) but, for an AJAX request, only the element
needs to be rendered.

if ($this->RequestHandler->isAjax())
{
$this->layout = false;
$this->viewPath = 'elements'.DS.'users';
$this->render('pagination');
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best practice query - Where to render element

2010-07-15 Thread sanedevil
@Nabil, @Sam,
thanks both for your ideas! I believe for consistency sake thruout the
app, i'll stick to the controller->view->element chain (comin from a
J2EE backgrnd, its hard to break conventions and rules :) ) But of
course as you guys suggested, i can excuse myself in certain cases.

KS

On Jul 15, 12:26 am, Sam  wrote:
> One use I've had for rendering an element in the controller(well, from
> a component actually) is for a form plugin- my users could put a
> bbcode like tag in the body of a page and it would render the proper
> form within their content... normally I would do this processing with
> a helper, but the form fields were stored in the database, which made
> a component a more logical place to retrieve the data and render the
> element.
>
> On Jul 14, 1:17 pm, Nabil Alsharif  wrote:
>
> > It's usually best to have the view render the elements and to pass
> > settings/variables to view  that passes it on to the element but
> > to every rule there are exceptions.
>
> > On Wed, Jul 14, 2010 at 1:52 PM, sanedevil  wrote:
> > > Hi Bakers!
> > > Is it ok to render an element from a controller? Or as a best
> > > practice, let the controller always render the view and then in the
> > > view render the element?
>
> > > Thanks! KS
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > > with their CakePHP related questions.
>
> > > 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 
> > > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best practice query - Where to render element

2010-07-14 Thread Sam
One use I've had for rendering an element in the controller(well, from
a component actually) is for a form plugin- my users could put a
bbcode like tag in the body of a page and it would render the proper
form within their content... normally I would do this processing with
a helper, but the form fields were stored in the database, which made
a component a more logical place to retrieve the data and render the
element.

On Jul 14, 1:17 pm, Nabil Alsharif  wrote:
> It's usually best to have the view render the elements and to pass
> settings/variables to view  that passes it on to the element but
> to every rule there are exceptions.
>
>
>
> On Wed, Jul 14, 2010 at 1:52 PM, sanedevil  wrote:
> > Hi Bakers!
> > Is it ok to render an element from a controller? Or as a best
> > practice, let the controller always render the view and then in the
> > view render the element?
>
> > Thanks! KS
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best practice query - Where to render element

2010-07-14 Thread Nabil Alsharif
It's usually best to have the view render the elements and to pass
settings/variables to view  that passes it on to the element but
to every rule there are exceptions.

On Wed, Jul 14, 2010 at 1:52 PM, sanedevil  wrote:
> Hi Bakers!
> Is it ok to render an element from a controller? Or as a best
> practice, let the controller always render the view and then in the
> view render the element?
>
> Thanks! KS
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> 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
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best practice for referencing a model in app controller

2010-05-18 Thread nMac
Hi,

what I did is exactly what euromark did; except that I wrapped it into a
method in app_controller:

function loadInexistentModel($Model){
if(!isset($this->$Model)){
$this->loadModel($Model);
}
}

I think it's the best option

Best,

Nicolás Andrade
www.nmac.com.ar
www.nicoandra.com.ar


On Tue, May 18, 2010 at 2:14 PM, euromark wrote:

> sometimes it might already be available, sometimes not
>
> if (!isset($this->ModelName)) {
>  $this->ModelName = ClassRegistry::init('ModelName');
> }
> $this->ModelName->getNav();
> ...
>
> On 18 Mai, 15:37, "Dr. Loboto"  wrote:
> > $this->loadModel('Section');
> > $this->Section->getNav();
> >
> > On May 18, 4:45 pm, "christh...@gmail.com" 
> > wrote:
> >
> >
> >
> > > In most projects I find I need to reference one model in every context
> > > say for example 'sections' which holds the top level navigation,
> > > usually I place a function in the app_controller that gets the
> > > navigation details and adds them to the view, whats the best way to
> > > access the model ?
> >
> > > Currently I'm using;
> > >$this->{$this->modelClass}->Section->getNav();
> >
> > > which is messy, or
> >
> > > $section = ClassRegistry::init('Section');
> > > $section->getNav();
> >
> > > a bit better, but what is the 'proper' way to do it?
> >
> > > chris
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> with their CakePHP related questions.
> >
> > > 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.comFor
> > >  more options, visit this group athttp://
> groups.google.com/group/cake-php?hl=en
> >
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
> >
> > 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.comFor
> >  more options, visit this group athttp://
> groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best practice for referencing a model in app controller

2010-05-18 Thread euromark
sometimes it might already be available, sometimes not

if (!isset($this->ModelName)) {
  $this->ModelName = ClassRegistry::init('ModelName');
}
$this->ModelName->getNav();
...

On 18 Mai, 15:37, "Dr. Loboto"  wrote:
> $this->loadModel('Section');
> $this->Section->getNav();
>
> On May 18, 4:45 pm, "christh...@gmail.com" 
> wrote:
>
>
>
> > In most projects I find I need to reference one model in every context
> > say for example 'sections' which holds the top level navigation,
> > usually I place a function in the app_controller that gets the
> > navigation details and adds them to the view, whats the best way to
> > access the model ?
>
> > Currently I'm using;
> >    $this->{$this->modelClass}->Section->getNav();
>
> > which is messy, or
>
> > $section = ClassRegistry::init('Section');
> > $section->getNav();
>
> > a bit better, but what is the 'proper' way to do it?
>
> > chris
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best practice for referencing a model in app controller

2010-05-18 Thread Dr. Loboto
$this->loadModel('Section');
$this->Section->getNav();

On May 18, 4:45 pm, "christh...@gmail.com" 
wrote:
> In most projects I find I need to reference one model in every context
> say for example 'sections' which holds the top level navigation,
> usually I place a function in the app_controller that gets the
> navigation details and adds them to the view, whats the best way to
> access the model ?
>
> Currently I'm using;
>    $this->{$this->modelClass}->Section->getNav();
>
> which is messy, or
>
> $section = ClassRegistry::init('Section');
> $section->getNav();
>
> a bit better, but what is the 'proper' way to do it?
>
> chris
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Best practice : Main/Pages/Index Controller for common actions/sites?

2009-07-10 Thread Carlos Gonzalez Lavin
Also, you can have pages controller handle pages that would fall under
"content" category... or just go ahead and make a new content controller
(which you could use to manage controller's contents, such as contact form
content, welcome page content, about page content...)
You could even top it off using some elements for stuff like sidebars in the
home page, about latest post and latest news and so on..

2009/7/10 Netik 

>
> Hi everyone
> I'm pretty new to cakephp or the model view controller and oop
> programming in general.
>
> However, i see the big advantages of cakephp and i really like it, it
> just makes fun.
> Howevery, i still have some questions about cakephp or MVC in general:
>
> If i want to make a website...let's say, it contains a welcome page, a
> blog, some news and a section with details about other websites/
> products of me. And some of the common pages like a contact form.
>
> How many controllers would you create?
>
> -NewsController
> -BlogController
> -ProductsController
> -WebsitesController
>
> And then? How should i handle the contactForm and the welcome page?
> Should i create a "main"-Controller that handles sites/actions that
> doesn't require an own controller?
> I mean, is ridiculous to create a contactController just for an index
> and sendEmail action and a welcomeController for showing 1 page, isn't
> it?
>
> And the other question is about an admin section/backend. I have seen
> the nice function "admin_routing".
> So i could make an admin_add/delete/edit/index function for my news,
> blog, products and website controllers. Howevery, i would like to have
> a "default" or "home/welcome" page in the adminpanel that shows some
> general information like "all the blog posts/websites/products/news i
> posted in the last week" and how many users are actually on the page.
>
> How do i handle these cases?
>
> PS. Sorry for my english, if you can speak german i would prefer :)
>
> Greetings
>
> >
>

--~--~-~--~~~---~--~~
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: Best practice : Main/Pages/Index Controller for common actions/sites?

2009-07-10 Thread GravyFace

On Fri, Jul 10, 2009 at 5:43 AM, Netik wrote:
>
> Hi everyone
> I'm pretty new to cakephp or the model view controller and oop
> programming in general.
>
> However, i see the big advantages of cakephp and i really like it, it
> just makes fun.
> Howevery, i still have some questions about cakephp or MVC in general:
>
> If i want to make a website...let's say, it contains a welcome page, a
> blog, some news and a section with details about other websites/
> products of me. And some of the common pages like a contact form.
>
> How many controllers would you create?
>
> -NewsController
> -BlogController
> -ProductsController
> -WebsitesController
>
> I mean, is ridiculous to create a contactController just for an index
> and sendEmail action and a welcomeController for showing 1 page, isn't
> it?

Why would it be ridiculous?  Controllers should be sparse, and since
you're using controllers for everything else, the next person (or you,
in 12 months, after you've added a 10 more controllers), doesn't have
to guess where you put the contact actions.

If you're referring to the homepage of your site, just create
\app\views\pages\home.ctp

> And the other question is about an admin section/backend. I have seen
> the nice function "admin_routing".
> So i could make an admin_add/delete/edit/index function for my news,
> blog, products and website controllers. Howevery, i would like to have
> a "default" or "home/welcome" page in the adminpanel that shows some
> general information like "all the blog posts/websites/products/news i
> posted in the last week" and how many users are actually on the page.

If you're thinking about doing a dashboard, take a look at this:
http://teknoid.wordpress.com/2008/12/16/how-to-build-a-dashboard-for-your-application-in-cakephp/

(^^^ great blog, btw)

> PS. Sorry for my english, if you can speak german i would prefer :)

Your post was fine; no worries.

--~--~-~--~~~---~--~~
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: Best Practice?

2009-03-05 Thread Aurelius

But the I'm in the EntryController, the associations would be more
complex
than in the Blog.
I would need to connect the Entry to the Blog to the languages and
then
load more Entries at the same time in the edit-page...

thx
Aurelius

On 5 Mrz., 00:07, brian  wrote:
> When you fetch the data for a BlogEntry, you can also get the Blog
> info. Have a look at ContainableBehavior (or setting recursive in find
> conditions). You can have Cake fetch data from any other table row
> (model instance) which is associated with BlogEntry.
>
> On Wed, Mar 4, 2009 at 7:14 AM, Aurelius  wrote:
>
> > Hi!
>
> > I have a Software Design Question, here's what I want to do (a bit
> > simplified for better understanding):
>
> > I have following tables:
> > Users -> hasMany -> Blogs -> hasMany -> Entries
> > Users -> hasAndBelongsToMany -> Languages
> > Blogs -> hasAndBelongsToMany -> Languages
> > Entries use the TranslationBehaviour.
> > So User one or more Blogs and can chose the languages in which he post
> > all his blogentrie.
> > An example would be:
> > User (id=5,name=max) has one blog
> > (id=7,name=myblog,languages=eng,ger).
> > So every blogentry is saved in eng and ger with the
> > TranslationBehaviour.
>
> > Now to the Design Part.
> > Is it now right that I have to programm the whole Backend in the
> > BlogController (while saving the Owner id in a session)?
> > When I want to edit a Blogentry I need to know the settings of the
> > blog...
>
> > And other Design Ideas?
>
> > thx
> > Aurelius
--~--~-~--~~~---~--~~
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: Best Practice?

2009-03-04 Thread brian

When you fetch the data for a BlogEntry, you can also get the Blog
info. Have a look at ContainableBehavior (or setting recursive in find
conditions). You can have Cake fetch data from any other table row
(model instance) which is associated with BlogEntry.

On Wed, Mar 4, 2009 at 7:14 AM, Aurelius  wrote:
>
> Hi!
>
> I have a Software Design Question, here's what I want to do (a bit
> simplified for better understanding):
>
> I have following tables:
> Users -> hasMany -> Blogs -> hasMany -> Entries
> Users -> hasAndBelongsToMany -> Languages
> Blogs -> hasAndBelongsToMany -> Languages
> Entries use the TranslationBehaviour.
> So User one or more Blogs and can chose the languages in which he post
> all his blogentrie.
> An example would be:
> User (id=5,name=max) has one blog
> (id=7,name=myblog,languages=eng,ger).
> So every blogentry is saved in eng and ger with the
> TranslationBehaviour.
>
> Now to the Design Part.
> Is it now right that I have to programm the whole Backend in the
> BlogController (while saving the Owner id in a session)?
> When I want to edit a Blogentry I need to know the settings of the
> blog...
>
> And other Design Ideas?
>
> thx
> Aurelius
> >
>

--~--~-~--~~~---~--~~
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: Best Practice needed: How to deal with 'hasMany' Associations in an add-View

2008-12-17 Thread volka

Hi Eddie,
I (hopefully) described my problem a way better in this newer post:
http://groups.google.com/group/cake-php/browse_thread/thread/287a47eb678cc8a1#

(I want to store unique data from the same form. )



On 16 Dez., 16:04, Smelly_Eddie  wrote:
> I'm not sure I understand.
>
> Are you attempting to save duplicate data to both A and B.  Or do you
> wish to save unique data to A and B but from the same form.
>
> On Dec 15, 3:20 pm, volka  wrote:
>
>
>
> > Hi there,
> > I hope someone is going to share his best practice(s) with me :-)
>
> > I have a model A which has a 'hasMany' association with model B. model
> > B 'belongsTo' model A.
>
> > Now when adding A's to my database I'd like to add B's at the same
> > time and in one
> > , as well.
>
> > In A->add(), I would copy B->add()...
>
> > What do you think? Is that reasonable?
> > Or would you do it different?
>
> > Thanks and kind regards,
> > volka- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
--~--~-~--~~~---~--~~
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: Best Practice needed: How to deal with 'hasMany' Associations in an add-View

2008-12-16 Thread Smelly_Eddie

I'm not sure I understand.

Are you attempting to save duplicate data to both A and B.  Or do you
wish to save unique data to A and B but from the same form.



On Dec 15, 3:20 pm, volka  wrote:
> Hi there,
> I hope someone is going to share his best practice(s) with me :-)
>
> I have a model A which has a 'hasMany' association with model B. model
> B 'belongsTo' model A.
>
> Now when adding A's to my database I'd like to add B's at the same
> time and in one
> , as well.
>
> In A->add(), I would copy B->add()...
>
> What do you think? Is that reasonable?
> Or would you do it different?
>
> Thanks and kind regards,
> volka
--~--~-~--~~~---~--~~
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: Best practice MVC Drop Down

2008-11-19 Thread teknoid

use find('list'); ... it's covered in the manual

On Nov 19, 5:34 pm, pkclarke <[EMAIL PROTECTED]> wrote:
> What is the best way to populate a Drop Down list from data stored in
> the database?  Assuming that only selected fields are required and the
> data needs to be filtered to returns selected rows
>
> (e.g. SELECT id, description FROM states WHERE country_id = 1)
>
> Which of the following solutions would be best practice using the MVC
> pattern:
>
> 1. Create a function in the Model to return an Array containing the
> required data?
>
> 2. Create a function in the Controller to return an Array containing
> the required data?
>
> 3. Create a view in the database with it's own model & 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for plugin configuration

2008-09-19 Thread Abhimanyu Grover

I also prefer having a seperate bootstrap.php files for plugins which
are also used as config files for them.

Here's what you can do:

$Folder =& new Folder(APP.'plugins');
$plugins = $Folder->ls(); // for better performance - make sure you
cache it somewhere

foreach($plugins as $plugin)
{
// include bootstrap.php of all plugins
if(file_exists(APP.DS.'plugins'.DS.$plugin.DS.'bootstrap.php'))
{
require_once(APP.DS.'plugins'.DS.$plugin.DS.'bootstrap.php');
}
}

On Sep 1, 4:03 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> I'm not using it in plugins right now, but in my apps I use a config like 
> this:
>
> APP/config/settings.php
>
>  $config['Settings']['name'] = 'Planeta';
> $config['Settings']['auth'] = array(
>         'enabled' => true,
>         'options' => array(
>                 
>
> ?>
>
> Also I'm not aware of any convention about plugins config, but I would
> choose a sepparated config file for everyplugin, but it's just a
> matter of taste, ex: APP/config/plugin.php
>
> On Sun, Aug 31, 2008 at 5:16 PM, Filippo Toso
>
> <[EMAIL PROTECTED]> wrote:
>
> > On 31 Ago, 20:30, Filippo Toso <[EMAIL PROTECTED]> wrote:
>
> >> Is there a naming convention for the configuration fields?
>
> >> // /app/config/plugin_name.php:
> >>  >> $config['Plugins']['PluginName']['config_field_1'] = true;
> >> $config['Plugins']['PluginName']['config_field_2'] = false;
> >> $config['Plugins']['PluginName']['config_field_3'] = 123;
> >> ?>
>
> > Probably the correct format is:
>
> > // /app/config/plugin_name.php:
> >  > $config['Plugins.PluginName.config_field_1'] = true;
> > $config['Plugins.PluginName.config_field_2'] = false;
> > $config['Plugins.PluginName.config_field_3'] = 123;
> > ?>
>
> > Sincerely,
> > Filippo Toso
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for plugin configuration

2008-08-31 Thread Dardo Sordi Bogado

I'm not using it in plugins right now, but in my apps I use a config like this:

APP/config/settings.php

 true,
'options' => array(


?>

Also I'm not aware of any convention about plugins config, but I would
choose a sepparated config file for every plugin, but it's just a
matter of taste, ex: APP/config/plugin.php

On Sun, Aug 31, 2008 at 5:16 PM, Filippo Toso
<[EMAIL PROTECTED]> wrote:
>
> On 31 Ago, 20:30, Filippo Toso <[EMAIL PROTECTED]> wrote:
>>
>> Is there a naming convention for the configuration fields?
>>
>> // /app/config/plugin_name.php:
>> > $config['Plugins']['PluginName']['config_field_1'] = true;
>> $config['Plugins']['PluginName']['config_field_2'] = false;
>> $config['Plugins']['PluginName']['config_field_3'] = 123;
>> ?>
>
> Probably the correct format is:
>
> // /app/config/plugin_name.php:
>  $config['Plugins.PluginName.config_field_1'] = true;
> $config['Plugins.PluginName.config_field_2'] = false;
> $config['Plugins.PluginName.config_field_3'] = 123;
> ?>
>
> Sincerely,
> Filippo Toso
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for plugin configuration

2008-08-31 Thread Filippo Toso

On 31 Ago, 20:30, Filippo Toso <[EMAIL PROTECTED]> wrote:
>
> Is there a naming convention for the configuration fields?
>
> // /app/config/plugin_name.php:
>  $config['Plugins']['PluginName']['config_field_1'] = true;
> $config['Plugins']['PluginName']['config_field_2'] = false;
> $config['Plugins']['PluginName']['config_field_3'] = 123;
> ?>

Probably the correct format is:

// /app/config/plugin_name.php:


Sincerely,
Filippo Toso
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for plugin configuration

2008-08-31 Thread Filippo Toso

Dear Dardo,

> Look at Configure::load().
>
> I would prefer to use good defaults if there is no plugin config
> loaded, and then have the plugin config in the app/config/plugin.php.

Thank you for the suggestion.

Is there a naming convention for the configuration fields?

Maybe something like this?

// /app/config/plugin_name.php:


Where 'PluginName' is the name of the plugin I'm going to create.

Is there another way to avoid possible name conflicts?

> The benefits are that if you need to change something, just need to
> create a config in the app config dir, so plugin code gets untouched
> and can be easily upgraded. Also all the app config get's stored in
> the same place.

That exactly what I'm searching for :)

Sincerely,
Filippo Toso

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for plugin configuration

2008-08-31 Thread Dardo Sordi Bogado

Look at Configure::load().

I would prefer to use good defaults if there is no plugin config
loaded, and then have the plugin config in the app/config/plugin.php.

The benefits are that if you need to change something, just need to
create a config in the app config dir, so plugin code gets untouched
and can be easily upgraded. Also all the app config get's stored in
the same place.


-Dardo.

On Fri, Aug 29, 2008 at 6:56 PM, Filippo Toso
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm going to create an authentication plugin for Cake 1.2 (login/
> logout/registration/etc.).
>
> I would like to make it a bit customizable using a sort of
> configuration (i.e. use captcha, users model, etc.).
>
> Which is the best way to achieve this?
>
> A plugin doesn't have a bootstrap.php file that is loaded at startup.
> As far as I have understood, the only file where I can load a kind of
> "global plugin configuration" is the  plugin AppController class file.
> Maybe using a code like the following:
>
> // /app/plugins/auth/auth_app_controller.php:
> 
> require_once(dirname(__FILE__) . DS . 'config' . DS .
> 'bootstrap.php');
>
> class AuthAppController extends AppController {
> //...
> }
> ?>
>
> // /app/plugins/auth/config/bootstrap.php:
>  Configure::write(
>'AuthPlugin', array('use_captcha' => true,
>'require_verification' => false,
>'users_model', 'users')
>);
> ?>
>
> Is there a better way? Maybe using some constant instead of the
> Configure class. Is there another file that is loaded automagically by
> CakePHP when a plugin is loaded?
>
> Thank you for any suggestion.
>
> Sincerely,
> Filippo Toso
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice: DB table data needed in a view helper?

2008-08-19 Thread Mark (Germany)

thx
i might actually consider that for getting the information
cached file - and if not possible manually through a query

the helper still needs to be a helper though
but this way there is backup :)

if i would just use the element without caching
this could be quit a lot of more "server load" to handle
as this helper (and therefore the table content) is needed on many
pages.


On 19 Aug., 00:49, francky06l <[EMAIL PROTECTED]> wrote:
> @Mark,
>
> Kalt suggestion is goof for an element. You could also user an helper
> and caching. The helper would check the cached file, if not there or
> expired your helper can do a requestAction and cache the results for
> future calls.
> I use this quite a lot for fetching data for select for example (like
> for a category list, not changing every 10 seconds, and avoiding
> queries), and manually delete the cache when I update the tables..
>
> hth
>
> On Aug 19, 12:38 am, Kalt <[EMAIL PROTECTED]> wrote:
>
> > Take a look at the "requestAction" method.
>
> > And instead of a helper, I think you'd better use an element.
>
> > On 19 août, 00:06, "Mark (Germany)" <[EMAIL PROTECTED]>
> > wrote:
>
> > > I have a helper which needs the "codecats" table data (20-40 rows)
> > > everywhere where it is used.
> > > i sure could ask for it in the controller:
> > > ->list('all')..
> > > and pass it the view
> > > there i can again pass it to the helper
>
> > > but is there
> > > a) a way to automatically pass it from the controller to the helper
> > > b) directly get the information into the helper (without having to
> > > manually query the DB)
>
> > > i have thought about using some caching or file-exporting (xml)
> > > the helper could read out this file again.
> > > but - what kind of backup would there be if the file gets lost somehow
> > > (as it is in temp folder the max lifetime may be over some time)?
> > > or is this a good practive anyway?
>
> > > thats what is bothering me right now
> > > as i do not know how to stick to the MVC pattern
>
> > > especially because this helper is not bound to specific controllers
> > > and may be used quite a lot.
> > > so it would be really a huge load of code if i have to do it as
> > > described above: controller -> view -> helper
>
> > > thx
> > > mark
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice: DB table data needed in a view helper?

2008-08-18 Thread francky06l

@Mark,

Kalt suggestion is goof for an element. You could also user an helper
and caching. The helper would check the cached file, if not there or
expired your helper can do a requestAction and cache the results for
future calls.
I use this quite a lot for fetching data for select for example (like
for a category list, not changing every 10 seconds, and avoiding
queries), and manually delete the cache when I update the tables..

hth

On Aug 19, 12:38 am, Kalt <[EMAIL PROTECTED]> wrote:
> Take a look at the "requestAction" method.
>
> And instead of a helper, I think you'd better use an element.
>
> On 19 août, 00:06, "Mark (Germany)" <[EMAIL PROTECTED]>
> wrote:
>
> > I have a helper which needs the "codecats" table data (20-40 rows)
> > everywhere where it is used.
> > i sure could ask for it in the controller:
> > ->list('all')..
> > and pass it the view
> > there i can again pass it to the helper
>
> > but is there
> > a) a way to automatically pass it from the controller to the helper
> > b) directly get the information into the helper (without having to
> > manually query the DB)
>
> > i have thought about using some caching or file-exporting (xml)
> > the helper could read out this file again.
> > but - what kind of backup would there be if the file gets lost somehow
> > (as it is in temp folder the max lifetime may be over some time)?
> > or is this a good practive anyway?
>
> > thats what is bothering me right now
> > as i do not know how to stick to the MVC pattern
>
> > especially because this helper is not bound to specific controllers
> > and may be used quite a lot.
> > so it would be really a huge load of code if i have to do it as
> > described above: controller -> view -> helper
>
> > thx
> > mark
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice: DB table data needed in a view helper?

2008-08-18 Thread Kalt

Take a look at the "requestAction" method.

And instead of a helper, I think you'd better use an element.

On 19 août, 00:06, "Mark (Germany)" <[EMAIL PROTECTED]>
wrote:
> I have a helper which needs the "codecats" table data (20-40 rows)
> everywhere where it is used.
> i sure could ask for it in the controller:
> ->list('all')..
> and pass it the view
> there i can again pass it to the helper
>
> but is there
> a) a way to automatically pass it from the controller to the helper
> b) directly get the information into the helper (without having to
> manually query the DB)
>
> i have thought about using some caching or file-exporting (xml)
> the helper could read out this file again.
> but - what kind of backup would there be if the file gets lost somehow
> (as it is in temp folder the max lifetime may be over some time)?
> or is this a good practive anyway?
>
> thats what is bothering me right now
> as i do not know how to stick to the MVC pattern
>
> especially because this helper is not bound to specific controllers
> and may be used quite a lot.
> so it would be really a huge load of code if i have to do it as
> described above: controller -> view -> helper
>
> thx
> mark
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practice Newb Question

2008-05-21 Thread schneimi

You can use the time-Helper to format your timestamps.

On 21 Mai, 05:56, phaedo5 <[EMAIL PROTECTED]> wrote:
> I'm outputting fields from a database.  I have the basic add, edit,
> index pages.  I have a controller with all the add, edit, delete, etc.
> functions.
>
> I'm a little fuzzy on where to put the formatting for my fields.  See,
> I want to assign a few of the database fields to variables.  And I
> want to format a few of the timestamp fields into human date formats.
> I know how to do all of this with php, but where do I put it.  Is it
> ok to put that kind of stuff in a view, or is that breaking down the
> whole logic of the MVC.
>
> Of course, if I were looping through fields of a database, the on-the-
> fly formatting would almost have to go in the view, correct?
>
> I'm just starting out and I don't want to develop bad habits now.
>
> Any thoughts?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practice Newb Question

2008-05-21 Thread Filip Camerman

MVC orthodoxy would require you to do this in the view. The controller
just sends raw data to the view, formatting that data is part of the
presentation logic and hence belongs in the view.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice or not for using Email component in the model

2008-05-07 Thread Marcin Domanski

Hey
>  Alternatively, you could create a Email model which saves info to the
>  database, which is then read from a shell scheduled in cron to send
>  the actual emails :)
I used the email component this way - Email model and saving the
serialized data,template name subject etc in the db and send the
actual email using Jippis email shell (bakery).

In this case i personally don't see a problem triggering email sending
in afterSave.

You can use App:import to get the component.


-- 
Marcin Domanski
http://kabturek.info

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice or not for using Email component in the model

2008-05-07 Thread Adam Royle

Something I have wondered as well. From some light research it seems
ROR uses ActionMailer::Base subclassed as a model that renders views.

Maybe someone from the cake core can give their opinion.

Alternatively, you could create a Email model which saves info to the
database, which is then read from a shell scheduled in cron to send
the actual emails :)

Adam

On May 7, 11:13 pm, dericknwq <[EMAIL PROTECTED]> wrote:
> There are times where I seriously feel the need to send an email from
> the model like at the afterSave() stage or something. Say each time a
> new comment is added to a post, a notification will be sent to
> participants depending on certain conditions. It just feels more
> correct having those checks and sending of emails in the model.
>
> E.g. Controller:
>
> $this->Model->saveThis($someComment);
> if ($this->Model->shouldSendNotification()) {
>   $data = $this->Model->getNecessaryData();
>   $this->__sendNotificationWithEmailComponent($data);
>
> }
>
> Why not have saveThis() do the work and send the notifications? I do
> think that it will be possible to just pass the Email component into
> the model but is that technically correct? How did you do yours?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for setting current user variable?

2008-04-18 Thread Sourabh Sharma

I don't understand the question but if you want to say that you want
to access the which user sis logged in then you have to create
afunction for log in the APP Controller file, then you can access
easily in the whole controller because we extends the very controller
to APPController.

Please explain your question so we easily provide the best solution.

Thanks & Regards
Sourabh Sharma

On Apr 19, 6:44 am, "b logica" <[EMAIL PROTECTED]> wrote:
> I store a $user array in the Session upon login and then read() it in
> whichever methods I need some bit of info (mostly the ID, of course).
>
> On Fri, Apr 18, 2008 at 7:39 PM, John R <[EMAIL PROTECTED]> wrote:
>
> >  How do you all set the current user per controller?

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



Re: Best practice for setting current user variable?

2008-04-18 Thread b logica

I store a $user array in the Session upon login and then read() it in
whichever methods I need some bit of info (mostly the ID, of course).

On Fri, Apr 18, 2008 at 7:39 PM, John R <[EMAIL PROTECTED]> wrote:
>
>  How do you all set the current user per controller?
>  >
>

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



Re: Best practice for SQL data sanitation

2008-03-26 Thread b logica

For the record, HTML entities are harmless WRT SQL injection.

On Wed, Mar 26, 2008 at 6:00 PM, Adam Royle <[EMAIL PROTECTED]> wrote:
>
>  Cake automatically handles quoting strings etc when saving to the
>  database. Sanitize is more for disallowing certain data into your
>  database, such as 

Re: Best practice for SQL data sanitation

2008-03-26 Thread Adam Royle

Cake automatically handles quoting strings etc when saving to the
database. Sanitize is more for disallowing certain data into your
database, such as 

Re: Best practice for working with similar model types (noob question!)

2008-02-15 Thread the_woodsman

I haven't done this extensively, but things I've been considering
recently about the subclassing approach:

- Must obey the fat model paradigm, as the more logic you put in the
model, particularly your base model, the more benefit you get from
subclassing in this way.

- Customise the subclasses by adding new fields, manipulating the
model relationships, overriding methods etc.

- Use callbacks (like beforeFind) in the subclasses, to modify queries
generated from the base class.

- Need to pay some attention to when you do and don't call the parent
methods you're overriding, to determine if you use the base classes
functionality at all in a given scenario.

Please, post anything interesting you learn about this approach!







On Feb 15, 5:35 pm, sleepy1038 <[EMAIL PROTECTED]> wrote:
> I am in the same situation as glastoveteran (I am a Cake noob as
> well). I am building a content management system which posts various
> types of content (articles, bulletins, press releases, etc.). They all
> have some common characteristics, but also differ greatly. This is a
> typical is-a relationship. It would be tempted to create separate
> models for each item without a common base table, except I have one
> special condition.
>
> ** All content items must be able to have one or more tags associated
> with them. My thought is to create a tags table, and then a common
> base table for all content types. I could then use as associative
> table to hold content id, tag id pairs.
>
> How would I do this in cake without throwing out all of the built-in
> model functionality that cake offers. For example, when I create,
> delete, or edit a new article, how do get the base model and the
> article model to work together? How about when I add tags to my
> article, how do I get the Article model to pull from the associative
> table I've created?
>
> Am I thinking about this in the wrong way, or am I on the right track?
>
> Thank you for any advice anyone has to offer.
>
> On Feb 15, 11:37 am, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > To keep it simple with cake I have separate tables & models, but if I
> > need to share functionality between models, I use a behaviour.
>
> > What you're saying about using a custom base class for your models/
> > behaviours works well also.
>
> > Ultimately it depends on your data. eg. in my scenario I was going to
> > have a generic "media" table, which would hold videos, images,
> > documents (pdfs), etc, but I eventually moved each type into its own
> > tables, which made much more sense and a heck of a lot easier to
> > manage. I created a generic FileBehaviour which handles the handling
> > of files in general. Then as necessary I created an ImageBehaviour
> > extends FileBehaviour, which added code to deal with images, etc.
>
> > Hope that helps.
>
> > Cheers,
> > Adam
>
> > On Feb 16, 12:08 am, glastoveteran <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
>
> > > I'm building a content managed site with several slightly different
> > > types of record, but all of which feature a common set of fields e.g.
> > > title, summary, description, start_date, end_date, notes, etc.  Some
> > > types of record have one or two extra fields, e.g. location, price,
> > > etc.
>
> > > I've always wondered what's the best way of approaching this with
> > > cake, or indeed any framework?  To have a single database table,
> > > model, controller etc with a field and logic indicating the record
> > > type?  Or to implement each record type with a different table, model,
> > > controller etc?
>
> > > I guess the first option of one model involves less repetition, but
> > > how would you handle different record types having a slightly
> > > different validation rules based on the fact that sopme have extra
> > > fields that need to be validated?  Presumably you'd need to use a
> > > model beforeValidate() function instead of the standard validation
> > > array?
>
> > > The second option would seem to follow the MVC convention a little
> > > better and validation would be easier but seems to have more
> > > repetition.
>
> > > Looking at this in an object oriented way with classes you would I
> > > guess define a base class with the common characteristics and then
> > > extend / specialise this for other models.  How does that work with
> > > cake?
>
> > > Thanks all,
>
> > > Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for working with similar model types (noob question!)

2008-02-15 Thread sleepy1038

I am in the same situation as glastoveteran (I am a Cake noob as
well). I am building a content management system which posts various
types of content (articles, bulletins, press releases, etc.). They all
have some common characteristics, but also differ greatly. This is a
typical is-a relationship. It would be tempted to create separate
models for each item without a common base table, except I have one
special condition.

** All content items must be able to have one or more tags associated
with them. My thought is to create a tags table, and then a common
base table for all content types. I could then use as associative
table to hold content id, tag id pairs.

How would I do this in cake without throwing out all of the built-in
model functionality that cake offers. For example, when I create,
delete, or edit a new article, how do get the base model and the
article model to work together? How about when I add tags to my
article, how do I get the Article model to pull from the associative
table I've created?

Am I thinking about this in the wrong way, or am I on the right track?

Thank you for any advice anyone has to offer.

On Feb 15, 11:37 am, Adam Royle <[EMAIL PROTECTED]> wrote:
> To keep it simple with cake I have separate tables & models, but if I
> need to share functionality between models, I use a behaviour.
>
> What you're saying about using a custom base class for your models/
> behaviours works well also.
>
> Ultimately it depends on your data. eg. in my scenario I was going to
> have a generic "media" table, which would hold videos, images,
> documents (pdfs), etc, but I eventually moved each type into its own
> tables, which made much more sense and a heck of a lot easier to
> manage. I created a generic FileBehaviour which handles the handling
> of files in general. Then as necessary I created an ImageBehaviour
> extends FileBehaviour, which added code to deal with images, etc.
>
> Hope that helps.
>
> Cheers,
> Adam
>
> On Feb 16, 12:08 am, glastoveteran <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I'm building a content managed site with several slightly different
> > types of record, but all of which feature a common set of fields e.g.
> > title, summary, description, start_date, end_date, notes, etc.  Some
> > types of record have one or two extra fields, e.g. location, price,
> > etc.
>
> > I've always wondered what's the best way of approaching this with
> > cake, or indeed any framework?  To have a single database table,
> > model, controller etc with a field and logic indicating the record
> > type?  Or to implement each record type with a different table, model,
> > controller etc?
>
> > I guess the first option of one model involves less repetition, but
> > how would you handle different record types having a slightly
> > different validation rules based on the fact that sopme have extra
> > fields that need to be validated?  Presumably you'd need to use a
> > model beforeValidate() function instead of the standard validation
> > array?
>
> > The second option would seem to follow the MVC convention a little
> > better and validation would be easier but seems to have more
> > repetition.
>
> > Looking at this in an object oriented way with classes you would I
> > guess define a base class with the common characteristics and then
> > extend / specialise this for other models.  How does that work with
> > cake?
>
> > Thanks all,
>
> > Alex

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



Re: Best practice for working with similar model types (noob question!)

2008-02-15 Thread Adam Royle

To keep it simple with cake I have separate tables & models, but if I
need to share functionality between models, I use a behaviour.

What you're saying about using a custom base class for your models/
behaviours works well also.

Ultimately it depends on your data. eg. in my scenario I was going to
have a generic "media" table, which would hold videos, images,
documents (pdfs), etc, but I eventually moved each type into its own
tables, which made much more sense and a heck of a lot easier to
manage. I created a generic FileBehaviour which handles the handling
of files in general. Then as necessary I created an ImageBehaviour
extends FileBehaviour, which added code to deal with images, etc.

Hope that helps.

Cheers,
Adam


On Feb 16, 12:08 am, glastoveteran <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm building a content managed site with several slightly different
> types of record, but all of which feature a common set of fields e.g.
> title, summary, description, start_date, end_date, notes, etc.  Some
> types of record have one or two extra fields, e.g. location, price,
> etc.
>
> I've always wondered what's the best way of approaching this with
> cake, or indeed any framework?  To have a single database table,
> model, controller etc with a field and logic indicating the record
> type?  Or to implement each record type with a different table, model,
> controller etc?
>
> I guess the first option of one model involves less repetition, but
> how would you handle different record types having a slightly
> different validation rules based on the fact that sopme have extra
> fields that need to be validated?  Presumably you'd need to use a
> model beforeValidate() function instead of the standard validation
> array?
>
> The second option would seem to follow the MVC convention a little
> better and validation would be easier but seems to have more
> repetition.
>
> Looking at this in an object oriented way with classes you would I
> guess define a base class with the common characteristics and then
> extend / specialise this for other models.  How does that work with
> cake?
>
> Thanks all,
>
> Alex
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice for multiple checkboxes/radios/selects

2008-01-15 Thread b logica

On Jan 15, 2008 12:33 PM, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a table of data and need to allow the user to choose certain
> records to authorise by either checking a checkbox or radio, select
> etc but I am struggling with the best way to show this data given that
> Cake form element expects a single model and field.  I'm using 1.2 and
> have hunted high and low for an example, helper or tutorial...
>
> Getting the data back and processing it isn't a problem it's just
> working out the right way to reference the model/field name in the
> $form->select or whatever call...
>

I'm working on the same thing right now. See these links:

http://bakery.cakephp.org/articles/view/create-multiple-checkboxes-instead-of-a-multiple-select-in-your-views
http://www.monkeydispenser.com/2007/07/03/using-checkboxes-in-cakephp/

I haven't gotten it to work yet, though, because i'm struggling with
multiple checkboxes and a tableless model. Expect a cry for help to
the list any time now.

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



Re: Best Practice for multiple belongsTo associations (Cake 1.1)

2007-12-26 Thread Pablo Viojo
Chris,

Take a look at these[1][2]. Maybe it helps (maybe not)

Regards,

-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net

[1]
http://digitalspaghetti.tooum.net/switchboard/blog/2487:Discovering_Single_Table_Inheritance
[2]
http://www.ifisgeek.com/tutorials/implementing_single_table_inheritance_in_cakephp

On Dec 21, 2007 8:04 AM, Chris Hawes <[EMAIL PROTECTED]> wrote:

>
> Hello,
>
> I'm currently designing a database for an app I'm writing, and have a
> question on something.
>
> I have four tables: tasks, contacts, documents and companies.
>
> Multiple tasks can be assigned to either a contact, document or company.
>
> The problems is, I don't want to limit myself to just three tables,
> and I'd rather not have contact_id, document_id and company_id in my
> tasks table.
>
> What would be the best way around this? Does the answer lie with
> bindModel() ?
>
> Thanks in advance!
>
> Chris.
>
> P.S. I hope everyone has a great Christmas, and a good 2008 baking
> lots of cool stuff!
>
> >
>


-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net

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



Re: Best Practice for multiple belongsTo associations (Cake 1.1)

2007-12-26 Thread nate

"Patches are welcome" ;-)

On Dec 25, 9:03 pm, MX <[EMAIL PROTECTED]> wrote:
> It would be very nice if Cake had polymorphism associations.
>
> On Dec 21, 3:09 pm, "subtropolis zijn" <[EMAIL PROTECTED]>
> wrote:
>
> > On Dec 21, 2007 6:04 AM, Chris Hawes <[EMAIL PROTECTED]> wrote:
>
> > > I have four tables: tasks, contacts, documents and companies.
>
> > > Multiple tasks can be assigned to either a contact, document or company.
>
> > > The problems is, I don't want to limit myself to just three tables,
> > > and I'd rather not have contact_id, document_id and company_id in my
> > > tasks table.
>
> > Create these tables:
> > contacts_tasks (contact_id, task_id)
> > documents_tasks (document_id, task_id)
> > companies_tasks (company_id, task_id)
>
> > If/when you add a new table just add a new lookup table as well.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practice for multiple belongsTo associations (Cake 1.1)

2007-12-26 Thread MX

It would be very nice if Cake had polymorphism associations.


On Dec 21, 3:09 pm, "subtropolis zijn" <[EMAIL PROTECTED]>
wrote:
> On Dec 21, 2007 6:04 AM, Chris Hawes <[EMAIL PROTECTED]> wrote:
>
>
>
> > I have four tables: tasks, contacts, documents and companies.
>
> > Multiple tasks can be assigned to either a contact, document or company.
>
> > The problems is, I don't want to limit myself to just three tables,
> > and I'd rather not have contact_id, document_id and company_id in my
> > tasks table.
>
> Create these tables:
> contacts_tasks (contact_id, task_id)
> documents_tasks (document_id, task_id)
> companies_tasks (company_id, task_id)
>
> If/when you add a new table just add a new lookup table as well.

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



Re: Best Practice for multiple belongsTo associations (Cake 1.1)

2007-12-21 Thread subtropolis zijn
On Dec 21, 2007 6:04 AM, Chris Hawes <[EMAIL PROTECTED]> wrote:

>
> I have four tables: tasks, contacts, documents and companies.
>
> Multiple tasks can be assigned to either a contact, document or company.
>
> The problems is, I don't want to limit myself to just three tables,
> and I'd rather not have contact_id, document_id and company_id in my
> tasks table.
>
>
Create these tables:
contacts_tasks (contact_id, task_id)
documents_tasks (document_id, task_id)
companies_tasks (company_id, task_id)

If/when you add a new table just add a new lookup table as well.

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



Re: Best Practice: Views, renderElement

2007-11-21 Thread [EMAIL PROTECTED]

In place where thay should be.
For view class extensisions correct place is /app/views folder

BTW: @grigri
Your proposiiton need aditional manual work. We need to describe each
subview folder in bootstrap or create aditional code that will take
time.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practice: Views, renderElement

2007-11-21 Thread releod

Where is the best place to keep files that extend the CORE CAKE
Framework?

On Nov 21, 10:30 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Another solution extend basic view class.
>
>  class ExView extends View
> {
>
> function renderPartial($name, $params = array(), $loadHelpers =
> false) {
> if ((strpos($name, '\\')===false) && (strpos($name, 
> '/')===false)) {
> $name = '..' . DS . 
> Inflector::underscore($this->name) . DS .
> $name;
> }
> return $this->renderElement($name, $params, $loadHelpers);
> }
>
> }
>
> ?>
>
> And set this class as default view class
>
>  class AppController extends Controller {
> var $helpers = array('Debug','Javascript','Html','Jquery');
>
> function beforeRender() {
> $this->view='Ex';
> return true;
> }
>
> }
>
> ?>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practice: Views, renderElement

2007-11-21 Thread [EMAIL PROTECTED]

Another solution extend basic view class.

name) 
. DS .
$name;
}
return $this->renderElement($name, $params, $loadHelpers);
}


}
?>

And set this class as default view class

view='Ex';
return true;
}

}
?>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practice: Views, renderElement

2007-11-21 Thread releod

Cool, thanks - makes sense.



On Nov 21, 4:52 am, grigri <[EMAIL PROTECTED]> wrote:
> From my understanding, if you have a form (or any other chunk of html)
> that is used by several views, then it clearly qualifies as an
> element. Sure, it's a "private" element (only used by views in /user),
> but still an element.
>
> You could always create subfolders under the elements folder, so you'd
> have $this->renderElement('user/admin_form'); to render app/views/
> elements/user/admin_form.ctp.
>
> If that seems odd to you, try creating an 'elements' subfolder under
> app/views/user/, then registering app/views/user as a view path (in
> bootstrap.php), so that View::renderElement() will look there too.
> That feels a bit hacky, but should work.
>
> On Nov 21, 8:52 am, releod <[EMAIL PROTECTED]> wrote:
>
> > Hello, I am wondering if there is a better approach to this built into
> > CakePHP 1.2
>
> > Basically I have a few views, admin_create, admin_update,
> > admin_destroy, all using the same code for the form.
> > I have created another view file called _admin_form.ctp
>
> > Right now, for example, I write:
> > $this->renderElement('../user/_admin_form');
>
> > inside of my admin_create.ctp, is there anyway to
> > render('_admin_form'); without needing to jump out of the current
> > directory? (_admin_form is in the users directory along with the other
> > views).
>
> > Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practice: Views, renderElement

2007-11-21 Thread grigri

>From my understanding, if you have a form (or any other chunk of html)
that is used by several views, then it clearly qualifies as an
element. Sure, it's a "private" element (only used by views in /user),
but still an element.

You could always create subfolders under the elements folder, so you'd
have $this->renderElement('user/admin_form'); to render app/views/
elements/user/admin_form.ctp.

If that seems odd to you, try creating an 'elements' subfolder under
app/views/user/, then registering app/views/user as a view path (in
bootstrap.php), so that View::renderElement() will look there too.
That feels a bit hacky, but should work.


On Nov 21, 8:52 am, releod <[EMAIL PROTECTED]> wrote:
> Hello, I am wondering if there is a better approach to this built into
> CakePHP 1.2
>
> Basically I have a few views, admin_create, admin_update,
> admin_destroy, all using the same code for the form.
> I have created another view file called _admin_form.ctp
>
> Right now, for example, I write:
> $this->renderElement('../user/_admin_form');
>
> inside of my admin_create.ctp, is there anyway to
> render('_admin_form'); without needing to jump out of the current
> directory? (_admin_form is in the users directory along with the other
> views).
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practice: Views, renderElement

2007-11-21 Thread RichardAtHome

Put your element code in app/view/elements

and you can display them with:

echo $this->renderElement(element_name);


On Nov 21, 8:52 am, releod <[EMAIL PROTECTED]> wrote:
> Hello, I am wondering if there is a better approach to this built into
> CakePHP 1.2
>
> Basically I have a few views, admin_create, admin_update,
> admin_destroy, all using the same code for the form.
> I have created another view file called _admin_form.ctp
>
> Right now, for example, I write:
> $this->renderElement('../user/_admin_form');
>
> inside of my admin_create.ctp, is there anyway to
> render('_admin_form'); without needing to jump out of the current
> directory? (_admin_form is in the users directory along with the other
> views).
>
> Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best practice: HABTM or HasMany: 5 cents?

2007-09-24 Thread bigbass

Grant,

I set this up, removed the ''Image.is_archived' => 0' in the
conditions, as s/th like this is not implemented here yet (or is it
some standard I oversee), and changed 'Image.foreign_model'=>'Article'
to the plural, so I can use it (as far as I can see now) with a form
called by renderElement from anywhere where this data is set like:
$html->hidden('images/foreign_model', array('value' => $this->name));
Like this I should be able use this renderElement all over the place.
[am I right here?]

One more question, as this is my first cake backed, and I would like
it to shine:
As this solution seems to be a real bassplayer-style (!) I would like
to use it on comments, or tags, or xyz too.
Again performance: What if there are hundreds of images, every image
having, lets say 'quite a lot' of comments. Or many many articles,
images, whatever having many many tags (Tags implemented the same
way).
Would it be more clever to separate data into different tables
(comments for Images, for Articles etc...) [from HABTM-point-of-view
not necessary] or can: a 'standard' mysql (latest 4.x), php4 and cake
(1.1) handle this?

Bassy regards,
Benjamin


On Sep 22, 4:03 pm, bigbass <[EMAIL PROTECTED]> wrote:
> Grant,
>
> thank you!
> My app doesn't need a HABTM relationship for images, as far as it it's
> layout looks like now.
> I thought of adding fields for foreign_model and foreign_id myself,
> your post showed me I was on the right track.
>
> Bassy regards,
> Benjamin
>
> On Sep 22, 5:43 am, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > HABTM vs hasMany depends on your application functionality - between
> > an article and an image is it hasMany (each image is only in one
> > article), or HABTM (each image could be in multiple articles)?  The
> > table setup will follow these application requirements, not the other
> > way round.
>
> > If you can have a single table, do it.  I would recommend each Image
> > having a field "foreign_model" and "foreign_id", and the association
> > from Article would be:
>
> > var $hasMany = array(
> > 'Image' => array(
> > 'className' => 'Image',
> > 'conditions' => array(
> > 'Image.foreign_model'=>'Article',
> > 'Image.is_archived' => 0
> > ),
> > 'foreignKey' => 'foreign_id',
> > 'dependent' => true,
> > ),
> > );
>
> > This way the one Image table can store images used for any other
> > associations.
>
> > On Sep 22, 9:57 am, bigbass <[EMAIL PROTECTED]> wrote:
>
> > > Hi there,
>
> > > I'm setting up a new site with cake 1.1. As a cake-newby, maybe you
> > > could give me your 5 cents (or even more? :) :
> > > The site uses user-generated images in different places (user profile,
> > > galeries, articles etc)
> > > I'm thinking of setting up just one table which stores image
> > > information (meta's etc) and joining this table via HABTM (eg.
> > > articles_images to the refering table articles). Is this a good
> > > practice in cake, or in general? Or would it be more efficient (and
> > > more resource-friendly) to use separate tables for each referer, as a
> > > HasMany relation (articles HasMany articleImages). Which models would
> > > be faster concerning requests?
>
> > > Best regards,
> > > thanks for your cents in advance,
> > > Benjamin


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



Re: Best practice: HABTM or HasMany: 5 cents?

2007-09-22 Thread bigbass

Grant,

thank you!
My app doesn't need a HABTM relationship for images, as far as it it's
layout looks like now.
I thought of adding fields for foreign_model and foreign_id myself,
your post showed me I was on the right track.

Bassy regards,
Benjamin

On Sep 22, 5:43 am, Grant Cox <[EMAIL PROTECTED]> wrote:
> HABTM vs hasMany depends on your application functionality - between
> an article and an image is it hasMany (each image is only in one
> article), or HABTM (each image could be in multiple articles)?  The
> table setup will follow these application requirements, not the other
> way round.
>
> If you can have a single table, do it.  I would recommend each Image
> having a field "foreign_model" and "foreign_id", and the association
> from Article would be:
>
> var $hasMany = array(
> 'Image' => array(
> 'className' => 'Image',
> 'conditions' => array(
> 'Image.foreign_model'=>'Article',
> 'Image.is_archived' => 0
> ),
> 'foreignKey' => 'foreign_id',
> 'dependent' => true,
> ),
> );
>
> This way the one Image table can store images used for any other
> associations.
>
> On Sep 22, 9:57 am, bigbass <[EMAIL PROTECTED]> wrote:
>
> > Hi there,
>
> > I'm setting up a new site with cake 1.1. As a cake-newby, maybe you
> > could give me your 5 cents (or even more? :) :
> > The site uses user-generated images in different places (user profile,
> > galeries, articles etc)
> > I'm thinking of setting up just one table which stores image
> > information (meta's etc) and joining this table via HABTM (eg.
> > articles_images to the refering table articles). Is this a good
> > practice in cake, or in general? Or would it be more efficient (and
> > more resource-friendly) to use separate tables for each referer, as a
> > HasMany relation (articles HasMany articleImages). Which models would
> > be faster concerning requests?
>
> > Best regards,
> > thanks for your cents in advance,
> > Benjamin


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



Re: Best practice: HABTM or HasMany: 5 cents?

2007-09-21 Thread Grant Cox

HABTM vs hasMany depends on your application functionality - between
an article and an image is it hasMany (each image is only in one
article), or HABTM (each image could be in multiple articles)?  The
table setup will follow these application requirements, not the other
way round.

If you can have a single table, do it.  I would recommend each Image
having a field "foreign_model" and "foreign_id", and the association
from Article would be:

var $hasMany = array(
'Image' => array(
'className' => 'Image',
'conditions' => array(
'Image.foreign_model'=>'Article',
'Image.is_archived' => 0
),
'foreignKey' => 'foreign_id',
'dependent' => true,
),
);

This way the one Image table can store images used for any other
associations.


On Sep 22, 9:57 am, bigbass <[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I'm setting up a new site with cake 1.1. As a cake-newby, maybe you
> could give me your 5 cents (or even more? :) :
> The site uses user-generated images in different places (user profile,
> galeries, articles etc)
> I'm thinking of setting up just one table which stores image
> information (meta's etc) and joining this table via HABTM (eg.
> articles_images to the refering table articles). Is this a good
> practice in cake, or in general? Or would it be more efficient (and
> more resource-friendly) to use separate tables for each referer, as a
> HasMany relation (articles HasMany articleImages). Which models would
> be faster concerning requests?
>
> Best regards,
> thanks for your cents in advance,
> Benjamin


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



Re: Best Practice for Views

2007-08-01 Thread starkey

Grant & Geoff, that's a pretty cool solution!


On Jul 31, 7:56 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
> I'm with grant - use one action with a differnt view as needed
>
> function action1($layout = 'list'){
>   // set data and other stuff
>   switch ($layout){
> case 'table':
>   $this->render('action1_table');
>   break;
> default:
>   $this->render('action1_list');
>   break;
>   }
>
> }
>
> You could use if...else if there are only two possible options
>
> Geoff
> --http://lemoncake.wordpress.com
>
> On Aug 1, 9:19 am, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > One of the primary parts of Cake is to keep your data separate from
> > your application interface (controllers), separate from your
> > presentation (views).  Changing one of these elements should not
> > require modification to the others.  You want the first two to remain
> > the same, you just want different views.
>
> > If the controller functionality remains the same between the different
> > modes (list vs table), which I imagine it does, then you should stick
> > to a single controller action.  Allow the request to determine what
> > format to output, and render the appropriate view from this.  So
> > requesting /controller/view/list vs  /controller/view/table  will
> > execute the same controller action, but just render the list.ctp or
> > table.ctp view file.


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



Re: Best Practice for Views

2007-07-31 Thread Geoff Ford

I'm with grant - use one action with a differnt view as needed

function action1($layout = 'list'){
  // set data and other stuff
  switch ($layout){
case 'table':
  $this->render('action1_table');
  break;
default:
  $this->render('action1_list');
  break;
  }
}

You could use if...else if there are only two possible options

Geoff
--
http://lemoncake.wordpress.com

On Aug 1, 9:19 am, Grant Cox <[EMAIL PROTECTED]> wrote:
> One of the primary parts of Cake is to keep your data separate from
> your application interface (controllers), separate from your
> presentation (views).  Changing one of these elements should not
> require modification to the others.  You want the first two to remain
> the same, you just want different views.
>
> If the controller functionality remains the same between the different
> modes (list vs table), which I imagine it does, then you should stick
> to a single controller action.  Allow the request to determine what
> format to output, and render the appropriate view from this.  So
> requesting /controller/view/list vs  /controller/view/table  will
> execute the same controller action, but just render the list.ctp or
> table.ctp view file.


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



Re: Best Practice for Views

2007-07-31 Thread Grant Cox

One of the primary parts of Cake is to keep your data separate from
your application interface (controllers), separate from your
presentation (views).  Changing one of these elements should not
require modification to the others.  You want the first two to remain
the same, you just want different views.

If the controller functionality remains the same between the different
modes (list vs table), which I imagine it does, then you should stick
to a single controller action.  Allow the request to determine what
format to output, and render the appropriate view from this.  So
requesting /controller/view/list vs  /controller/view/table  will
execute the same controller action, but just render the list.ctp or
table.ctp view file.


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



Re: Best Practice for Views

2007-07-31 Thread starkey

I think that would be overkill (and unnecessarily complex). Besides,
you'd need to setup a model to get to your views... I suggest sticking
with how Cake does things (which is pretty darn good).


On Jul 31, 2:23 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> That's what I'll probably end up doing since I'm still prototyping
> this stuff out.  I'm guessing it would be better practice to have
> multiple view files instead of combining several views in one thtml
> file and also having several different controller actions.  I'm just
> left here thinking about other views for the same data and making
> those views dynamic.
>
> Okay, so here's a random thought.  What if I put the thtml code of
> each view into the database.  Then extract it in the controller and
> use the set method to set the code as a variable for the view.  Then
> in the view eval() the code?  Good idea or not? hm.
>
> On Jul 31, 12:02 pm, starkey <[EMAIL PROTECTED]> wrote:
>
> > I think I understand... It sounds to me like you should have two
> > actions, not 
> > one:http://www.some.com/controller/viewList/http://www.some.com/controlle...
>
> > Having one view to encapsulate two doesn't sound correct... but I'm
> > still new at this myself.
>
> > On Jul 31, 12:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > Thanks for the reply!
>
> > > The problem I am running into is that I need different views for the
> > > same information.  For example, when someone 
> > > visitshttp://www.some.com/controller/view/1
> > > it will show say a list of links.  Inhttp://www.some.com/controller/view/2
> > > it will show similar information from the database but as a table
> > > instead of a list of links.  Right now for me to do this I set the a
> > > variable that holds the view that I want to show.  So in my actual
> > > view.thtml file I have a switch statement off of this view variable I
> > > set in my controller so the actually view.thtml knows what view I need
> > > to show (in this example the list or the table).
>
> > > Does this make sense?
>
> > > On Jul 30, 5:58 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > > > Are you talking about several different "skins", but really the same
> > > > data and presentation?  Or are you talking about some non-trivial data
> > > > calculation, then you want to show the result in several independent
> > > > areas of your site?  I'm just not sure of the reason for the several
> > > > views on a single action.
>
> > > > For the former, have a variable (perhaps session) that determines
> > > > which layout to use, or even to choose another view file to render (if
> > > > the structure needs to be quite different).  For the latter, you
> > > > should move the functionality into the appropriate model or component
> > > > file, so that it can be called from any number of controller actions
> > > > without duplication.


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



Re: Best Practice for Views

2007-07-31 Thread [EMAIL PROTECTED]

That's what I'll probably end up doing since I'm still prototyping
this stuff out.  I'm guessing it would be better practice to have
multiple view files instead of combining several views in one thtml
file and also having several different controller actions.  I'm just
left here thinking about other views for the same data and making
those views dynamic.

Okay, so here's a random thought.  What if I put the thtml code of
each view into the database.  Then extract it in the controller and
use the set method to set the code as a variable for the view.  Then
in the view eval() the code?  Good idea or not? hm.

On Jul 31, 12:02 pm, starkey <[EMAIL PROTECTED]> wrote:
> I think I understand... It sounds to me like you should have two
> actions, not 
> one:http://www.some.com/controller/viewList/http://www.some.com/controller/viewTable/
>
> Having one view to encapsulate two doesn't sound correct... but I'm
> still new at this myself.
>
> On Jul 31, 12:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > Thanks for the reply!
>
> > The problem I am running into is that I need different views for the
> > same information.  For example, when someone 
> > visitshttp://www.some.com/controller/view/1
> > it will show say a list of links.  Inhttp://www.some.com/controller/view/2
> > it will show similar information from the database but as a table
> > instead of a list of links.  Right now for me to do this I set the a
> > variable that holds the view that I want to show.  So in my actual
> > view.thtml file I have a switch statement off of this view variable I
> > set in my controller so the actually view.thtml knows what view I need
> > to show (in this example the list or the table).
>
> > Does this make sense?
>
> > On Jul 30, 5:58 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > > Are you talking about several different "skins", but really the same
> > > data and presentation?  Or are you talking about some non-trivial data
> > > calculation, then you want to show the result in several independent
> > > areas of your site?  I'm just not sure of the reason for the several
> > > views on a single action.
>
> > > For the former, have a variable (perhaps session) that determines
> > > which layout to use, or even to choose another view file to render (if
> > > the structure needs to be quite different).  For the latter, you
> > > should move the functionality into the appropriate model or component
> > > file, so that it can be called from any number of controller actions
> > > without duplication.


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



Re: Best Practice for Views

2007-07-31 Thread starkey

I think I understand... It sounds to me like you should have two
actions, not one:
http://www.some.com/controller/viewList/
http://www.some.com/controller/viewTable/

Having one view to encapsulate two doesn't sound correct... but I'm
still new at this myself.


On Jul 31, 12:48 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Thanks for the reply!
>
> The problem I am running into is that I need different views for the
> same information.  For example, when someone 
> visitshttp://www.some.com/controller/view/1
> it will show say a list of links.  Inhttp://www.some.com/controller/view/2
> it will show similar information from the database but as a table
> instead of a list of links.  Right now for me to do this I set the a
> variable that holds the view that I want to show.  So in my actual
> view.thtml file I have a switch statement off of this view variable I
> set in my controller so the actually view.thtml knows what view I need
> to show (in this example the list or the table).
>
> Does this make sense?
>
> On Jul 30, 5:58 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > Are you talking about several different "skins", but really the same
> > data and presentation?  Or are you talking about some non-trivial data
> > calculation, then you want to show the result in several independent
> > areas of your site?  I'm just not sure of the reason for the several
> > views on a single action.
>
> > For the former, have a variable (perhaps session) that determines
> > which layout to use, or even to choose another view file to render (if
> > the structure needs to be quite different).  For the latter, you
> > should move the functionality into the appropriate model or component
> > file, so that it can be called from any number of controller actions
> > without duplication.


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



Re: Best Practice for Views

2007-07-31 Thread [EMAIL PROTECTED]

Thanks for the reply!

The problem I am running into is that I need different views for the
same information.  For example, when someone visits 
http://www.some.com/controller/view/1
it will show say a list of links.  In http://www.some.com/controller/view/2
it will show similar information from the database but as a table
instead of a list of links.  Right now for me to do this I set the a
variable that holds the view that I want to show.  So in my actual
view.thtml file I have a switch statement off of this view variable I
set in my controller so the actually view.thtml knows what view I need
to show (in this example the list or the table).

Does this make sense?

On Jul 30, 5:58 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
> Are you talking about several different "skins", but really the same
> data and presentation?  Or are you talking about some non-trivial data
> calculation, then you want to show the result in several independent
> areas of your site?  I'm just not sure of the reason for the several
> views on a single action.
>
> For the former, have a variable (perhaps session) that determines
> which layout to use, or even to choose another view file to render (if
> the structure needs to be quite different).  For the latter, you
> should move the functionality into the appropriate model or component
> file, so that it can be called from any number of controller actions
> without duplication.


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



Re: Best Practice for Views

2007-07-31 Thread starkey

Couldn't you create an Element for the data?
http://manual.cakephp.org/chapter/views


On Jul 30, 6:58 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
> Are you talking about several different "skins", but really the same
> data and presentation?  Or are you talking about some non-trivial data
> calculation, then you want to show the result in several independent
> areas of your site?  I'm just not sure of the reason for the several
> views on a single action.
>
> For the former, have a variable (perhaps session) that determines
> which layout to use, or even to choose another view file to render (if
> the structure needs to be quite different).  For the latter, you
> should move the functionality into the appropriate model or component
> file, so that it can be called from any number of controller actions
> without duplication.


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



Re: Best Practice for Views

2007-07-30 Thread Grant Cox

Are you talking about several different "skins", but really the same
data and presentation?  Or are you talking about some non-trivial data
calculation, then you want to show the result in several independent
areas of your site?  I'm just not sure of the reason for the several
views on a single action.

For the former, have a variable (perhaps session) that determines
which layout to use, or even to choose another view file to render (if
the structure needs to be quite different).  For the latter, you
should move the functionality into the appropriate model or component
file, so that it can be called from any number of controller actions
without duplication.


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



Re: Best practice - multipage Form

2007-07-29 Thread Hans

okay quite new to Cakephp so forgive if i make any obvious mistakes,
but i can't seem to get FormWizard work for me...

I'm trying to make a simple test form with 3 different input screen,
just to grasp the idea of the FormWizard. In every output I print the
$this->data array to see what data is saved in the Session. Is this
right?
Anyway I have the following code:

[b]Polls Controller:[/b]
class PollsController extends AppController {

var $name = 'Polls';
var $helpers = array('Html', 'Form' );
var $components = array('FormWizard');

function start() {
$ways=array("way1" => array("scrn1","scrn2","scrn3"),
"way2" => array("scrn3","scrn2","scrn1"));
$this->FormWizard->initWizard($ways);
$this->FormWizard->changeWay('way1');
}

function scrn1() {
$this->set('polltxt', 'screen1');
}

function scrn1Validate() {
$this->set('polltxt' , 'screen1validate');
return true;
}

function scrn2() {
$this->set('polltxt', 'screen2');
}

function scrn2Validate() {
$this->set('polltxt' , 'screen2validate');
return true;
}

function scrn3() {
$this->set('polltxt', 'screen3');
}

function scrn3Validate() {
$this->set('polltxt' , 'screen3validate');
return true;
}


}

[b]scrn1.ctp[/b]


data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.title');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 


[b]scrn2.ctp[/b]

data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.type');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 

[b]scrn3.ctp[/b]

data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.introtext');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 

Also accompanying database tables and models have been created.

But when i move around the screens using the Next and Previous
buttons, i get problem similar as descibed in this post:
http://moeffju.net/blog/2007/07/26/about-cake-cakebakers-please-read/
: $this->data is emptied seemingly randomly, data doesn't get Saved in
the Sessions...?.

My question:

1) Can anyone direct my to a good working example on how Formwizard
can be used, kinda of a FormWizard Tutorial for simple people like me
2) If not, what am i doing wrong here ?

thank you for your attention,

Hans


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



Re: Best practice - multipage Form

2007-07-29 Thread Hans

okay quite new to Cakephp so forgive if i make any obvious mistakes,
but i can't seem to get FormWizard work for me...

I'm trying to make a simple test form with 3 different input screen,
just to grasp the idea of the FormWizard. In every output I print the
$this->data array to see what data is saved in the Session. Is this
right?
Anyway I have the following code:

[b]Polls Controller:[/b]
class PollsController extends AppController {

var $name = 'Polls';
var $helpers = array('Html', 'Form' );
var $components = array('FormWizard');

function start() {
$ways=array("way1" => array("scrn1","scrn2","scrn3"),
"way2" => array("scrn3","scrn2","scrn1"));
$this->FormWizard->initWizard($ways);
$this->FormWizard->changeWay('way1');
}

function scrn1() {
$this->set('polltxt', 'screen1');
}

function scrn1Validate() {
$this->set('polltxt' , 'screen1validate');
return true;
}

function scrn2() {
$this->set('polltxt', 'screen2');
}

function scrn2Validate() {
$this->set('polltxt' , 'screen2validate');
return true;
}

function scrn3() {
$this->set('polltxt', 'screen3');
}

function scrn3Validate() {
$this->set('polltxt' , 'screen3validate');
return true;
}


}

[b]scrn1.ctp[/b]


data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.title');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 


[b]scrn2.ctp[/b]

data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.type');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 

[b]scrn3.ctp[/b]

data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.introtext');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 

Also accompanying database tables and models have been created.

But when i move around the screens using the Next and Previous
buttons, i get problem similar as descibed in this post:
http://moeffju.net/blog/2007/07/26/about-cake-cakebakers-please-read/
: $this->data is emptied seemingly randomly, data doesn't get Saved in
the Sessions...?.

My question:

1) Can anyone direct my to a good working example on how Formwizard
can be used, kinda of a FormWizard Tutorial for simple people like me
2) If not, what am i doing wrong here ?

thank you for your attention,

Hans


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



Re: Best practice to handle a table shared by two models ?

2007-07-12 Thread stefano

Hi grigri!
Thank you for your very informative answer!
The article at IfisGeek is very interesting too.

I'll go this way, with a little experimenting (and learning)... then I
would like to write a behaviour, shouldn't be to difficult.

For now I implemented just the "beforeFind" and "beforeSave" callback.
I'm wondering if is really (and strictly) required to filter aot the
fields not used in one of the models... I mean, in the worst case they
are returned empty, and what to show in the view is your chioice... or
am I missing something?

Stefano

On 11 Lug, 14:48, grigri <[EMAIL PROTECTED]> wrote:
> > I have models Person and Company that share a large amount of fields
> > so I'm thinking to use a single/shared table (named Contacts) to store
> > the information and set both models to $useTable='contacts'.
> > Obvioulsy in Contacts table I have a field type that can be 'person'
> > or 'company' that I need to check on find actions and to set on save
> > ones.
>
> This is called "Single Table Inheritence" and as far as I know, there
> is no built-in support planned for it in CakePHP.
>
> There's an interesting article here 
> :http://www.ifisgeek.com/tutorials/implementing_single_table_inheritan...
>
> > What i'm planning to do is to set beforeFind() to add the
> > type='person' condition and beforeSave() to set the type field to
> > 'person' (and the 'company' one for the model Company, obviously).
>
> That's exactly what I did in a project a while ago, and it worked. But
> it never seemed the "cleanest" solution. (Code extract here 
> :http://pastebin.com/m2b094512)
>
> > Or maybe I can build a behaviour (even if I never wrote one...)?
>
> > Before going this way I would like to know what do you think about
> > this "design": if would be better to have the two distinct tables and
> > moreover if there is already built in Cake a way  to "bind" a Model to
> > its own table with some conditions...
>
> I'd also like to hear some views on this, as it's a frequently
> recurring subject. There is no way to directly bind a model to a table
> with constraints, but with a behavior it would be possible, with an
> implementation like:
>
> class Person extends AppModel {
>   var $name = "Person";
>   var $actsAs = array('Is'); // Load 'Is' behavior
>
>   var $is = array(
> 'tableName' => 'entities',
> 'conditions' => "Person.type='person'"
>   );
>
>   var $belongsTo = (...)
>
> }
>
> or something along those lines.


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



Re: Best practice to handle a table shared by two models ?

2007-07-11 Thread grigri

> I have models Person and Company that share a large amount of fields
> so I'm thinking to use a single/shared table (named Contacts) to store
> the information and set both models to $useTable='contacts'.
> Obvioulsy in Contacts table I have a field type that can be 'person'
> or 'company' that I need to check on find actions and to set on save
> ones.

This is called "Single Table Inheritence" and as far as I know, there
is no built-in support planned for it in CakePHP.

There's an interesting article here :
http://www.ifisgeek.com/tutorials/implementing_single_table_inheritance_in_cakephp

> What i'm planning to do is to set beforeFind() to add the
> type='person' condition and beforeSave() to set the type field to
> 'person' (and the 'company' one for the model Company, obviously).

That's exactly what I did in a project a while ago, and it worked. But
it never seemed the "cleanest" solution. (Code extract here :
http://pastebin.com/m2b094512 )

> Or maybe I can build a behaviour (even if I never wrote one...)?
>
> Before going this way I would like to know what do you think about
> this "design": if would be better to have the two distinct tables and
> moreover if there is already built in Cake a way  to "bind" a Model to
> its own table with some conditions...

I'd also like to hear some views on this, as it's a frequently
recurring subject. There is no way to directly bind a model to a table
with constraints, but with a behavior it would be possible, with an
implementation like:

class Person extends AppModel {
  var $name = "Person";
  var $actsAs = array('Is'); // Load 'Is' behavior

  var $is = array(
'tableName' => 'entities',
'conditions' => "Person.type='person'"
  );

  var $belongsTo = (...)
}

or something along those lines.


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



Re: Best Practice for Model Coding

2007-06-13 Thread Geoff Ford

Approach 3:
Assign your associations in the models as normal.  Set $recursive = 0
to avoid large result sets

I can understand the need for bind and unBind in deep, complex
associations, but I personally don't think it introduces any real
benefits performance wise.  My two cents.

Between the two approaches you gave I would choose 1.  Seems simpler,
and you dont have multiple bind, unBinds in the controller.


On Jun 14, 11:59 am, Ketan Patel <[EMAIL PROTECTED]> wrote:
> I would like some opinion from seasoned bakers on my implementation as
> I am not sure if it is Optimal or as per MVC practice.
>
> Say for eg, I have 2 models Users, Posts.
>
> My desired aim is "In UsersController, I want to find how many posts
> current user has posted "
>
> Table Relation
> User -> hasMany Post
>
> in PostModel I have
>
> function getPostsCount($userid)
> {
> return $this->findCount("`Post`.`users_id`='$userid'");
>
> }
>
> Approach 1:
> --
>
> and for that in User Model have a
>
> function getPostsCount($userid)
> {
> $this->bindModel(array('hasMany'=>array(
>   'Post'=>array(
>
> 'className'='Post',
>
> 'foreignKey'='users_id');
> $count = $this->Post->getPostsCount($userid);
>
>$this->unBindModel(array('hasMany'=>array('Post')));
>
>return $count;
>
> }
>
> and in UsersController I get the count by
>
> $postsCount = $this->User->getPostsCount($userid);
>
> Approach 2:
> 
> I do binding the model in the controller itself, so I do not have any
> code in Model to wrap around but instead I do in the controller as
> follows:
>
> $this->bindModel(array('hasMany'=>array(
>   'Post'=>array(
>
> 'className'='Post',
>
> 'foreignKey'='users_id');
>
> $postsCount = $this->User->Post->getPostsCount($userid);
>
> $this->unBindModel(array('hasMany'=>array('Post')));
>
> I prefer Approach 1, but not sure if having the wrapper function is a
> good idea or not. What I mean is that getPostsCount is a Post Model
> specific function and I create a wrapper in the UserModel to get that
> info and don't have bind/unbind the model each time I call such
> functions. Moreover I get the ease of use to getPostsCount whereever I
> have access to UserModel.
>
> What do you guys have to suggest? I may be going totally against the
> principles but not sure, so want to confirm it.
>
> Ketan


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



Re: Best practice - multipage Form

2007-06-11 Thread jitka (poLK)

It is matter of personal taste, off course. With FormWizardComponent
all multi-page-form-requests are calling only one public method of
controller.

Also 'ways' in FormWizard are quite usable - for example:
// ways used in InstallerController
array(
'install' => array('
_installStart',
'_checkFSPermissions',
'_checkOrSetDbConfig',
'_checkOrMakeDbStructure',
'_installApp',
'_recap'
),
'upgrade' => array(
'_upgradeStart'
'_fetchUpgradePackage',
'_upgradeApp',
'_recap'
)
)

All of above functionality is handled by _only_ public method:
InstallerController::admin_index().
-- if app is not installed yet, controller switches way to 'install'
-- if app is installed and not current, controller uses way 'upgrade'
-- if app is installed and current, method admin_index() just renders
informational view

Sure, with FormWizard every 'step' requires implement one view and 2
methods, but you don't have to care about session at all, you can use
different models in different steps of your wizard (and obtain
collected data any time you need them), you can easily switch 'ways',
clear steps (reset wizard)... ;)


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



Re: Best practice - multipage Form

2007-06-11 Thread Marcus T. Jaschen

wewo wrote:
> Dear all,
> 
> What would be your implementation recommendation (controller side) for
> setting up a tabbed multipage form (step1, step2, step {n}), where in
> every step different models and controllers are influenced and the
> different steps maybe influce other steps (available or not, a.s.o)?

My way (I'm using it in a subscription form which spreads across 4 pages):

SubscriptionController with four actions: step1(), step2(), step3(),
step4() (name them as you want).

Data is shared across the four steps within the Session data. Think
about the first step for a subscription, selecting the subscription
model (1 month, 12 months and so on). In the step1() method I save the
data to the session together with the information that step 1 was
completed (step 2 will redirect to step 1 if step 1 wasn't completed).

public function step1()
{
  (...)

  if ($this->data['Subscription']['subscription_type'] == 'yearly')
  {
$this->Session->write('Subscription.step1_done', true);
$this->Session->write('Subscription.subscription_type', '12months');
  }

  $this->redirect(array('controller' => 'subscription', 'action' =>
'step2'));
}

Same logic applies to step2(), step3() and step4(). Saving data to
database is done in step4 when all required steps are done.

Marcus


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



Re: Best practice - multipage Form

2007-06-07 Thread ianh

If you are using Cake 1.1.x then look up the form wizard on the
cakeforge. I don't know whether it works for 1.2 but I see no reason
why it shouldn't.

On Jun 7, 10:13 am, wewo <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> What would be your implementation recommendation (controller side) for
> setting up a tabbed multipage form (step1, step2, step {n}), where in
> every step different models and controllers are influenced and the
> different steps maybe influce other steps (available or not, a.s.o)?
>
> Thanks for any advice,
> wewo


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



Re: Best Practice with Behaviors or How To Make a Model Act As...

2007-04-07 Thread err_

https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/behaviors/tree.php?rev=4521

On Apr 5, 5:25 pm, "BlenderStyle" <[EMAIL PROTECTED]> wrote:
> The concept of behaviors is a new one to me. I understand that views
> have helpers, controllers have components, and models have behaviors,
> but I still don't grasp how to use these correctly. So, I did some
> research:
>
> cake/libs/model/model.php
> cake/libs/model/behavior.php
> Various Google Group posts (a lot from nate)
> Slug Behavior:http://bakery.cakephp.org/articles/view/295
> Transaction Behavior:http://bakery.cakephp.org/articles/view/228
> Touch Behavior:http://bakery.cakephp.org/articles/view/198
> Chapter 15 in Agile Web Development with Rails
>
> The thing that really hit the nail on the head for me, is how a
> behavior is used in a model - actAs. That makes it much, much easier
> to understand. If I wanted my model to act as a tree (MPTT), I could
> create a behavior called TreeBehavior and tell my model to act like a
> tree. If I wanted my model to act like a list, I could do that too.
> Very cool stuff. Is this the best way to think of behaviors? Anyone
> have some thoughts on how to use behaviors in the MVC-intended way?
>
> I'm assuming Cake is going to have some built-in behaviors, but right
> now (1.2.0.4451alpha), cake/libs/model/behaviors is empty. Does anyone
> know if there are some on the way? I understand that the Cake team is
> busy (http://groups.google.com/group/cake-php/browse_thread/thread/
> 683cdd4820eb2c03/df729d09968eaf7d), so I'm not trying to be pushy, I'm
> just curious. An MPTT behavior would be awesome to do things like move/
> delete a branch of nodes.


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



RE: Best Practice with Behaviors or How To Make a Model Act As...

2007-04-05 Thread Mariano Iglesias

Here you have some built in behaviors:

https://svn.cakephp.org/repo/branches/1.2.x.x/cake/libs/model/behaviors/

More may be added in the future, but remember, Cake is not a package of
useful classes, it's a framework. While some behaviors that are very common
to different kind of applications may be available out of the box, it's the
job of the community to produce general purpose and useful behaviors.

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de BlenderStyle
Enviado el: Jueves, 05 de Abril de 2007 06:25 p.m.
Para: Cake PHP
Asunto: Best Practice with Behaviors or How To Make a Model Act As...

I'm assuming Cake is going to have some built-in behaviors, but right
now (1.2.0.4451alpha), cake/libs/model/behaviors is empty. Does anyone
know if there are some on the way? 


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



Re: Best Practice with Behaviors or How To Make a Model Act As...

2007-04-05 Thread BlenderStyle

Oops. That broken link should be:

http://groups.google.com/group/cake-php/browse_thread/thread/683cdd4820eb2c03/df729d09968eaf7d


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




Re: best practice multiple checkboxes

2007-03-02 Thread GreyCells

I wrote the fomx helper as a proof of concept, although I am using it
in a development environment, I'll probably tidy it up before using it
in production. ('though there's always the hope it'll end up in the
core:). It is tightly tied to the 1.2 FormHelper and I have not even
looked at the 1.1 code (which I think is in HtmlHelper, not
FormHelper), but there is no reason why you couldn't do the same thing
in 1.1.

Once the 1.2 FormHelper stabilizes a bit, I'll clean up the
FormxHelper or better still, create a patch to integrate into the core
if the devs would like me to.

~GreyCells

On Mar 2, 11:14 am, "szeta" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> has anybody managed to use formx-helper (or something similar) on
> stable?
>
> I did not yet get formx-helper work on the version I use on the
> project:
> 1.1.11.4064
>
> Kind regards
> Ralph
>
> On 26 Feb., 18:29, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > excellent!
> > Thanks for all the hints!
>
> > On 23 Feb., 15:13, "bbuchs" <[EMAIL PROTECTED]> wrote:
>
> > > "GreyCells" also wrote a Helper for this purpose - I'm using it on a
> > > 1.2 project now, and it's great. I think the HTML it outputs could be
> > > a little cleaner, but it does what it should.
>
> > >https://trac.cakephp.org/ticket/1901
>
> > > I'm hoping something like this makes it into the source - from a
> > > usability perspective, multiple-select option lists are horrible.
>
> > > On Feb 23, 4:56 am, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > > > Does anybody have an idea here?
>
> > > > Every hint is appreciated. :-)
> > > > Regards
> > > > Ralph
>
> > > > On 22 Feb., 10:23, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > > > > Hello,
>
> > > > > I'm using CakePHP now for a few months on a project and I really love
> > > > > the framework.
> > > > > It helped me to safe a lot of time!
>
> > > > > But one thing, I always run into is, that it's not so easy to generate
> > > > > comfortable checkboxes (e.g. for maintaining HABTM relations).
>
> > > > > I tried e.g. $html->checkboxMultiple and it works, that's already much
> > > > > better than the scroll-box baked by default.
>
> > > > > But I'd like to give more Information to the related items (not only
> > > > > the primary key, but also the name or something else..)
>
> > > > > How do you handle this? Is there a method I have overseen?
>
> > > > > Best wishes!
> > > > > Ralph


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



Re: best practice multiple checkboxes

2007-03-02 Thread szeta

Hello,

has anybody managed to use formx-helper (or something similar) on
stable?

I did not yet get formx-helper work on the version I use on the
project:
1.1.11.4064

Kind regards
Ralph


On 26 Feb., 18:29, "szeta" <[EMAIL PROTECTED]> wrote:
> excellent!
> Thanks for all the hints!
>
> On 23 Feb., 15:13, "bbuchs" <[EMAIL PROTECTED]> wrote:
>
> > "GreyCells" also wrote a Helper for this purpose - I'm using it on a
> > 1.2 project now, and it's great. I think the HTML it outputs could be
> > a little cleaner, but it does what it should.
>
> >https://trac.cakephp.org/ticket/1901
>
> > I'm hoping something like this makes it into the source - from a
> > usability perspective, multiple-select option lists are horrible.
>
> > On Feb 23, 4:56 am, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > > Does anybody have an idea here?
>
> > > Every hint is appreciated. :-)
> > > Regards
> > > Ralph
>
> > > On 22 Feb., 10:23, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > > > Hello,
>
> > > > I'm using CakePHP now for a few months on a project and I really love
> > > > the framework.
> > > > It helped me to safe a lot of time!
>
> > > > But one thing, I always run into is, that it's not so easy to generate
> > > > comfortable checkboxes (e.g. for maintaining HABTM relations).
>
> > > > I tried e.g. $html->checkboxMultiple and it works, that's already much
> > > > better than the scroll-box baked by default.
>
> > > > But I'd like to give more Information to the related items (not only
> > > > the primary key, but also the name or something else..)
>
> > > > How do you handle this? Is there a method I have overseen?
>
> > > > Best wishes!
> > > > Ralph


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



Re: best practice multiple checkboxes

2007-02-26 Thread szeta

excellent!
Thanks for all the hints!

On 23 Feb., 15:13, "bbuchs" <[EMAIL PROTECTED]> wrote:
> "GreyCells" also wrote a Helper for this purpose - I'm using it on a
> 1.2 project now, and it's great. I think the HTML it outputs could be
> a little cleaner, but it does what it should.
>
> https://trac.cakephp.org/ticket/1901
>
> I'm hoping something like this makes it into the source - from a
> usability perspective, multiple-select option lists are horrible.
>
> On Feb 23, 4:56 am, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > Does anybody have an idea here?
>
> > Every hint is appreciated. :-)
> > Regards
> > Ralph
>
> > On 22 Feb., 10:23, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > I'm using CakePHP now for a few months on a project and I really love
> > > the framework.
> > > It helped me to safe a lot of time!
>
> > > But one thing, I always run into is, that it's not so easy to generate
> > > comfortable checkboxes (e.g. for maintaining HABTM relations).
>
> > > I tried e.g. $html->checkboxMultiple and it works, that's already much
> > > better than the scroll-box baked by default.
>
> > > But I'd like to give more Information to the related items (not only
> > > the primary key, but also the name or something else..)
>
> > > How do you handle this? Is there a method I have overseen?
>
> > > Best wishes!
> > > Ralph


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



Re: best practice multiple checkboxes

2007-02-23 Thread bbuchs

"GreyCells" also wrote a Helper for this purpose - I'm using it on a
1.2 project now, and it's great. I think the HTML it outputs could be
a little cleaner, but it does what it should.

https://trac.cakephp.org/ticket/1901

I'm hoping something like this makes it into the source - from a
usability perspective, multiple-select option lists are horrible.





On Feb 23, 4:56 am, "szeta" <[EMAIL PROTECTED]> wrote:
> Does anybody have an idea here?
>
> Every hint is appreciated. :-)
> Regards
> Ralph
>
> On 22 Feb., 10:23, "szeta" <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I'm using CakePHP now for a few months on a project and I really love
> > the framework.
> > It helped me to safe a lot of time!
>
> > But one thing, I always run into is, that it's not so easy to generate
> > comfortable checkboxes (e.g. for maintaining HABTM relations).
>
> > I tried e.g. $html->checkboxMultiple and it works, that's already much
> > better than the scroll-box baked by default.
>
> > But I'd like to give more Information to the related items (not only
> > the primary key, but also the name or something else..)
>
> > How do you handle this? Is there a method I have overseen?
>
> > Best wishes!
> > Ralph


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



  1   2   >