Re: Properly Normalizing a Products Database to work harmoniously with Cake

2009-11-25 Thread jimbo
Hi,

I have similar kind of experiences and this seems like a very sensible
solution... one thing I would add to this is a thing called "Attribute
Groups" or with properties, "Property Groups". This would enable you
to specify predefined sets of properties / property types for
different types of widgets that share the same properties (but with
potentially different property values). This would help build the
(Admin) tool for editing property values for widgets and make it more
simple for users to select predefined property groups instead of
creating properties on the fly. Comparing for properties and their
values and using predefined searches based on them would be
simplified.

Using property groups, the table structure would change a bit (names
may not be totally cake compatible, I did not have time to check
this):

table properties (
id pk
propertyname
type
)

table propertygroups (
id pk
name pgname
)

table propertygroups_properties (
id pk
propertygroup_id
property_id
)

table propertyvalues (
id pk
property_id
widget_id
value_string
value_int
value_decimal
...
)

As a side comment, I would also add that do not try to make everything
too normalized ... this would end up in a potentially very complex and
inefficient db structure ...

-Jani

On 25 marras, 12:09, theChrisWalker  wrote:
> table widget (
>  `id` primary key
> `number` unique widget number
> ... common fields to all widgets
> )
>
> table properties (
>   `id` primary key
>  `widget_id` foreign key
>  `property` name of property
>  `value` value of property
>  `type` type of value (int, string, float, enum, etc...)
> )
>
> table categories (
>  `id` primary key
>  `name` category name
> )
>
> table `categories_widgets` (
>  `id` primary key
>  `category_id` foreign key
>  `widget_id` foreign key
> )
>
> widget:
>  hasMany properties
>  habtm categories
>
> category:
>  habtm widgets
>
> property:
>  belongsTo widget
>
> After a number of similar projects with similar relationships, I would
> say this is the best solution.
> It can be extended as needs be with little worry for all your "new"
> property needs.
>
> On Nov 24, 7:00 pm, plasmaflux  wrote:
>
>
>
> > Hello all!
>
> > I'm a novice to CakePHP, have a rusty set of PHP skills, and am maybe
> > a 5/10 when it comes to MySQL & databases in general. I was recently
> > hired by a company wanting to bring their catalog design and web
> > development in-house. After digging through the existing site's raw
> > PHP code, I've decided to rebuild it from scratch with Cake. I'm blown
> > away by what Cake can do and how it does it! My last large-scale PHP/
> > MySQL project was during the php3-php4 transition when PHPLib was the
> > hottest thing around.
>
> > My company sells Widgets in the Medical field...lots of them...nearly
> > 20,000. My largest task at hand is to build an app to both populate a
> > Widgets database and search the data. It's a little overwhelming and I
> > need some advice.
>
> > First, all Widgets have a unique Widget Number. All Widgets can be
> > divided into Top-Tier categories a couple different ways. For example,
> > a Widget could fall under Forceps or Scissors or Clamps, and could
> > also land under Cardiovascular and/or Neurospinal and/or Dental. A
> > Clamp will always be just a Clamp, but the same Clamp could be useful
> > in both Cardiovascular AND Neurospinal. So categorization presents a
> > challenge.
>
> > Additionally, all Widgets have a number of properties in common. They
> > all have a Price. They all have a Name. They all have Dimensions.
> > Here's the really tricky part that's making my brain hurt. They also
> > all have a number of properties that are unique either to the item OR
> > to the Widget's category. A Clamp may have a curvature with a specific
> > radius. A set of Forceps may have an angle. A Needle Holder may be
> > Straight or Curved, and may also have jaws that are either Stainless
> > Steel, Tungsten Carbide Coated, or Titanium with Tungsten Carbide
> > coating.
>
> > There are also relationships between certain items that I'd want to be
> > available for "Related Widgets" display on a Widget's page. For
> > example, a Titanium Needle Holder with Tungsten Carbide Coating may be
> > available in 6", 7", 8", 9" lengths, with jaws that are 1mm, 2mm, 3mm,
> > 4mm wide and jaws that are Straight or Curved. I need to somehow be
> > able to make it clear in the database structure which Widgets are
> > related to other Widgets and how; keeping in mind refinable searches
> > (Show me all Titanium Curved-jaw Needle Holders).
>
> > Then there are things like Cases that hold predefined Sets of Widgets,
> > Widgets with X and Y dimensions vs. Widgets with X, Y and Z
> > dimensions.and on and on and on.
>
> > Not only am I trying to figure out how to create this beast of a
> > relational database, I'm also trying to ensure from the beginning that
> > it's optimized for CakePHP and remains highly flexible for all the
> > unforeseen additions and 

Fatal Error: Out of memory error

2009-11-25 Thread SeeVik
Hello All

I keep getting this error from time to time. Like 2-3 times a week,
but I haven't been able to find out the reason for this error.

The error looks something like this

Fatal error: Out of memory (allocated 4980736) (tried to allocate 37
bytes) in D:\webapp\scripts\myapp\cake\libs\model\dbo\dbo_mysql.php on
line 428

The line in question in the file dbo_mysql.php is
$i = 0;

Can somebody guide me regarding this?

Thanks and Regards
ShiVik

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: Play Audio in PHP

2009-11-25 Thread Dave
php is server side.  It doesn't do anything on the user's computer...
including play sound

On Thu, Nov 26, 2009 at 1:31 AM, j0n4s.h4rtm...@googlemail.com <
j0n4s.h4rtm...@googlemail.com> wrote:

> If you want to build an audio streaming server, maybe, but I would
> look at quicktime streaming server or shoutcast or something like
> that, then.
>
> Just use a flash or  based solution
> http://dev.w3.org/html5/spec/Overview.html#audio
>
> http://www.google.com/search?hl=en&q=flash+audio+player
> http://www.google.com/search?hl=en&q=flash+mp3+player
>
> 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


cake-php@googlegroups.com

2009-11-25 Thread j0n4s.h4rtm...@googlemail.com
Afaik internally HtmlHelper::link as well as Controller::redirect as
well as Form::create all use Router::url.

See:
http://book.cakephp.org/view/836/link
http://book.cakephp.org/view/842/url
http://book.cakephp.org/view/186/options-url

On Nov 25, 2:46 pm, Ragnis  wrote:
> But how can i use it in form url?
>
> On Nov 25, 5:29 am, "Dr. Loboto"  wrote:
>
> > All as you asked. And Cake properly encoded HTML entities as symbols
> > "&" are restricted in source and must be represented in text as &
>
> > On Nov 24, 9:43 pm, Ragnis  wrote:
>
> > > When doing it like this:
> > > array ('controller' => 'Accounts', 'action' => 'Manage', '?' =>  array
> > > ('var' => 'b73cr6xzr6z', 'var2' => 'somethingelse'))
> > > then the result will be /Accounts/Manage/?
> > > var=b73cr6xzr6z&var2=somethingelse
>
> > > On Nov 24, 6:31 am, "Dr. Loboto"  wrote:
>
> > > > You can set form action as:
> > > > array ('controller' => 'Accounts', 'action' => 'Manage', '?' => array
> > > > ('var' => 'b73cr6xzr6z', 'var2' => 'somethingelse'))
>
> > > > On Nov 23, 9:22 pm, Ragnis  wrote:
>
> > > > > I need them as GET variables.
> > > > > My form is at /Accounts/Manage/?var=b73cr6xzr6z&var2=somethingelse and
> > > > > when i submit the form, the GET variables will be gone but i want them
> > > > > to stay.
>
> > > > > On Nov 22, 11:39 pm, Amit  wrote:
>
> > > > > > Is there a reason you can't just include the vars in the form?
>
> > > > > > $form->input('var', array('type'=>'hidden', 'value'=> 
> > > > > > 'b73cr6xzr6z'));
>
> > > > > > On Nov 22, 12:54 pm, Ragnis  wrote:
>
> > > > > > > So how can i do that?
> > > > > > > And i don't want to use /Accounts/Manage/var:b73cr6xzr6z/
> > > > > > > var2:somethingelse

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: Export to CSV using Helper, resulting error

2009-11-25 Thread Braindead
The problem with this approach is that Excel tries to parse certain
values. Just to mention one example: "1-10" will be converted to "01.
Oct".
I prefer the following approach from the bakery:
http://bakery.cakephp.org/articles/view/excel-xls-helper

Markus

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: Play Audio in PHP

2009-11-25 Thread j0n4s.h4rtm...@googlemail.com
If you want to build an audio streaming server, maybe, but I would
look at quicktime streaming server or shoutcast or something like
that, then.

Just use a flash or  based solution
http://dev.w3.org/html5/spec/Overview.html#audio

http://www.google.com/search?hl=en&q=flash+audio+player
http://www.google.com/search?hl=en&q=flash+mp3+player

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: Export to CSV using Helper, resulting error

2009-11-25 Thread E T
Hi FrederickD,

The new approach works really well. Thank you for your help :D

On Thu, Nov 26, 2009 at 12:03 PM, FrederickD
wrote:

> I just had a similar problem and post here:
>
> http://groups.google.com/group/cake-php/browse_thread/thread/f9d8203a3acb0e8f#
> .
>
> I solved the issue a few hours ago using this approach:
> http://www.dnamique.com/cakephp-export-data-to-excel-the-easy-way/. No
> helper needed. It was done in 15 minutes. I could not believe it. I
> was even able to access the action in CakePHP from a button on an
> ExtJS grid.
>
> I would highly recommend taking a look at this approach. It is the
> simplest approach I have found, and a very clear explanation.
>
> Hopefully it helps...
>
> On Nov 24, 10:03 pm, E T  wrote:
> > Hi all,
> >
> > I am trying to put a download link on one of my view, so when user click
> on
> > that link it will automatically generate a csv file and pop up for user
> to
> > download.
> >
> > I followed the instruction herehttp://
> blog.allmythingstodo.com/tag/cakephp/usingthe helper from Adam
> > Royle (http://bakery.cakephp.org/articles/view/csv-helper-php5)
> >
> > However, when I click on my link.. this is shown:
> >
> > Notice (8): Undefined variable: csv
> > [APP\controllers\dispatches_controller.php, line 158]
> >
> > Fatal error: Call to a member function addRow() on a non-object in
> > C:\xampp\htdocs\cake\app\controllers\dispatches_controller.php on line
> 158
> >
> > Please help. Thank you.
> > **
>
> 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: How to have 2 forms on one page for same model

2009-11-25 Thread #2Will
Thanks,

I got it going in the end although what iv'e done seems a little bit
hacky.  Getting the form to recognise the errors passed back seemed
especially problematic.I just wrote a helper that checks for a
error message in the $invalidFields array and placed them underneath
the form items.  Elegant? Nope.  Pragmatic?  for now.

thanks again.

Will

On Nov 26, 12:17 am, Kerr  wrote:
> There are some articles on this subject.  You may try this one out.
>
> http://bakery.cakephp.org/articles/view/how-to-create-multirecord-forms
>
> It includes a component called Multirecord that does some looping to
> handle validation.  Be sure to read the comments, as there are some
> bugs in the posted code that the comments address.  On a side note, I
> find that this kind of thing is all too common with people (not just
> Cake bakers) posting code helpers/examples, etc.
>
> On Nov 25, 12:38 am, "#2Will"  wrote:
>
> > Hi All.
>
> > I need to have 2 forms on a page that add an item to the db using the
> > same model.
>
> > The trouble is,  they are setting each others validation off.
>
> > How can i isolate the forms so they still use the models validation
> > but only the form whos button has been clicked gets validated?
>
> > Thanks for any guidence
>
> > Will

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: Export to CSV... almost there... what am I missing? [SOLVED]

2009-11-25 Thread FrederickD
This is now SOLVED. Thanks to this post (http://www.dnamique.com/
cakephp-export-data-to-excel-the-easy-way/) I was able to reduce a
considerable amount of code and eliminate using a helper. My button
from the ExtJS grid was able to reconfigured to call the new action
and it worked the first time! It doesn't get much simpler. Whew!

Now on to search/filter in ExtJS and CakePHP...

On Nov 24, 11:23 am, FrederickD  wrote:
> Sorry about the tabs. I though I took those out...
>
> What is also strange to me is that when core.php has 'debug' >= '1' I
> get the 404 message. When 'debug' is set to '0', I get the prompt to
> create a CSV file, but not with the formatted name as defined in the
> exportrepairorders.ctp file. The file name being generated is
> exportrepairorders.csv and is empty.
>
> Thank you for your help.

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: Export to CSV using Helper, resulting error

2009-11-25 Thread FrederickD
I just had a similar problem and post here:
http://groups.google.com/group/cake-php/browse_thread/thread/f9d8203a3acb0e8f#.

I solved the issue a few hours ago using this approach:
http://www.dnamique.com/cakephp-export-data-to-excel-the-easy-way/. No
helper needed. It was done in 15 minutes. I could not believe it. I
was even able to access the action in CakePHP from a button on an
ExtJS grid.

I would highly recommend taking a look at this approach. It is the
simplest approach I have found, and a very clear explanation.

Hopefully it helps...

On Nov 24, 10:03 pm, E T  wrote:
> Hi all,
>
> I am trying to put a download link on one of my view, so when user click on
> that link it will automatically generate a csv file and pop up for user to
> download.
>
> I followed the instruction 
> herehttp://blog.allmythingstodo.com/tag/cakephp/usingthe helper from Adam
> Royle (http://bakery.cakephp.org/articles/view/csv-helper-php5)
>
> However, when I click on my link.. this is shown:
>
> Notice (8): Undefined variable: csv
> [APP\controllers\dispatches_controller.php, line 158]
>
> Fatal error: Call to a member function addRow() on a non-object in
> C:\xampp\htdocs\cake\app\controllers\dispatches_controller.php on line 158
>
> Please help. Thank you.
> **

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: Play Audio in PHP

2009-11-25 Thread rartavia
I'm struggling with this topic and found this link, could be useful in
this matter

http://teknoid.wordpress.com/2008/10/02/a-few-words-about-media-views-sending-binary-files-to-the-user/

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: Installation Issue - HELP!!! www.medfuse.com

2009-11-25 Thread robert matousek
Thanks Jeremy, I got it up and running. Webhost is making life
difficult. Once again, appreciate you taking the time.

On Nov 24, 9:08 pm, jburns  wrote:
> The first things I would check are your .htaccess files. I faced
> similar issues setting up a site on a hosting service. Take a look at
> thishttp://www.jeremy-burns.co.uk/2009/08/setting-up-cakephp-on-a-11-server/
> and see if it helps.
>
> On Nov 25, 5:04 am, robert matousek  wrote:
>
> > I've been developing an app on my localhost. Now I'm trying to get
> > CAKEPHP up and running on my webhost (Webhost4llife). Can someone take
> > a look atwww.medfuse.com?Ican't figure out what the problem is,
> > it's pulling in the default layout, but going to any of controller/
> > actions does not seem the work. I get an internal server error, 500
> > Error. I could really use some help. Anyone, any ideas?
>
> > document root is set to app/webroot/
> > mod_rewrite is on
>
> > I've spend hours trying to locate the problem. Your help would be
> > really appreciated

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: need a little help with model::saveAll function

2009-11-25 Thread FF (dan)
Modifying data in the controller seems to me like a nasty workaround.

The reason why your beforeValidate is failing to modify your data is
because validation is only run when you call save. You are calling
saveAll... so the data beforeValidate sees is in fact just a single
record.

You *could* override saveAll to unset the blank records, returning
parent::saveAll($data, $options);, but I fear that would unnecessarily
duplicate an awful lot of code to match the API.

Why don't you just create a mySaveAll() ?

[code]
function mySaveAll($data) {
foreach($data['InvoicesItem'] as $row) {
...
}
$options = array(... );
return $this->saveAll($data, $options);
}
[/code]

On Nov 25, 3:23 pm, Ernesto  wrote:
> i'ts working! thank you very much
>
> On 24 Nov, 18:19, Johannes  wrote:
>
> > i had exactly the same problem and solved it by removing empty lines
> > in the beforeFilter() of the controller responsible for saving items.
> > In my case its very specific you could apppend your logic to make it
> > more universal.
>
> > p.s. im not sure about the following line in your example, because im
> > not sure if !null is defined in php
> > if (array_search(!null, $record)) $validRecords[] = $record;
> > maybe im wrong but i dont think this filters your data correctly.
>
> > --- in my app i use:
> > class InvoicesController extends AppController {
> >         function beforeFilter() {
> >                 if (!empty($this->data)) {
>
> >                         // remove empty forms from data
> >                         if (isset($this->data['InvoicesItem'])) {
> >                                 $data = array();
> >                                 foreach ($this->data['InvoicesItem'] as 
> > $row) {
> >                                         if (!empty($row['quantity']) || 
> > !empty($row['price'])) {
> >                                                 $data[] = $row;
> >                                         }
> >                                 }
> >                                 if (empty($data)) {
> >                                         unset($this->data['InvoicesItem']);
> >                                 }
> >                                 else {
> >                                         $this->data['InvoicesItem'] = $data;
> >                                 }
> >                         }
> >                 }
>
> >         }
> > ...
>
> > }
>
> > On Nov 24, 4:28 pm, Ernesto  wrote:
>
> > > A - i already have a routine that *should* to that... but it isn't
> > > working properly. here's the code
>
> > > function beforeValidate() {
> > >      $validRecords = array();
> > >      foreach ($this->data as $model => $records) {
> > >           foreach ($records as $key => $record) {
> > >                if (is_numeric($key)) {
> > >                     if (array_search(!null, $record)) $validRecords[]
> > > = $record;
> > >                } else break;
> > >                $this->data[$model] = $validRecords;
> > >           }
> > >      }
> > >      return true;
>
> > > }
>
> > > B - my saveAll is already overwritten in AppModel and atm it's working
> > > ok. i was just asking if it's possible to do that in a Behavior :)
>
> > > On 23 Nov, 20:52, Marcelo Andrade  wrote:
>
> > > > On Mon, Nov 23, 2009 at 12:29 PM, Ernesto  wrote:
> > > > > (..)
> > > > > A - user can insert just 2 or 3 rows, it's not necesasry to fill all
> > > > > the 10 "Item" rows. saveAll tries to save even empty insertions. Blank
> > > > > rows = validation errors. is there any way to avoid this?
>
> > > > You'll have to loop $this->data and unset the entries when
> > > > you get blank fields.
>
> > > > > B - is it pobbile to create a behavior that forces "validate" =>
> > > > > "first" to every saveAll call?
>
> > > > You can override the saveAll method in your AppModel,
> > > > changing the validate entry in the options to 'first' always.
>
> > > > Best regards.
>
> > > > --
> > > > MARCELO DE F. ANDRADE
> > > > Belem, PA, Amazonia, Brazil
> > > > Linux User #221105

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


cake-php@googlegroups.com

2009-11-25 Thread Dave
print_r($_GET);

On Wed, Nov 25, 2009 at 8:46 AM, Ragnis  wrote:

> But how can i use it in form url?
>
>
> On Nov 25, 5:29 am, "Dr. Loboto"  wrote:
> > All as you asked. And Cake properly encoded HTML entities as symbols
> > "&" are restricted in source and must be represented in text as &
> >
> > On Nov 24, 9:43 pm, Ragnis  wrote:
> >
> > > When doing it like this:
> > > array ('controller' => 'Accounts', 'action' => 'Manage', '?' =>  array
> > > ('var' => 'b73cr6xzr6z', 'var2' => 'somethingelse'))
> > > then the result will be /Accounts/Manage/?
> > > var=b73cr6xzr6z&var2=somethingelse
> >
> > > On Nov 24, 6:31 am, "Dr. Loboto"  wrote:
> >
> > > > You can set form action as:
> > > > array ('controller' => 'Accounts', 'action' => 'Manage', '?' => array
> > > > ('var' => 'b73cr6xzr6z', 'var2' => 'somethingelse'))
> >
> > > > On Nov 23, 9:22 pm, Ragnis  wrote:
> >
> > > > > I need them as GET variables.
> > > > > My form is at /Accounts/Manage/?var=b73cr6xzr6z&var2=somethingelse
> and
> > > > > when i submit the form, the GET variables will be gone but i want
> them
> > > > > to stay.
> >
> > > > > On Nov 22, 11:39 pm, Amit  wrote:
> >
> > > > > > Is there a reason you can't just include the vars in the form?
> >
> > > > > > $form->input('var', array('type'=>'hidden', 'value'=>
> 'b73cr6xzr6z'));
> >
> > > > > > On Nov 22, 12:54 pm, Ragnis  wrote:
> >
> > > > > > > So how can i do that?
> > > > > > > And i don't want to use /Accounts/Manage/var:b73cr6xzr6z/
> > > > > > > var2:somethingelse
>
> 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: need a little help with model::saveAll function

2009-11-25 Thread Ernesto
i'ts working! thank you very much

On 24 Nov, 18:19, Johannes  wrote:
> i had exactly the same problem and solved it by removing empty lines
> in the beforeFilter() of the controller responsible for saving items.
> In my case its very specific you could apppend your logic to make it
> more universal.
>
> p.s. im not sure about the following line in your example, because im
> not sure if !null is defined in php
> if (array_search(!null, $record)) $validRecords[] = $record;
> maybe im wrong but i dont think this filters your data correctly.
>
> --- in my app i use:
> class InvoicesController extends AppController {
>         function beforeFilter() {
>                 if (!empty($this->data)) {
>
>                         // remove empty forms from data
>                         if (isset($this->data['InvoicesItem'])) {
>                                 $data = array();
>                                 foreach ($this->data['InvoicesItem'] as $row) 
> {
>                                         if (!empty($row['quantity']) || 
> !empty($row['price'])) {
>                                                 $data[] = $row;
>                                         }
>                                 }
>                                 if (empty($data)) {
>                                         unset($this->data['InvoicesItem']);
>                                 }
>                                 else {
>                                         $this->data['InvoicesItem'] = $data;
>                                 }
>                         }
>                 }
>
>         }
> ...
>
> }
>
> On Nov 24, 4:28 pm, Ernesto  wrote:
>
>
>
> > A - i already have a routine that *should* to that... but it isn't
> > working properly. here's the code
>
> > function beforeValidate() {
> >      $validRecords = array();
> >      foreach ($this->data as $model => $records) {
> >           foreach ($records as $key => $record) {
> >                if (is_numeric($key)) {
> >                     if (array_search(!null, $record)) $validRecords[]
> > = $record;
> >                } else break;
> >                $this->data[$model] = $validRecords;
> >           }
> >      }
> >      return true;
>
> > }
>
> > B - my saveAll is already overwritten in AppModel and atm it's working
> > ok. i was just asking if it's possible to do that in a Behavior :)
>
> > On 23 Nov, 20:52, Marcelo Andrade  wrote:
>
> > > On Mon, Nov 23, 2009 at 12:29 PM, Ernesto  wrote:
> > > > (..)
> > > > A - user can insert just 2 or 3 rows, it's not necesasry to fill all
> > > > the 10 "Item" rows. saveAll tries to save even empty insertions. Blank
> > > > rows = validation errors. is there any way to avoid this?
>
> > > You'll have to loop $this->data and unset the entries when
> > > you get blank fields.
>
> > > > B - is it pobbile to create a behavior that forces "validate" =>
> > > > "first" to every saveAll call?
>
> > > You can override the saveAll method in your AppModel,
> > > changing the validate entry in the options to 'first' always.
>
> > > Best regards.
>
> > > --
> > > MARCELO DE F. ANDRADE
> > > Belem, PA, Amazonia, Brazil
> > > Linux User #221105

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: About multilingual websites

2009-11-25 Thread thomaus
Thanks,

For 1:
I tried what you said and I get exactly the same, i.e. :

Welcome to CakePHP v1.2.4.8284 Console
---
App : app
Path: /Users/thomas/Sites/MyApp/app
---
What is the full path you would like to extract?
Example: /Users/thomas/Sites/MyApp/myapp
[Q]uit
[/Users/thomas/Sites/MyApp/app] >

Any clue?

For 2:
Thanks, now the plural form is definitely very clear. But still:
1) does a full and updated blog to do multilingual apps with Cake
exist in some place?
2) is there another way to do so than the console one? I read that
creating the .po files manually is a bit dangerous due to encoding, am
I wrong?

Thanks,

On Nov 24, 3:41 pm, Martin Westin  wrote:
> Hi,
>
> For 1:
> If Cake has trouble figuring out where your app is (for some reason).
> The simple workaround is to specify it with the full path:
>
> /Users/thomaus/Sites/MyApp/cake/consol/cake -app /Users/thomaus/Sites/
> MyApp/app i18n extract
>
> That is the foolproof and disgustingly verbose way of making sure you
> target the right app (= how to call the console from cron).
>
> For part of 2:
> Plural forms are explained sort-of correctly in that post. The problem
> is that they depend greatly on the language you translate into. First
> is the header in the .po file which specifies how this language treats
> plurals. Second is the actual messages that will then need to add
> plural forms to match the header. But not all messages need plural
> forms!! Only single words that are translated in a plural-senitive way
> need them.
>
> Normal singular translation will likely be 99% of what you do:
> msgid "this is just a string, no plurals needed!"
> msgstr "det här är bara en sträng, inga plurala variationer behövs!"
>
> Then there will be things like date and time formatters, translated
> paging labels and things of that sort:
> msgid "second"
> msgid_plural "seconds"
> msgstr[0] "sekund"
> msgstr[1] "sekunder"
>
> My advice is to stay away from too many single words and plurals in
> your translations. My reason for this is that synonyms rarely match
> that well and generally the quality of the translated copy will
> suffer. It is a lot simpler for a translator to read entire sentences
> and to re-work them for the new language. Remember that you can put
> variables into the translation strings and that if you have more than
> one you should make sure their order is changeable.
>
> /Martin
>
> On Nov 24, 2:48 pm, thomaus  wrote:
>
> > Hi,
>
> > Thanks for your answer.
>
> > 1) I tried to do "../cake/consol/cake i18n extract" from my /MyApp/
> > app/ path and it says:
>
> > Welcome to CakePHP v1.2.4.8284 Console
> > ---
> > App : app
> > Path: /Users/thomas/Sites/MyApp/app
> > ---
> > What is the full path you would like to extract?
> > Example: /Users/thomaus/Sites/MyApp/myapp
> > [Q]uit
> > [/Users/thomaus/Sites/MyApp/app] >
>
> > I don't get why it does so.
>
> > 2) Is there a clear and updated tutorial or blog to do multilingual
> > applications with CakePHP?
> > I found this 
> > onehttp://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persis...
> > but it's completely out-of-date...
>
> > About the plural form, is this blog 
> > correct?http://nik.chankov.net/2008/11/20/translating-plural-and-singular-for...
>
> > Thanks in advance,
>
> > On Nov 23, 4:55 pm, "Larry E. Masters aka PhpNut" 
> > wrote:
>
> > > Ignore this section in the manual it in incorrect:
>
> > > "Remember that po files are useful for short messages, if you find you 
> > > want
> > > to translate long paragraphs, or even whole pages - you should consider
> > > implementing a different solution. e.g.:"
>
> > >http://cakedc.com/usesentireparagraphs.
>
> > >http://cakeqs.org/isanotherexample, the cakeqs.pot for it is located
> > > here:http://groups.google.com/group/cake-php/filesyoucanopen that file
> > > in an editor and around line 1735 see a msgid for an entire paragraph. the
> > > cakeqs-*.po files are the actual files we use in the app.
>
> > > One of the most important settings in the .po file is Plural-Forms:, if it
> > > is incorrect, your plural translations will not look right. Let me know if
> > > you need help with this, I am working to get the old
> > > translations.cakephp.org domain setup again and it will list all the
> > > different plural form expressions:
>
> > > Example (There are 16 forms of plurals, 2 listed below):
>
> > > #English, French, etc
> > > nplurals=2; plural=n>1;
>
> > > #Japanese etc
> > > nplurals=1; plural=0;
>
> > > You can also dig through the test case app in the core that has all the
> > > plural forms in cake/tests/test_app/local/*
>
> > > Another piece of advice you may already know.
>
> > > Using the console you can extract these string with the following command.
>
> > > cake i18n extrac

Re: Pagination on cached data?

2009-11-25 Thread AD7six


On 25 nov, 15:17, leberle  wrote:
> > ps ->paginate($somethingMaybeHuge); is IMO a really bad idea/negating
> > the point of pagination
>
> Hm, i'm not sure if i get you rightyou say that it may be a bad
> idea just because the data passed maybe very large? Dont you have the
> same problem if you call paginate with bad settings, e.g. limit
> 123456789?

If you've ever done that, it's called shooting your self in the foot/
not sanitizing user parameters/screwing up :).

> IMHO it's in the responsibility of the developer to take care about
> the size of the passed data...well, whatever, it would be nice to have
> the pagination available for data that doesn't come from a model.

Perhaps I misunderstood your question. I understood you to mean:

$data = cache('some.key');
$abitofdata = $this->paginateorequivalent($data);

I hope you see the problem in doing that. You can't control the size
of $data in such a case,  as you don't know how big it is until you've
recieved it - which may never happen if you run out of memory in the
process.

> Btw: i decided to do the caching in the datasource, so paginate works
> fine as there is no difference in the upper MVC layers.

Cool idea, same principle.

AD

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: Pagination on cached data?

2009-11-25 Thread leberle
> ps ->paginate($somethingMaybeHuge); is IMO a really bad idea/negating
> the point of pagination

Hm, i'm not sure if i get you rightyou say that it may be a bad
idea just because the data passed maybe very large? Dont you have the
same problem if you call paginate with bad settings, e.g. limit
123456789?
IMHO it's in the responsibility of the developer to take care about
the size of the passed data...well, whatever, it would be nice to have
the pagination available for data that doesn't come from a model.


Btw: i decided to do the caching in the datasource, so paginate works
fine as there is no difference in the upper MVC layers.

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


cake-php@googlegroups.com

2009-11-25 Thread Ragnis
But how can i use it in form url?


On Nov 25, 5:29 am, "Dr. Loboto"  wrote:
> All as you asked. And Cake properly encoded HTML entities as symbols
> "&" are restricted in source and must be represented in text as &
>
> On Nov 24, 9:43 pm, Ragnis  wrote:
>
> > When doing it like this:
> > array ('controller' => 'Accounts', 'action' => 'Manage', '?' =>  array
> > ('var' => 'b73cr6xzr6z', 'var2' => 'somethingelse'))
> > then the result will be /Accounts/Manage/?
> > var=b73cr6xzr6z&var2=somethingelse
>
> > On Nov 24, 6:31 am, "Dr. Loboto"  wrote:
>
> > > You can set form action as:
> > > array ('controller' => 'Accounts', 'action' => 'Manage', '?' => array
> > > ('var' => 'b73cr6xzr6z', 'var2' => 'somethingelse'))
>
> > > On Nov 23, 9:22 pm, Ragnis  wrote:
>
> > > > I need them as GET variables.
> > > > My form is at /Accounts/Manage/?var=b73cr6xzr6z&var2=somethingelse and
> > > > when i submit the form, the GET variables will be gone but i want them
> > > > to stay.
>
> > > > On Nov 22, 11:39 pm, Amit  wrote:
>
> > > > > Is there a reason you can't just include the vars in the form?
>
> > > > > $form->input('var', array('type'=>'hidden', 'value'=> 'b73cr6xzr6z'));
>
> > > > > On Nov 22, 12:54 pm, Ragnis  wrote:
>
> > > > > > So how can i do that?
> > > > > > And i don't want to use /Accounts/Manage/var:b73cr6xzr6z/
> > > > > > var2:somethingelse

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: How to have 2 forms on one page for same model

2009-11-25 Thread Kerr
There are some articles on this subject.  You may try this one out.

http://bakery.cakephp.org/articles/view/how-to-create-multirecord-forms

It includes a component called Multirecord that does some looping to
handle validation.  Be sure to read the comments, as there are some
bugs in the posted code that the comments address.  On a side note, I
find that this kind of thing is all too common with people (not just
Cake bakers) posting code helpers/examples, etc.




On Nov 25, 12:38 am, "#2Will"  wrote:
> Hi All.
>
> I need to have 2 forms on a page that add an item to the db using the
> same model.
>
> The trouble is,  they are setting each others validation off.
>
> How can i isolate the forms so they still use the models validation
> but only the form whos button has been clicked gets validated?
>
> Thanks for any guidence
>
> Will

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


Scaffold and table names

2009-11-25 Thread Kerr
Hi folks, I'm using CakePHP for a new project, and I am having a great
time not having to do so much CRUD work!  That said, I want to set up
a simple $scaffold based model, and I'm having trouble reconciling a
table to a model.  My application handles client billing for a
business, and I have a model named Invoice, with all the convention
based names for tables, columns, controllers, etc.  Invoices must
carry a status, and here is where I'm having some trouble.  Here is
the layout of the assets in question:

Table name: invoicestatuses (OR invoice_statuses)
Model name: InvoiceStatus
Model file name: invoice_status.php
Controller name: InvoiceStatusesController
Controller file name: invoicestatuses_controller.php

CakePHP is able to find my model and controller, but it chokes on
locating the table.  If I use the former table name, CakePHP throws an
error saying it can't find the latter, and vice versa.  I've tried
hardcoding either table in my model using the $table variable, and
even $useTable (not sure if that would generally work anyway), but
CakePHP always comes back telling me it can't find the table for my
model.

What am I doing wrong here?

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: Delete confirm

2009-11-25 Thread AD7six


On 25 nov, 13:39, jburns  wrote:
> This is failing before the delete happens. I just can't track down
> where the delete is failing, when the direct is happening and why it
> is trying to direct to a delete view. As far as I know you never have
> a delete view - the model function does its job and then redirects you
> to the view you prescribe in your controller. Just stumped really.

I'm confused why after asking "I want to ask the user to confirm that
he wants to delete
a record" you're confused that the solution you're following looks for
a view - the view for the confirmation message & form to present the
user.

I can guess you've copied and pasted the code from the article I
linked to without understanding what it does - it prevents your delete
function from running on a get request - by making use of the security
component's blackhole to  prompt the user with a form to confirm
whatever function it is they asked for is really what they want to do.

If the error message is exactly as you typed - delete your
minimalistic app-overriden missing view error, refresh the page and
look for the text "Confirm you have created"
http://code.cakephp.org/source/branches/1.3/cake/libs/view/errors/missing_view.ctp

 - The error message tells you /exactly/ where cake is looking for the
view file you directly or indirectly asked to render - and by some
nifty Ctrl+F action in your controller(s) you can find out where in
the code it's triggering that.

hth,

AD

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: How set value for root parents using tree recover

2009-11-25 Thread AD7six


On 24 nov, 23:31, Aldo  wrote:
> I'm migrating a tree backend to cake.
> Unfortunately there are manay functions who depend from this value, as
> they look for "-1" to identify a root entry.

using -1 with the tree behavior will undoubtedly break it or at the
very least make the tree behavior report your tree to be invalid. If
you really really want to break the tree behavior I'd suggest  you run
recover and then updateAll(array('parent_id' => -1), array('parent_id'
=> null)); Or some other such permutation. Alternatively - why not
capture the conditions used in the model and replace -1 with null. Or
even better since it's obvious that you need to eventually need to
change this, just do it right first time and replace all the -1s with
nulls.

hth,

AD

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: Delete confirm

2009-11-25 Thread jburns
This is failing before the delete happens. I just can't track down
where the delete is failing, when the direct is happening and why it
is trying to direct to a delete view. As far as I know you never have
a delete view - the model function does its job and then redirects you
to the view you prescribe in your controller. Just stumped really.

On Nov 25, 12:25 pm, Fran Iglesias  wrote:
> Hi,
>
> If you don't have a delete view (or don't want to have) I guess you  
> need to redirect to the index action after deleting.
>
> El 25/11/2009, a las 13:22, jburns escribió:
>
>
>
> > The delete view, I presume. The error message is as I typed it.

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: Delete confirm

2009-11-25 Thread jburns
English and literary skills are not what I am grappling with. It is
understanding why it is trying to direct me to the delete view. The
entire message is as I typed - it is being presented in an error view
so there is no more for me to read.

I have removed the delete function from my controllers and added it to
my app_controller:

function delete($id) {
if ($this->{$this->modelClass}->del($id)) {
$this->Session->setFlash($this->modelClass . ' with id ' . $id .
'deleted');
}

$this->redirect($this->data[$this->modelClass]['referer'], null,
true);
}

Somewhere along the line it is trying to direct me to the delete view.
I'd appreciate some pointers, please.

On Nov 25, 12:25 pm, Fran Iglesias  wrote:
> Hi,
>
> If you don't have a delete view (or don't want to have) I guess you  
> need to redirect to the index action after deleting.
>
> El 25/11/2009, a las 13:22, jburns escribió:
>
>
>
> > The delete view, I presume. The error message is as I typed it.

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: Delete confirm

2009-11-25 Thread Fran Iglesias
Hi,

If you don't have a delete view (or don't want to have) I guess you  
need to redirect to the index action after deleting.

El 25/11/2009, a las 13:22, jburns escribió:

> The delete view, I presume. The error message is as I typed it.

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: Delete confirm

2009-11-25 Thread AD7six


On 25 nov, 13:22, jburns  wrote:
> The delete view, I presume. The error message is as I typed it.

Try reading the rest of the error message.

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: Delete confirm

2009-11-25 Thread jburns
The delete view, I presume. The error message is as I typed it.

On Nov 25, 12:10 pm, AD7six  wrote:
> On 25 nov, 12:55, jburns  wrote:
>
> > @AD7Six
>
> > Any ideas why this code errors:
>
> > The view for xxxController::delete() was not found.
>
> > There isn't usually a delete view, of course. I'm not clever enough to
> > work out why it is trying to direct me to this view.
>
> To what view, you keep forgetting to say what view it's looking for :)
>
> AD

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: handling timezone and DST opinions please

2009-11-25 Thread rchavik
I took a different approach and let the db handle it for me.

Refer to my last reply in this thread:

http://groups.google.com/group/cake-php/browse_frm/thread/de3efc2bc06d1edf/5a6a74abefddc316

On Nov 25, 6:40 pm, euromark  wrote:
> i just myself similar questions yesterday
> i played with set_locale() as well as time zones
>
> reading out dates and displaying it via date_default_timezone_set() in
> the specific time is straightforward.
> i was wondering too how inserting/editing dates would work with
> different time zones
>
> not only in add(), but also in edit() or any other form input where
> you have to
> a) translate time from server time to local time
> b) put this value in the input field
> c) on save re-translate it back to server time
> d) save it
>
> e.g.:
> if the server time is GMT+1 and sombody from GMT-6 with his timezone
> set to this timezone enters a datetime like
> "2009-11-11 11:11:11"
> now it should be saved with GMT+1 again ("2009-11-11 11:19:11") so
> that other users with different timezones get the correct result as
> well
>
> so maybe we have to use beforeValidate() and afterFind() to make sure
> the users always have the right time value...?
>
> any other approaches?
> or does date_default_timezone_set() automatically translate those back
> and forth on post?
>
> thx
>
> On 23 Nov., 23:25, Jas  wrote:
>
> > date_default_timezone_set() sets the timezone for all other date and
> > time functions used in the same script, so you wont have to keep
> > specifying it.
>
> > In what timezone do you store your records that have dates? Do you use
> > a common one like GMT 0, Then use the users preferred timezone when
> > displaying it?
>
> > thanks
>
> > On Nov 24, 1:11 am, jacmoe  wrote:
>
> > > I had the same issue and now use gmdate everywhere.
> > > Tested it on two servers in different timezones, and it worked
> > > alright.
>
> > > On Nov 23, 11:29 am, Jas  wrote:
>
> > > > I'd like to know the best way to store records on a server in another
> > > > country. Some of the users will be in other countries. when they view
> > > > their own records (they cant see records of the other users) the dates
> > > > need to display in their local timezone.
> > > > I don't want to store the date as their local time incase they change
> > > > their timezone.
>
> > > > Part 2 of that problem is how to apply DST (Daylight Savings time)?
>
> > > > Does this make any sense?
> > > > How would you handle storing data in a common timezone and display it
> > > > to the user as their preferred timezone?
>
> > > > The main reason for this, is I think I'll be changing webservers and
> > > > will most likely be in a different county. So the servers timezone
> > > > shouldn't have any impact on the data.
>
> > > > On Nov 23, 9:15 pm, Amit Rawat  wrote:
>
> > > > > ok so whats your main problem?
>
>

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: Delete confirm

2009-11-25 Thread AD7six


On 25 nov, 12:55, jburns  wrote:
> @AD7Six
>
> Any ideas why this code errors:
>
> The view for xxxController::delete() was not found.
>
> There isn't usually a delete view, of course. I'm not clever enough to
> work out why it is trying to direct me to this view.

To what view, you keep forgetting to say what view it's looking for :)

AD

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: Delete confirm

2009-11-25 Thread jburns
@AD7Six

Any ideas why this code errors:

The view for xxxController::delete() was not found.

There isn't usually a delete view, of course. I'm not clever enough to
work out why it is trying to direct me to this view.

On Nov 18, 7:50 pm, Amit  wrote:
> I know this sounds basic but it was a mistake I've made before. Make
> sure you got the spelling right and make sure you don't have the
> function defined in another function. I once accidentally wrote my
> isAuthoized() inside of another function (I got lost in curly braces)
> and hit the same issue.
>
> @AD7six - I went through your tutorial and was wondering if the
> SecurityComponent handled protection against CSRF? I'm using
> requireAuth and requirePost to address CSRF.
>
> On Nov 18, 1:11 pm, jburns  wrote:
>
>
>
> > Any takers on this please?
>
> > On Nov 17, 6:25 am, Jeremy Burns  wrote:
>
> > > I am trying to apply this to my site but whenever I access my 'delete' 
> > > action (I have removed references to 'admin_' in the sample code as I am 
> > > not using admin_delete yet) I get the error message "The view for 
> > > XXXController::delete() was not found" (where XXX is my controller). The 
> > > controller doesn't have a 'delete' function in it as I am using the 
> > > genericdeletefunction in the app_controller. What am I doing wrong?
>
> > > Jeremy Burns
> > > On 13 Nov 2009, at 15:44, AD7six wrote:
>
> > > > On 13 nov, 16:30, jburns  wrote:
> > > >> No responses on this - any takers?
>
> > > > Try this for background:http://www.ad7six.com/e/67
> > > > This (the component is in the mi_plugin branch) for a ~pnp solution,
> > > > but probably a bit too integrated/dependent:
> > > >http://code.assembla.com/mi/subversion/nodes/branches/mi_plugin/contr...
>
> > > > or simply:
>
> > > > functiondelete($id) {
> > > > if (!$this->data) {
> > > >  $this->set('referer', $this->referer()); // pick this up in the
> > > > view, and add it to the form
> > > >  return $this->render('/elements/confirm_delete');
> > > > }
> > > > ... actuallydelete..
> > > > $this->redirect($this->data[$this->modelAlias]['referer']); // where
> > > > they came from
> > > > }
>
> > > > hth,
>
> > > > AD
>
> > > > --
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "CakePHP" group.
> > > > To post to this group, send email to cake-...@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=.

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: handling timezone and DST opinions please

2009-11-25 Thread euromark
i just myself similar questions yesterday
i played with set_locale() as well as time zones

reading out dates and displaying it via date_default_timezone_set() in
the specific time is straightforward.
i was wondering too how inserting/editing dates would work with
different time zones

not only in add(), but also in edit() or any other form input where
you have to
a) translate time from server time to local time
b) put this value in the input field
c) on save re-translate it back to server time
d) save it

e.g.:
if the server time is GMT+1 and sombody from GMT-6 with his timezone
set to this timezone enters a datetime like
"2009-11-11 11:11:11"
now it should be saved with GMT+1 again ("2009-11-11 11:19:11") so
that other users with different timezones get the correct result as
well

so maybe we have to use beforeValidate() and afterFind() to make sure
the users always have the right time value...?

any other approaches?
or does date_default_timezone_set() automatically translate those back
and forth on post?

thx





On 23 Nov., 23:25, Jas  wrote:
> date_default_timezone_set() sets the timezone for all other date and
> time functions used in the same script, so you wont have to keep
> specifying it.
>
> In what timezone do you store your records that have dates? Do you use
> a common one like GMT 0, Then use the users preferred timezone when
> displaying it?
>
> thanks
>
> On Nov 24, 1:11 am, jacmoe  wrote:
>
> > I had the same issue and now use gmdate everywhere.
> > Tested it on two servers in different timezones, and it worked
> > alright.
>
> > On Nov 23, 11:29 am, Jas  wrote:
>
> > > I'd like to know the best way to store records on a server in another
> > > country. Some of the users will be in other countries. when they view
> > > their own records (they cant see records of the other users) the dates
> > > need to display in their local timezone.
> > > I don't want to store the date as their local time incase they change
> > > their timezone.
>
> > > Part 2 of that problem is how to apply DST (Daylight Savings time)?
>
> > > Does this make any sense?
> > > How would you handle storing data in a common timezone and display it
> > > to the user as their preferred timezone?
>
> > > The main reason for this, is I think I'll be changing webservers and
> > > will most likely be in a different county. So the servers timezone
> > > shouldn't have any impact on the data.
>
> > > On Nov 23, 9:15 pm, Amit Rawat  wrote:
>
> > > > ok so whats your main problem?

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: MySQL Duplicate entry on Create Error

2009-11-25 Thread jburns
Never say never. There may well be cases where a tinyint is
sufficient. I agree that it is bad bad bad if you are going to let the
user add/delete rows willy nilly (in which case you can hit the
ceiling as TimG did), but I have often used an autoincrementing
tinyint in cases where I know there will be a defined and finite list
of entries. Keeping it to tinyint keeps the database footprint small.
Its horses for courses, I guess.

On Nov 25, 11:06 am, euromark  wrote:
> autoincrement keys should ALWAYS int(>10) etc, never ever tinyint!
>
> On 25 Nov., 07:07, TimG  wrote:
>
>
>
> > Thank you sir you are a miracle worker!!!

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: MySQL Duplicate entry on Create Error

2009-11-25 Thread euromark
autoincrement keys should ALWAYS int(>10) etc, never ever tinyint!

On 25 Nov., 07:07, TimG  wrote:
> Thank you sir you are a miracle worker!!!

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


Dynamic navigation bars

2009-11-25 Thread jburns
I asked a question here a while ago about the best way to extract data
from unrelated models. Primarily, I was thinking about creating
navigation bars and storing the menus hierarchically in the database.
I changed tack a bit, and threw away the database idea. However, I did
crack it and I thought it might be useful for other folks. Pleas see
here: http://www.jeremy-burns.co.uk/2009/11/cakephp-dynamic-navigation-bars/

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: Problem with Host Gator

2009-11-25 Thread Shadab Shaikh
Hello All,

We have found solution, sending the solution so it will be helpful to other.
We have found solution from Cakephp manual - installation guide for shared
server :-).

Below paragraph was helpful to us, hope it will be helpful to others:

_
If you are installing Cake into a user directory (
http://example.com/~myusername/ ), you'll
need to modify the .htaccess files in the base directory of your Cake
installation, and in the app/webroot folder. Just add the line "RewriteBase
/~myusername/".
__

Thanks all for your valuable supports and comments !

Best Regards,
Parvej & Shadab



On Wed, Nov 25, 2009 at 8:49 AM, Dr. Loboto  wrote:

> Try add "RewriteBase /" to app/webroot/.htaccess
>
> On Nov 24, 7:24 pm, Shadab Shaikh  wrote:
> > Dear All,
> >
> > I have setup  a project in Host Gator, its using cpanel.
> > As I am doing normal setup, than its not displaying any page.
> >
> > After research, I found an article in which guidelines mentioned for
> cpanel,
> > page ishttp://www.cakephp.co.uk/installing_cakephp_on_cpanel_server.html
> >
> > When I am using guidelines mentioned in above page, my home page work
> > perfectly,
> > but rest of pages is not working, I am getting page not found error.
> >
> > I appreciate your comments to give more idea about this problem.
> >
> > Thanks in advance !
> >
> > Best Regards,
> > Shadab
>
> 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: Blog Tutorial

2009-11-25 Thread newby
Thank you Patrick, that clarified a lot for me!

I didn't know about the default function arguments in PHP, know i know
it's name i see it too in the PHP manual but couldn't find it in the
cake docs en tutorial, so for all others with problems:
http://www.php.net/manual/en/functions.arguments.php section 'Default
argument values' and example 3

A thank you, and now I think i understand setting to default null is
necessary to use it as an add function too, so calling the add
function or an empty edit function would be the same, except the
templates and setflash saying saved or updated

On 25 nov, 06:45, Patrick Talmadge  wrote:
> 1. edit($id = null) will set the default value of $id to null if
> nothing is passed into edit. If a value is passed to edit $id = null
> will be ignored.
> 2. $this->Post->id = $id will assign the value of $id to the Post
> model. If nothing is passed into edit() null will be assigned.
> 3. if(empty($this->data)) is checking the current form data. If data
> is empty the form hasn't been submitted. $this->data =
> $this->Post->read(); than pulls the Post data and assigns it to data
> so the form can be populated with the current Post values for editing.
>
>
>
> On Tue, Nov 24, 2009 at 4:58 PM, cakephp9 cakephp9  wrote:
> > I have some basic questions about the blog tutorial
>
> > 1 What does edit($id = null) mean, is $id being reset tot null?
> > 2 What does $this->Post->id = $id; then do, make it null too?
> > 3 Why do we check again if the data is empty, the data validation
> > prevents it from being empty?
>
> > Thanks in advance!
>
> >http://book.cakephp.org/view/340/Editing-Posts
>
> > function edit($id = null) {
> >        $this->Post->id = $id;
> >        if (empty($this->data)) {
> >                $this->data = $this->Post->read();
> >        } else {
> >                if ($this->Post->save($this->data)) {
> >                        $this->Session->setFlash('Your post has been 
> > updated.');
> >                        $this->redirect(array('action' => 'index'));
> >                }
> >        }
> > }
>
> > 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- Tekst uit oorspronkelijk 
> > bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

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: Nice url for webroot/files

2009-11-25 Thread AD7six


On 25 nov, 10:41, RugerJ  wrote:
> AD7six no not hand writing ;-) Just an example of the url

If your app generates urls like that - you've got a setup problem.

Using media view to serve files that are in your webroot is pretty
pointless.

AD

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: Properly Normalizing a Products Database to work harmoniously with Cake

2009-11-25 Thread theChrisWalker
table widget (
 `id` primary key
`number` unique widget number
... common fields to all widgets
)

table properties (
  `id` primary key
 `widget_id` foreign key
 `property` name of property
 `value` value of property
 `type` type of value (int, string, float, enum, etc...)
)

table categories (
 `id` primary key
 `name` category name
)

table `categories_widgets` (
 `id` primary key
 `category_id` foreign key
 `widget_id` foreign key
)

widget:
 hasMany properties
 habtm categories

category:
 habtm widgets

property:
 belongsTo widget


After a number of similar projects with similar relationships, I would
say this is the best solution.
It can be extended as needs be with little worry for all your "new"
property needs.

On Nov 24, 7:00 pm, plasmaflux  wrote:
> Hello all!
>
> I'm a novice to CakePHP, have a rusty set of PHP skills, and am maybe
> a 5/10 when it comes to MySQL & databases in general. I was recently
> hired by a company wanting to bring their catalog design and web
> development in-house. After digging through the existing site's raw
> PHP code, I've decided to rebuild it from scratch with Cake. I'm blown
> away by what Cake can do and how it does it! My last large-scale PHP/
> MySQL project was during the php3-php4 transition when PHPLib was the
> hottest thing around.
>
> My company sells Widgets in the Medical field...lots of them...nearly
> 20,000. My largest task at hand is to build an app to both populate a
> Widgets database and search the data. It's a little overwhelming and I
> need some advice.
>
> First, all Widgets have a unique Widget Number. All Widgets can be
> divided into Top-Tier categories a couple different ways. For example,
> a Widget could fall under Forceps or Scissors or Clamps, and could
> also land under Cardiovascular and/or Neurospinal and/or Dental. A
> Clamp will always be just a Clamp, but the same Clamp could be useful
> in both Cardiovascular AND Neurospinal. So categorization presents a
> challenge.
>
> Additionally, all Widgets have a number of properties in common. They
> all have a Price. They all have a Name. They all have Dimensions.
> Here's the really tricky part that's making my brain hurt. They also
> all have a number of properties that are unique either to the item OR
> to the Widget's category. A Clamp may have a curvature with a specific
> radius. A set of Forceps may have an angle. A Needle Holder may be
> Straight or Curved, and may also have jaws that are either Stainless
> Steel, Tungsten Carbide Coated, or Titanium with Tungsten Carbide
> coating.
>
> There are also relationships between certain items that I'd want to be
> available for "Related Widgets" display on a Widget's page. For
> example, a Titanium Needle Holder with Tungsten Carbide Coating may be
> available in 6", 7", 8", 9" lengths, with jaws that are 1mm, 2mm, 3mm,
> 4mm wide and jaws that are Straight or Curved. I need to somehow be
> able to make it clear in the database structure which Widgets are
> related to other Widgets and how; keeping in mind refinable searches
> (Show me all Titanium Curved-jaw Needle Holders).
>
> Then there are things like Cases that hold predefined Sets of Widgets,
> Widgets with X and Y dimensions vs. Widgets with X, Y and Z
> dimensions.and on and on and on.
>
> Not only am I trying to figure out how to create this beast of a
> relational database, I'm also trying to ensure from the beginning that
> it's optimized for CakePHP and remains highly flexible for all the
> unforeseen additions and changes down the road.
>
> Brain.very.exploding. Please help!
>
> A thousand thank-yous in advance to all who read and any who respond!
>
> ~PF

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: Nice url for webroot/files

2009-11-25 Thread RugerJ
AD7six no not hand writing ;-) Just an example of the url

On 24 nov, 21:51, AD7six  wrote:
> On 24 nov, 20:49, RugerJ  wrote:
>
> > I am offering my users a link where they can download uploaded files
>
> >http://www.example/app/webroot/files/[subdir]/[filename]
>
> Are you hand writing that url?
>
>
>
> > is it possible to give a nice url using route.php
>
> > likehttp://www.example/files/[subdir]/[filename]
>
> sure echo $html->url('/files/[subdir]/[filename]') will give you that
> url.

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: Nice url for webroot/files

2009-11-25 Thread RugerJ
Thnx Miles..that wil solve the problem!!

On 24 nov, 21:18, Miles J  wrote:
> Your best bet is to use the Media view.
>
> http://book.cakephp.org/view/489/Media-Views
>
> On Nov 24, 11:49 am, RugerJ  wrote:
>
>
>
> > I am offering my users a link where they can download uploaded files
>
> >http://www.example/app/webroot/files/[subdir]/[filename]
>
> > is it possible to give a nice url using route.php
>
> > likehttp://www.example/files/[subdir]/[filename]

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: Associate by condition

2009-11-25 Thread villosil
Actually I don't really want to find by the type. I want to have them
all, but that cake internally will only apply that association if the
Model accomplishes the condition.
The point of this behaviour is for performance, because I know
beforehand that some of the retrieved Models will have the association
empty. So I just want a way that I can say, hei! not even try to
retrieve the data for these models, because you won't find anything,
just return the Association data array empty :)

On Nov 24, 9:43 pm, Ian R  wrote:
> Couldn't you just create a method in your model which does this, using
> Find()?  For example, FindStandard() or FindByType('STANDARD')?  I
> believe that's Cake-y, and it keeps your controller lean and your
> model fat :)
>
> Ian
>
> On Nov 24, 2:18 pm, villosil  wrote:
>
> > Hi,
>
> > Is there any "Cake-way" to fetch data from associations by a previous
> > condition on the main Model? I'll explain myself:
>
> > Let's say I have a Product Model, which has a hasMany association with
> > an Image Model. The Product has a field called type which defines the
> > type of the Product. For example, by the nature of the app, I know
> > that only Products that are Product.type='STANDARD' can have images.
> > But when i make a find('all) cake always try to fetch the Images for
> > every Product.
>
> > For performance, it would be better to define, before the find('all'),
> > to only apply the association on Products which their type was
> > 'STANDARD'.
>
> > Internally on a find('all') over an object A, if a hasMany association
> > exists with a B Object, cake first gets the data of every A object,
> > and then gets for every A object found, the associated B Objects. I
> > mean that for what I'm looking for, that information would be there
> > before trying to fetch the associated data.
>
> > Has someone faced something similar?
>
> > Thanks in advance.
>
> > Vicent,

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