Re: how to add a relationship whit other key different to the PK

2010-05-12 Thread Martin Westin
Sorry for not noticing your reply until now.

In that case you might get away with simply telling the relationship
that the foreign key is software_id.




On Apr 28, 4:02 pm, Manolet Gmail mano...@gmail.com wrote:
 the problem is that i need to user the value of software_id for the query.

 for example, the HasMany query should be:

 SELECT `Mirror`.`id`,   FROM `mirrors` AS `Mirror` WHERE
 `Mirror`.`software_id` = (6)

 But how i can put in the query, or in the conditions value add the id of
 software_id??

 Thanks in advance

 On Wed, Apr 28, 2010 at 4:35 AM, Martin Westin
 martin.westin...@gmail.comwrote:





  You can set foreign_key to false and instead use the condition of the
  relationship. This is usually used for things like User.active = true
  and simple things like that but I think it can be used for your
  purpose.

  COme to think of it, I may be wrong. I vaguely recall an RC for
  Cake1.2 causing problems when the condition is not an array... and I
  think you might need a string contition.

  On Apr 28, 12:54 am, Manolet Gmail mano...@gmail.com wrote:
   Hi, i have this tables:

   Software
   Reviews
   Mirror
   Requirements
   Published

   Now, this is the relations:

   Software Has Many Reviews
   Software Has Many Mirrors
   Software HABTM Requirements

   Works fine.

   The problem is that i need to resume the tables to get a better response
   from mysql, the reviews tables have text fields and are classified by
   language, so, for the public site i do a Published table for each
  language,
   i mean: language_en language_es language_fr and load the data
  automatically
   into that tables...

   The Published table is a merge of the Software and Review Table. The PK
  of
   Published table is 'id', and is the same number of the reviews table.

   I want to establish this relationship: Published.software_id (not the PK)
   Has Many Mirrors.software_id

   The key has a Unique index, the problem is that aparently i can use the
   foreign_key attribute when declaring the relationship to set the Mirror
   model field, but i cant set the field that i want to use on the Published
   model, it uses the PK by default.

   Is there a way to force it to use other key different to the PK for the
   queries?

   Currently im using afterFind function and works okey, but dont allows me
  to
   use contain or fields.

   Hope you can understand me and help me

   thanks for you time,

   Manolo

   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.comcake-php%2bunsubscr...@googlegroups.c
omFor 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.comcake-php%2bunsubscr...@googlegroups.c 
  omFor more options, visit this group at
 http://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: Limitations to plugins for app modularity - are there any left in cake 1.3?

2010-05-11 Thread Martin Westin
My experience tells me that almost all of your limitations did not
exist even before 1.3


- plugins couldn't access or extend app's models
They could. I did it regularly.

- code in the app couldn't access a plugin's models
They could. But I would not recommend doing it. (IMHO an app should
not break when a plugin is missing)

- plugin did not have callback capabilities in their appController
like app did (eg. beforeFilter, etc.).
They did.

- plugin's views had no way of integrating with cake's theme'ing
I don't know about themes at all so no comment.

- plugin controllers couldn't be managed by Auth/ACL
Auth: they could. ACL: no idea.

The main gotcha I can think of is the dot notation for targeting
plugins. Pizza.PizzaModel or Pizza.PizzaComponent and similar.

I have an app that is made up almost entirely of plugins. Only login/
logout and statistics and reporting are the visible features
residing in the core.

The one hack I made to the 1.2 core was to let urls get a bit shorter
by not requiring the namespacing part of controllers in plugins. /
pizza/pizza_orders is messier than /pizza/orders But this was purely
cosmetic to get prettier urls.





On May 11, 7:57 am, keymaster ad...@optionosophy.com wrote:
 In the past (cake 1.1, and to an extent cake 1.2)  there were
 limitations to plugins which prevented their use as a means of
 modularizing your app's code.

 For example,

 - plugins couldn't access or extend app's models
 - code in the app couldn't access a plugin's models
 - plugin did not have callback capabilities in their appController
 like app did (eg. beforeFilter, etc.).
 - plugin's views had no way of integrating with cake's theme'ing
 - plugin controllers couldn't be managed by Auth/ACL
 - etc.

 The main reason is that plugins were not originally designed as a tool
 for application modularity, but rather were for sharing functionality
 across apps. So, there was originally no intent to have them integrate
 fully into any app.

 As a result,  many people avoided the use of plugins as a means of
 modularizing their apps, and instead defined  additional paths to all
 the cake pieces using the variables for that purpose in config/
 bootstrap. This way, you could have full modularity without any of the
 limitations of plugins.

 With all the good new development in plugins since cake 1.2 and 1.3,
 in particular the ability to have js/css located inside the plugin
 they apply to,  I am musing over the possibility of converting all my
 additional paths folders over to plugins.

 However, I am scared that I will trip over some unknown plugin
 limitation which will become a showstopper.

 So the question is:  in cake 1.3,  are there still limitations to
 plugins which native app code doesn't have, or are plugins for all
 intents, fully considered as additional controllers/models/views to
 the main app, and can integrate freely as any other app code can?

 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: Shared SSL and .htaccess

2010-05-11 Thread Martin Westin
Classic problem.
being inside a aliased folder, like ~myuser you need to edit
your .htaccess file adding a rewrite base. Search and find tons of
threads discussing it in detail. (searching is easy once you know the
right keywords)

Once you got that done Cake should work fine.


On May 10, 6:31 am, lavin carloslavi...@gmail.com wrote:
 I've been trying to make my site work with the free shared SSL
 provided by my hosting (bluehost), which is enabled by accessing the
 URLhttps://secure.bluehost.com/~myuser/subdomainfolder/

 I can see that it is working if i remove the .htaccess files used for
 cakephp (the subdomain folder contains a typical cakephp installation,
 app folder, cake folder, etc)... However i just cant get the htaccess
 to work ok with it

 Has anyone ran into this same problem? Got any ideas for the .htaccess?

 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


Cookie::delete() spits error on one server but not the other

2010-05-11 Thread Martin Westin
I have been scratching my head a bit here and can't find the problem.

$this-Cookie-delete('Auth.User');
...is called on login and logout.

When sometimes the Auth key does not exist in the cookie __values I
get a notice from PHP... but only on my production server. php.ini is
a likely candidate, I just can't find the php.ini setting causing it.
All looks ok to me.

Any ideas?

(Cake 1.3, PHP5.3)

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: Limitations to plugins for app modularity - are there any left in cake 1.3?

2010-05-11 Thread Martin Westin
I think you are reading two posts as one.

I only mentioned using plugins for all visible features except a very
few... nothing about paths.

And to clarify about the app I refer to:
The app is made up of many plugins.. not one common plugin.
There is a lot of common functionality in the main app... just not
exposed as visible features.
The app is plugin-based to enable quick development of new features
and variations of similar features without changing the central
application.
The main menu simply lists activated plugins + user management and
reporting. Each client may have an infinite variation of plugins
activated based on their contract and needs.
The central app does a ton of model stuff and other validation and
also a fair bit of component things that plugins can make use of.

It is all really very straight-forward... but a bit complicated to
explain. I tried on my website and the bakery a while back:
http://www.eimermusic.com/articles/designing-a-modular-application-using-cakephp-plugins/
http://bakery.cakephp.org/articles/view/designing-a-modular-application-using-cakephp-plugins





On May 11, 2:29 pm, AD7six andydawso...@gmail.com wrote:
 On May 11, 2:25 pm, AD7six andydawso...@gmail.com wrote:





  On May 11, 2:12 pm, keymaster ad...@optionosophy.com wrote:

   Actually, believe it or not, many of these issues did exist, but
   admittedly it was a very long time ago.

   For example, it wasn't until late 2007 (Oct./Nov. timeframe if I
   remember correctly), that the ability for app code to access plugin
   models was introduced into the 1.2 branch through the use of the
   Plugin dot notation. Prior to that it was impossible. Not by
   oversight, but by intention.

   Plugins were intended to remain optional, decoupled code from the main
   app, and were not meant to be a means of organizing similiar
   functionality together.

   As an example of the feeling towards app organization/modularity back
   then, I actually dug up this comment by Gwoo (former Project Manager
   of cake) from late 2007:

   Correct me if I am wrong, but it seems some are using plugins to
   organize parts of a larger application. To me, you are on a slippery
   slope here to basically negating the whole benefit of a plugin and
   just making it more work on yourself. Using the config/bootstrap.php
   to organize your MVC requires a lot less code and should yield the
   same benefits.

   That thread is 
   here:http://groups.google.com/group/cake-php/browse_thread/thread/8526219c...

   So, you can see it was originally intended that plugins were not for
   organizing application code, only for sharing amongst developers. As a
   result there were several limitations to how apps could use, or more
   specifically could not use, plugins.

   While it's true that some plugins are optional and the app should not
   depend on them, other plugins might neeed to be an integral part of
   the app, containing code which was just separated off for the purpose
   of grouping closely knitted functionality together, within the larger
   app. In that sense, models in one plugin might need to have
   associations with models in another plugin. (eg. Order belongs to
   Account, or Order HABTM Warehouse, where accounts, orders, and
   warehouses are all in different plugins).

   The limitations back then (I believed based on discussions in this
   group, though I never tried it) prevented the use of plugins for
   grouping together functionality within the app. So, I and many other
   developers used the additional paths to group things together.

   At some point in cake v.1.2 a number of these limitations were
   removed, and in 1.3 yet more were removed.

   So, I'm wondering now that 1.3 is out, is there still a reason to
   organize apps using the additional paths in config/bootstrap?

  I think it's safe to say that a quote from 2007 isn't fair
  justification for not just trying it. I've used plugins almost as long
  as they've existed and can't remember having any problems at all
  worthy of 'holding back'.

  AD

 PS additional app paths and plugins don't solve the same problem, I'm
 kind of scared what you've been up to if for you they are
 interchangable. For me additional app paths is for using exactly the
 same app with different css  a different db whilst maintaining one
 code base. even so the app contained only auth and user logic and a
 contact form - the rest was in a common plugin.

 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 

Re: Datasource CouchDB

2010-04-28 Thread Martin Westin
This is not an answer as such, only an idea if there is no datasource
already.
If you feel a bit adventurous you might be able to sneak a peek at the
MongoDB datasource and make a similar one for CouchDB. The two
databases are not identical but I think significant parts of the
datasource would be similar.

http://github.com/ichikaway/mongoDB-Datasource



On Apr 27, 9:41 pm, Maury maurymmarq...@gmail.com wrote:
 Someone has a datasource for CouchDB cakePHP that works like 
 this?http://book.cakephp.org/view/1077/An-Example

 Thanks

 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: how to add a relationship whit other key different to the PK

2010-04-28 Thread Martin Westin
You can set foreign_key to false and instead use the condition of the
relationship. This is usually used for things like User.active = true
and simple things like that but I think it can be used for your
purpose.

COme to think of it, I may be wrong. I vaguely recall an RC for
Cake1.2 causing problems when the condition is not an array... and I
think you might need a string contition.


On Apr 28, 12:54 am, Manolet Gmail mano...@gmail.com wrote:
 Hi, i have this tables:

 Software
 Reviews
 Mirror
 Requirements
 Published

 Now, this is the relations:

 Software Has Many Reviews
 Software Has Many Mirrors
 Software HABTM Requirements

 Works fine.

 The problem is that i need to resume the tables to get a better response
 from mysql, the reviews tables have text fields and are classified by
 language, so, for the public site i do a Published table for each language,
 i mean: language_en language_es language_fr and load the data automatically
 into that tables...

 The Published table is a merge of the Software and Review Table. The PK of
 Published table is 'id', and is the same number of the reviews table.

 I want to establish this relationship: Published.software_id (not the PK)
 Has Many Mirrors.software_id

 The key has a Unique index, the problem is that aparently i can use the
 foreign_key attribute when declaring the relationship to set the Mirror
 model field, but i cant set the field that i want to use on the Published
 model, it uses the PK by default.

 Is there a way to force it to use other key different to the PK for the
 queries?

 Currently im using afterFind function and works okey, but dont allows me to
 use contain or fields.

 Hope you can understand me and help me

 thanks for you time,

 Manolo

 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: Bakery...arrogance or plain lack of attention

2010-04-26 Thread Martin Westin
I have a few articles published in the Bakery. This does not make me
an authority on the subject but Since my first one was back in 2007 (I
think), before it was even called the Bakery, I do have some
experience of it over a pretty long time.

My personal set of guidelines for writing articles are:
- Write and edit, preview and check... a lot.
- Only publish once. Don't ever edit a published post unless you are
at gunpoint.
- Instead post additions or edits as author comments.
- Keep the rss feed of comments to each of your articles in your feed
reader.
- Respond to real comments and delete spam comments. (I only delete
spam I am certain of)

I have developed some of this due to the sometimes very slow
moderation process. A spell-correction once lingered for many weeks.
This is of-course frustrating. But, if everyone took great care to
check their articles before publishing their content I believe the
process would be significantly quicker.
Other points in my list are there to improve the quality of the
article and to take on a small part of the burden of comment
moderation. By keeping track of comments and responding to them you
improve the quality of your article and the Bakery as a whole. Even if
it is just a tiny improvement, it is something everyone can do. No
forking required. ;)

I believe that the main problems that need to be addressed in the
software are related to spam. It if not perfect in most other
respects, few things are, but the spam comments are the most urgent
problem. They also take up a lot of time, I imagine.
(There is also the thing where an author can't delete his/her own
articles.)

The other frustrations I have experience from time to time are
probably more due to human resources, or a shortage thereof. It is
important to point out that the people involved are NOT the problem...
the rest of us, not involved, are so to speak.
I am sure that with more insight one could see ways of improving the
software that would streamline the work of moderators.


/Martin



On Apr 26, 3:10 am, Graham Weldon gra...@grahamweldon.com wrote:
 Most definitely. We're keeping pretty busy with work on the core at the
 moment, with releases for 1.2.7 and 1.3.0 out recently, we have a fair load
 of work ahead to push through on CakePHP 2.0.

 If anyone has an interest in developing and working on the bakery, we would
 very much welcome it.

 Cheers,
 Graham Weldon (aka. Predominant)





 On Mon, Apr 26, 2010 at 10:49 AM, jacmoe jac...@mail.dk wrote:
  I think you misunderstand:
  When you make a fork of a project on Github, you can make merge
  requests back.
  Which means that if you're unsatisfied with the Bakery (as software),
  just fork it, fix it, and make a merge request.
  Even for small fixes, doesn't matter.
  I am sure Graham and Mark and the rest of the CakePHP team would
  appreciate that. :)

  That's what I mean by forking.

  Cheers

  Jacob

  On Apr 26, 2:04 am, calvin cal...@rottenrecords.com wrote:
   I haven't published anything on the Bakery except for comments, so I
   can't comment on the process. However, I will note that the software
   is pretty screwed up. All my article reply notifications are blank e-
   mails--not even a link to the comment/article. I personally hate it
   when people send me e-mails or make forum posts where they don't write
   anything in the message body and just use the subject-line as the
   message. And I think this, along with dead links in the Cookbook, both
   make Cake look very unprofessional.

   But I don't think just forking the Bakery is a solution. Cake needs a
   centralized/official article/plugins repository. There are just a few
   things that need to be fixed is all. Even if someone were to fork the
   Bakery, it would not be as successful/useful. The Bakery is only so
   useful today because lots of people know about and use it--it's linked
   to right from the CakePHP homepage. So this if you don't like it,
   just fork it attitude is not appropriate. It's similar to the
   attitude that, if you find Cake's documentation lacking, you should
   write it yourself. FOSS is about cooperation and free exchange of
   ideas and information. It's not an excuse to deflect all criticism or
   pin all responsibilities on the user/critic.

   And a person does not need to have contributed to Cake's source code
   to level a valid criticism.

   On Apr 25, 2:46 pm, jacmoe jac...@mail.dk wrote:

That doesn't give you carte blanche to be arrogant, does it?

What have you done for CakePHP if I may ask? :)

A couple of weeks ago I posted this topic:
 http://groups.google.com/group/cake-php/browse_thread/thread/e3a1f469...
With the title 'Let's get rid of The Bakery'.

I volunteered as a moderator, but there's still lots of things to do.
And the software itself needs some fixing.

Feel free to fork it.

I would probably delete the article as well, if there haven't been any
response in three months - I don't know 

1.3rc4 and saveAll, strange return values

2010-04-21 Thread Martin Westin
I wanted to get some input on the return I get from Model::saveAll().
(I am on 1.3 RC4)

When trying to save multiple records of the same model things did not
save at all at first due to the new validation default. I needed
individual validation so that correct records would save but invalid
ones would be tossed.

So I have added validate true like so:
$this-Modename-saveAll($this-
data['Modename'],array('validate'=true));

Problem is I now expected an array of return values, one for each
record as hinted at (somewhere, can't find it now) but I all I get is
false. Even though 3 out of 4 records are saved. I was under the
impression that saveAll would return an array for these partial
successes. Perhaps not?

With validate set to first I do get an array back... but only an empty
one.

Is this a bug and should have a ticket or is there just some confusion
in the way I have read the docs?

thanks
Martin

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: mac users, which ide are you using to develop cakephp?

2010-04-19 Thread Martin Westin
No ide, just Textmate for me.



On Apr 19, 6:14 am, Bryan Lim ytbr...@gmail.com wrote:
 Hi all,

 mac users, which ide are you using to develop cakephp? to compile and
 to debug?

 I search the group here and realised this discussion is dated back to
 2009. So, I want to know if there's any changes?

 thanks,
 Bryan

 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: composite keys to identify a record

2010-04-19 Thread Martin Westin
In conclusion @Renan:
Composite keys are a very normal part of database design but not in
any way supported or very compatible with CakePHP.

Either you have to access that data via your own queris (no find and
save), not use the core Schema Shell to dump the schema ,and a bunch
of other things you loose.

Or, as suggested, you complicate your schema a tiny bit by adding an
extra id field and get to use all the cake stuff.


Just my 2¢
I have only once found it preferable to stick to a multi-key (or zero-
key in that case) table. That table is a WORM table for reporting data
containing only a single data field and about 10 foreign keys. Since
the object is to pull stats you will never ever find a single
record. You will group on the various keys in different combinations
to get graph data. Cake can be forgiven for not supporting that kind
of table.

Personally I think the classic HABTM joining table would haven been
more worthy of support, seeing as there are so many of them in any
given app. But I feel the topic has been discussed to death before. I
don't want to start another discussion about database-religion.

/Martin


On Apr 18, 12:07 pm, Jeremy Burns jeremybu...@me.com wrote:
 And Cake will just 'deal with it', without you having to do any work.

 Jeremy Burns
 jeremybu...@me.com

 On 18 Apr 2010, at 11:04, j0n4s.h4rtm...@googlemail.com wrote:





  Hello,

  for instance you could have Post, Tag, PostTag, Post HABTM Tag / Post
  HasMany PostTag, Tag HasMany PostTag.
  why this example? because it shows the most common place where you
  would - outside of Active Record - use a combined primary key -
  PostTag would have PrimaryKey(post_id, tag_id) - but as Jeremy Burns
  pointed out: besides the very tiny data overhead, what is the issue
  with one additional field as a primary and setting Unique(post_id,
  tag_id)?

  On Apr 17, 12:50 am, Jeremy Burns jeremybu...@me.com wrote:
  I absolutely endorse a single, incremental, non-intelligent primary key, 
  enriched with multi-field unique indexes and the adoption of convention. 
  Why make life any more difficult than it is already?

  Jeremy Burns
  jeremybu...@me.com

  On 16 Apr 2010, at 21:29, Renan Augusto wrote:

  Dear,

  Someone must have encountered a situation where a table had
  with composite key.
  what did you do? Since CakePHP recognizes only one field to
  primaryKey!

  In my opinion I see two possibilities:

  1 - not create tables with composite keys. When you need to use
  composite keys to identify a record, create one more field with the
  name ID and put it as primary key.

  2 - forget standardization. Choose one of the fields to put in
  $ primaryKey attribute of the model and when you need to make a
  relationship (or hasMany belongsTo), use to specify the conditions
  other fields that make up the key of the table.

  That's my opinion, please tell her!

  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.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 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

Tip: MongoDB-Datasource undocumented feature

2010-04-16 Thread Martin Westin
I did not know the datasource could do this and almost didn't try it
as a result. Don't make the same mistake.

Yasushi Ichikaway has developed a very nice datasource for MongoDB.
http://github.com/ichikaway/mongoDB-Datasource/

Mars Story wrote a very nice intro post about it.
http://mark-story.com/posts/view/using-mongodb-with-cakephp

After looking at the github page and reading Mark's post I was
convinced that only ordinary scalar values were supported by the
MongoDB datasource. The source lists only strings, integers and stuff
as datatypes... not objects, arrays or hierarchies in any form.

The good news is that deep nested arrays of data are supported. THis
is a big deal and I don't want anyone else to give this plugin a pass
just because they draw the same conclusions I did.

From my experience, any field defined in the schema can be an array
and contain any hierarchical data. I have given these fields the
datatype array without an error just to indicate to myself that they
are hierarchies.

I have not been able to just add a new root level field but anything
inside a defined field can have any data structure added to it.

Example:
var $mongoSchema = array(
'some_string' = array('type'='string'),
'data'=array('type'='array'), // just a reminder for me
'created'=array('type'='datetime'),
'modified'=array('type'='datetime'),
);

For this model I can save anything inside data. Like:
$this-data['Modelname']['data']['hello']['world'] = 'cool';

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: the plugins dont work at all

2010-04-16 Thread Martin Westin
Hi,
Plugins do work. I have whole apps build with a limited core and
numerous plugins (22 of them in one case).

I can think of a few details to double-check.

I don't think you should have plugins named in camelCase. Try naming
the folder and the urls you try pizza_order instead. (The plugin in
the manual is simply named pizza btw)

app/plugin/poll/
the plugins folder should be named plugins (with an s). You write it
in singular form without the s in one place.

Plugins must have the equivalent of pizza_app_controller.php and
possible pizza_app_model.php too. Without them the plugin will not be
found. At least that was the case when I started using plugins, it
may have changed but I still have them in each plugin.

The final detail I can think of is some rewrite detail messing with
you. Unlikely but since I never run apps as anything but their own
vhost I can't be 100% how plugins react to being in a subfolder. (as
in localhost/apname/)


Those are all long-shots but they are all I can think of that might be
the cause.
Good luck.
/Martin


On Apr 16, 5:28 pm, islam4hak islamco...@gmail.com wrote:
 hi
 why i cant accses any plugin i create ?

 i make the manual tutorial to create the pizzOrder plugin
 but i cant access to it  /pluginname/controllername/action

 so i bake another plugin but i cant access it to

 app/plugin/poll/
 i tryhttp://localhost/appname/poll/
 it dont work

  Error:  PollController could not be found.

 Error: Create the class PollController below in file: appname
 \controllers\poll_controller.php

 so i download a ready to user plugin and i cant access it to
 ?

 the plugin is AJAX star rating plugin for CakePHP 1.2
 i tryhttp://localhost/appname/rating/

 so what i'm doing wrong ?

 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


Timezone management advice

2010-04-12 Thread Martin Westin
Hi, I have found myself in a position where I need to support correct
times across timezones. I'd love any advice and gotchas from those
experienced in timezone management of a Cake app.

I have gotten a bit bewildered by the complexity by something that
looks to simple on the face of it. I need to support time-conversions
correctly and I don't really see full support for it in either Cake or
PHP.

The Basics:
The server may be in a different timezone from the user and users may
be in different timezones.
Times in incoming data (posts, uploads...) need to be converted to
Server Time.
Times for display need to be converted to Client Time.

Some complexities:
You can't sniff the client timezone from the server-side without
(reportedly unreliable) ip-geolocation lookups from the non-free
providers (reportedly less unreliable). So, I need javascript or I
need to ask the user to choose. I'd like to avoid asking the user.
Some timezones use DST. Some do not.
Dates when DST are in effect vary from location to location... and
(big sigh) year to year.

That is basically the broad view of my knowledge of the problems
involved in time-conversions. Am I making things needlessly
complicated for myself? I really need the timestamps to be correct for
the type of app I am developing. Serious things can happen if they get
screwed up by only an hour. The kind of things that cause multi-
million dollar lawsuits and put companies out of business. I don't
want that. :)

Please fire away with your advice and experience on this topic.
/Martin

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

To unsubscribe, reply using remove me as the subject.


Re: How can Schema Shell create new tables?

2010-03-30 Thread Martin Westin
Also, I can't get the reverse to work either. I.e. update does not
notice that a table should be dropped.
I'd love some help on that also.



On Mar 30, 7:51 am, Martin Westin martin.westin...@gmail.com wrote:
 Hi,
 cake schema run update -f always creates an ALTER TABLE statement.
 So how about when a new table is in the schema?

 I see the code really in DboMysqlBase::alterSchema() for my dbo but
 the same logic was found in the Postgres class. Since I am quite sure
 the Schema Shell would not have been released without the ability to
 handle new tables I assume there is something I don't get.

 So, put me out of my misery, please. I really don't see it.

 I can only see that I would have to manually force a create command
 and supply the table name. This can't be the right way since it would
 not work at all in a deployment situation. Can it?

 thanks for any info you can provide.
 /Martin

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


How can Schema Shell create new tables?

2010-03-29 Thread Martin Westin
Hi,
cake schema run update -f always creates an ALTER TABLE statement.
So how about when a new table is in the schema?

I see the code really in DboMysqlBase::alterSchema() for my dbo but
the same logic was found in the Postgres class. Since I am quite sure
the Schema Shell would not have been released without the ability to
handle new tables I assume there is something I don't get.

So, put me out of my misery, please. I really don't see it.

I can only see that I would have to manually force a create command
and supply the table name. This can't be the right way since it would
not work at all in a deployment situation. Can it?

thanks for any info you can provide.
/Martin

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: cake schema run update gone crazy

2010-03-26 Thread Martin Westin

I'll update the thread with some findings after rooting through the
code a bit.

Looking at the source I found out that -f does not force 'generate'
to create a new schema.. It is used To force generation of all
tables into the schema... but not only that.
It can also be used to force update to ignore the Model classes in the
same way as generate and therefore update a schema generated using the
option.

So, Schema Shell appear to do all the important stuff I need... more
testing will confirm.



On Mar 25, 4:59 pm, Martin Westin martin.westin...@gmail.com wrote:
 Ah. Thanks for the hint.

 I have models for all tables... BUT the schema generator does not find
 them all since some are in plugins and some are in sub-foldes of app/
 models. I guess tables matching these models are the cause of the
 problem.

 So in reality, schema shell is only fully usable in apps that do not
 have plugins, multiple dbs or sub-folders inside models. Oh, and all
 table must follow Cake's conventions to the letter. E.g. can't have a
 table without a pk for example.

 I kind of liked the idea of the schema shell. Being abel to keep just
 one schema file and letting Git do the versioning feel just right next
 to the rails-type schema files. So I guess I will have to start
 plowing the source to see if I can make it behave with my schema after
 a reasonable amount of work.

 /Martin

 On Mar 25, 2:07 pm, Ian M. Jones imijs...@googlemail.com wrote:



  Hi Martin,

  Have you got models defined for all the tables in your schema file?

  If not, running cake schema run update will try to add all the columns 
  for any tables missing model files, so I discovered myself today.

  Regards,

  Ian
  
  IMiJ 
  Ltdhttp://www.imij.co.ukhttp://www.ianmjones.comhttp://twitter.com/ianmj...

  On 25 Mar 2010, at 13:02, Martin Westin wrote:

   I thought I'd give schema migrations a try. But something small must
   be horribly wrong with how I am trying to use the schema shell.

   I run cake schema run update on the database that just generated the
   schema and the shell wants to add all the columns to the tables again.
   That can't be right? What's wrong with my schema that the shell thinks
   all tables are without columns?

   I am on Cake 1.2.6 and Apache2, php5.3, MySQL 5... on a Mac with Snow
   Leopard.

   I tried creating an empty db. I ran a create and it created all
   tables... then I ran update and it again wanted to add all (existing)
   columns to the tables.

   Any ideas?

   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

   To unsubscribe from this group, send email to 
   cake-php+unsubscribegooglegroups.com or reply to this email with the 
   words REMOVE ME as the subject.

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


non-interactive Schema Shell for deployment?

2010-03-26 Thread Martin Westin
I am almost there with the Schema Shell. Now just one thing remains.
Being able to do run update -f without answering y or n to the
questions.

Is there a non-interactive mode for the Schema Shell? I can't see any
option to do it.

/Martin

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: non-interactive Schema Shell for deployment?

2010-03-26 Thread Martin Westin
Found a shell-based way to automatically answer the question.
http://www.unix.com/shell-programming-scripting/30246-how-give-variable-command-shell-script.html





On Mar 26, 3:41 pm, Martin Westin martin.westin...@gmail.com wrote:
 I am almost there with the Schema Shell. Now just one thing remains.
 Being able to do run update -f without answering y or n to the
 questions.

 Is there a non-interactive mode for the Schema Shell? I can't see any
 option to do it.

 /Martin

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


cake schema run update gone crazy

2010-03-25 Thread Martin Westin
I thought I'd give schema migrations a try. But something small must
be horribly wrong with how I am trying to use the schema shell.

I run cake schema run update on the database that just generated the
schema and the shell wants to add all the columns to the tables again.
That can't be right? What's wrong with my schema that the shell thinks
all tables are without columns?

I am on Cake 1.2.6 and Apache2, php5.3, MySQL 5... on a Mac with Snow
Leopard.

I tried creating an empty db. I ran a create and it created all
tables... then I ran update and it again wanted to add all (existing)
columns to the tables.

Any ideas?

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: cake schema run update gone crazy

2010-03-25 Thread Martin Westin
Ah. Thanks for the hint.

I have models for all tables... BUT the schema generator does not find
them all since some are in plugins and some are in sub-foldes of app/
models. I guess tables matching these models are the cause of the
problem.

So in reality, schema shell is only fully usable in apps that do not
have plugins, multiple dbs or sub-folders inside models. Oh, and all
table must follow Cake's conventions to the letter. E.g. can't have a
table without a pk for example.

I kind of liked the idea of the schema shell. Being abel to keep just
one schema file and letting Git do the versioning feel just right next
to the rails-type schema files. So I guess I will have to start
plowing the source to see if I can make it behave with my schema after
a reasonable amount of work.

/Martin



On Mar 25, 2:07 pm, Ian M. Jones imijs...@googlemail.com wrote:
 Hi Martin,

 Have you got models defined for all the tables in your schema file?

 If not, running cake schema run update will try to add all the columns for 
 any tables missing model files, so I discovered myself today.

 Regards,

 Ian
 
 IMiJ 
 Ltdhttp://www.imij.co.ukhttp://www.ianmjones.comhttp://twitter.com/ianmjones

 On 25 Mar 2010, at 13:02, Martin Westin wrote:



  I thought I'd give schema migrations a try. But something small must
  be horribly wrong with how I am trying to use the schema shell.

  I run cake schema run update on the database that just generated the
  schema and the shell wants to add all the columns to the tables again.
  That can't be right? What's wrong with my schema that the shell thinks
  all tables are without columns?

  I am on Cake 1.2.6 and Apache2, php5.3, MySQL 5... on a Mac with Snow
  Leopard.

  I tried creating an empty db. I ran a create and it created all
  tables... then I ran update and it again wanted to add all (existing)
  columns to the tables.

  Any ideas?

  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

  To unsubscribe from this group, send email to 
  cake-php+unsubscribegooglegroups.com or reply to this email with the words 
  REMOVE ME as the subject.

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
REMOVE ME as the subject.


Re: After the Cake is baked...

2010-02-22 Thread Martin Westin
Avoid getting sued? Stop being an american work like a charm. ;)
(sorry, I could not resist)


On Feb 22, 8:39 am, Johnny Cupcake sparklew...@hotmail.com wrote:
 OK, so after we have successfully built our modern, interactive
 CakePHP website...where can we learn how to actually /run/ the
 website?  Can you recommend any books or forums that provide a good
 introduction to all the legal, administrative and technical issues?
 For instance, best practices for data backups, how to avoid getting
 sued into oblivion, et cetera.

 The post title is in fun, of course--we all know these issues should
 be dealt with _before_ any coding takes place...right? ;)

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: 1.2.6 strtotime error

2010-02-18 Thread Martin Westin
That should not be a Cake 1.2.6 problem but a php 5.3 problem. (or
even possibly 5.2.10 or something)

I had this error notice way before 1.2.6... and the fix is exactly
what you paste... to set the default timezone so that php is happy.
One small problem is that the PHP manual lists a lot of timezones you
can set that PHP doesn't actually support :)

/Martin


On Feb 17, 8:56 pm, Selino seli...@gmail.com wrote:
 :PHP Warning:  strtotime(): It is not safe to rely on the system's
 timezone settings. You are *required* to use the date.timezone setting
 or the date_default_timezone_set() function. In case you used any of
 those methods and you are still getting this warning, you most likely
 misspelled the timezone identifier. We selected 'America/Los_Angeles'
 for '-8.0/no DST' instead in C:\xampp\htdocs\cake_1_2\cake\libs
 \cache.php on line 429:

 I only get this when I try to use bake in a new cakephp 1.2.6 app. If
 I run bake in the default app folder (the one that comes with the cake
 build) it does this. If I run bake from my old 1.2.5 project (cake_1_2/
 myapp) it works fine.

 Is anyone else having this issue with CakePHP 1.2.6 projects?

 It's not a PHP problem because then it would be consistent with any
 time functions I tried.

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 CakePHP and DB2

2010-02-10 Thread Martin Westin

Can you be more specific. Do you have a problem with CakePHPs db2
driver? What specifically is not working?

I haven't used many drivers (MySQL and Sqlite) but I would expect them
all to work just by choosing to use them.
From the manual

var $default = array('driver'  = 'db2',
 'persistent'  = false,
 'host'= 'localhost',
 'login'   = 'cakephpuser',
 'password'= 'c4k3roxx!',
 'database'= 'my_cakephp_project',
 'prefix'  = '');



On Feb 10, 12:18 am, Hector Mansilla Arias hector.mansi...@gmail.com
wrote:
 Hi there!

 I need some information about how to use CakePHP with DB2... Anybody
 has exprience with that?

 I need to use:

 - Debian.
 - Apache.
 - CakePHP.
 - DB2.

 If anybody did a project link this, please help me with a how-to or
 any idea about the implementation...

 Thanks a lot!

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: inflector - class methods - slug ????

2010-02-10 Thread Martin Westin
Cake only supports conversion of a specified list of characters to
their root a or o.
You need to patch the Inflector class (and post it back to the
tracker).

line 496 of inflector.php is where the action starts. It is quite
obvious where to add your additional characters. Actually I added
those three to this version if you want the quick fix:

http://bin.cakephp.org/view/1955811171

I will let you post the ticket though.


On Feb 10, 2:02 pm, PaulMan pho...@gmail.com wrote:
 hello,

 echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û
 ç );
 what i want is to have the next result
 a_o_i_oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

 but the result is
 _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

 ã should be = a
 õ should be = o

 On 10 Fev, 12:41, anler anle...@gmail.com wrote:



  You want to keep the url with your letters as they are? if that is the
  case, google by IDNA (International Domain Names ... or something, or
  the package Net_IDNA in pear.php.net)

  On Feb 10, 1:35 pm, PaulMan pho...@gmail.com wrote:

   echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û ç
   ');

   results:
   _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

   the first three chars do not work, the first and second are used many
   times in Portuguese language...

   is this a bug? does anybody have a solution?

   best regards,

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: inflector - class methods - slug ????

2010-02-10 Thread Martin Westin
Just my personal opinion:
Making changes to the core has really not been a problem for me since
I put Cake into a Git repo. I just have a branch with my changes in it
and Git takes care of the merging.




On Feb 10, 11:20 pm, jodator joda...@gmail.com wrote:
 Psst, don't do that ;-) I think I saw a ticket about it and id would
 not be fixed in 1.2 branch, but in 1.3 there should be an option to
 add custom chars mapping.

 Don't hack your core either, because it could cause problems when
 upgrading, doing new stuff from fresh cake, etc. Make your own class,
 or make new function in your app_model/app_controller/app_helper and
 use it $this-mySlug();

 I had the same issue with polish letters and I make copypaste from
 core as one of my models' function.

 On Feb 10, 5:17 pm, PaulMan pho...@gmail.com wrote:



  Thank you both!!!
  I used the patch you gave, and used mb_* functions to set string to
  lowercase ( i was having problems with chars like Ó and Á )

  Martin what do you mean by:
  I will let you post the ticket though.
  Sorry im not a expert on CAKEPHP , yet 

  On 10 Fev, 14:37, Martin Westin martin.westin...@gmail.com wrote:

   Cake only supports conversion of a specified list of characters to
   their root a or o.
   You need to patch the Inflector class (and post it back to the
   tracker).

   line 496 of inflector.php is where the action starts. It is quite
   obvious where to add your additional characters. Actually I added
   those three to this version if you want the quick fix:

  http://bin.cakephp.org/view/1955811171

   I will let you post the ticket though.

   On Feb 10, 2:02 pm, PaulMan pho...@gmail.com wrote:

hello,

echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô û
ç );
what i want is to have the next result
a_o_i_oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

but the result is
_õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

ã should be = a
õ should be = o

On 10 Fev, 12:41, anler anle...@gmail.com wrote:

 You want to keep the url with your letters as they are? if that is the
 case, google by IDNA (International Domain Names ... or something, or
 the package Net_IDNA in pear.php.net)

 On Feb 10, 1:35 pm, PaulMan pho...@gmail.com wrote:

  echo Inflector::slug(' ã õ ï ö ä ë ö ü á í é ó ú à è ì ò ù â ê î ô 
  û ç
  ');

  results:
  _õ_ _oe_ae_e_oe_ue_a_i_e_o_u_a_e_i_o_u_a_e_i_o_u_c

  the first three chars do not work, the first and second are used 
  many
  times in Portuguese language...

  is this a bug? does anybody have a solution?

  best regards,

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: Access Global Function in CakePHP

2010-02-10 Thread Martin Westin

I can not imagine why you would use a localized variable variable.
Anyway...

$temp_var = __('String',true);
echo {${$temp_var}};





On Feb 11, 8:14 am, Mukhamad Ikhsan ikhsan.o...@gmail.com wrote:
 global function like __() is break the OOP concept, in some cases i need the
 function bind to an object

 case:
 echo {${$someobject-__('String')}} // This will work
 echo {${__('String')}} // this will not work because curly syntax after ${
 is looking the variable object not a function, even in php manual this
 should work but i have tried and it's not worked

 but because __() is a global function, i don't know how to bind that
 function into a variable/object

 --
 Mukhamad Ikhsan
 Y!id:ikhsan_only

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


Mongo without a schema?

2010-02-09 Thread Martin Westin
Hi, I thought I'd see if any user or contributor to the MongoDB
datasource can answer this question.

The datasource is this one by ichikaway:
http://github.com/ichikaway/mongoDB-Datasource

The datasource strangely requires each model to define $_schema in the
class definition. I say strangely since being schema-less is one of
the main benefits of Mongo, Couch et.al.

It would be interesting to get some insight into what make this a
requirement to gauge wether it would be fruitful to try to find a way
past it. I can see that a lot of the Model class referencing $_schema
to for various reasons but I haven't looked into it in depth yet. I
ask before I spend countless hours trying to do something that might
almost end up as a rewrite of Model itself.

thankful for any insight you may have

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: Release: CakePHP 1.2.6

2010-02-01 Thread Martin Westin
I want to add my thanks to everyone contributing.

@Mark
Did you forget to make this topic a sticky? On the first page in the
google group the 1.2.5 announcement is still pinned at the top but
this one is not.

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


My Cake app presented at CES keynote

2010-01-18 Thread Martin Westin
I have been working on the same Cake app for the past two years. A lot
of it has been a bit hush hush but last week we were truly outed by
Qualcomm.

Check out our 3 min segment from the Keynote:
http://www.greatconnection.se/en/ces

The system transmits medical images from echo machines (ultrasound),
CTs, MRs or any similar digital x-ray type device, to any mobile
phone, any email inbox and a few social networking apps. There is a
lot of high-tech stuff going on behind the scenes and CakePHP is at
the core of it all. Not just for the web-interfaces but actually to
drive the whole thing.

Roughly 85% of the code and all the main logic is CakePHP. The rest is
C and Java for certain things that benefit greatly from being
optimized and run as compiled code.

For a Cake app it is kind of an oddball I imagine. I thought it might
be interesting to hear of a Cake app that is not a CMS or a Twitter
mash-up or some other more common type of application.

I also thought this would come to my defence and help explain some of
the more strange questions I have been asking and problems I have been
having. I may not be all crazy... I hope.


Now... how am I going to work up the courage to attempt to migrate
this monster to 1.3? :)
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: My Cake app presented at CES keynote

2010-01-18 Thread Martin Westin
@John
Thanks.

@Chad
I can't tell what it is exactly

Boy, do I know that phrase! It is so nice to have it out so I don't
have to mask my code and questions as much.
Let me know when you can tell me more. Your app sounds intriguing.

Martin


On Jan 18, 2:07 pm, Chad Smith chadsmith...@gmail.com wrote:
 Hey Martin,

 Nice job!  I too have a rather large app that we are working on with
 cakePHP driving the whole thing.  I can't tell what it is exactly but
 it will be using a C/C# application to do some of the work as the
 program that assists the program is not written in PHP or Java.  Good
 times though, and it's exciting to be working on it.  Sadly it's a
 side project for our company so we haven't had a lot of time to
 dedicate to it yet.  So I might be asking YOU questions about how to
 interface the two systems together sometime soon!  haha.

 Take care and that's really wonderful!  Well done.
 Chad

 On Jan 18, 4:23 am, Martin Westin martin.westin...@gmail.com wrote:



  I have been working on the same Cake app for the past two years. A lot
  of it has been a bit hush hush but last week we were truly outed by
  Qualcomm.

  Check out our 3 min segment from the 
  Keynote:http://www.greatconnection.se/en/ces

  The system transmits medical images from echo machines (ultrasound),
  CTs, MRs or any similar digital x-ray type device, to any mobile
  phone, any email inbox and a few social networking apps. There is a
  lot of high-tech stuff going on behind the scenes and CakePHP is at
  the core of it all. Not just for the web-interfaces but actually to
  drive the whole thing.

  Roughly 85% of the code and all the main logic is CakePHP. The rest is
  C and Java for certain things that benefit greatly from being
  optimized and run as compiled code.

  For a Cake app it is kind of an oddball I imagine. I thought it might
  be interesting to hear of a Cake app that is not a CMS or a Twitter
  mash-up or some other more common type of application.

  I also thought this would come to my defence and help explain some of
  the more strange questions I have been asking and problems I have been
  having. I may not be all crazy... I hope.

  Now... how am I going to work up the courage to attempt to migrate
  this monster to 1.3? :)
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: adding/updating additional fields in HABTM's join table

2010-01-18 Thread Martin Westin

Of-course there is :)

The trick to getting some control over the join table is the with
key.
http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
This tells Cake to use your class file for the join model and any
methods and settings in it.

Mariano also has a good write-up of how to get the join table working
as a real model.
http://marianoiglesias.com.ar/cakephp/modelizing-habtm-join-tables-in-cakephp-1-2-with-and-auto-with-models/

And finally Teknoid has aa very short and clear post about how to
actually save the extra data.
http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-for-habtm-models/





On Jan 18, 9:36 am, Ernesto e.fanz...@gmail.com wrote:
 Hello.

 as the title says is there any way to add/update additional fields
 in HABTM's join table?
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: coding practices with models

2009-12-29 Thread Martin Westin
I feel the same way sometimes. It is tempting to use model methods as
$record-method() in a way similar to an object-based ORM (e.g. Rails,
where class methods are used for finding and instance methods are used
for record manipulation).

But the way Cake works it is a bit dangerous and I would recommend
following John's advice.

/Martin


On Dec 28, 1:39 pm, John Andersen j.andersen...@gmail.com wrote:
 I use the model class as the maintainer of the individual record and
 the provider of a collection of records.

 So in your banana example, my model would know what to do when a
 controller stated that peeling the banana was required :)

 Whether or not to read the banana into the model depends on the
 situation you are in - is the banana currently being viewed, then the
 model already has the banana - but if the banana was just one of many
 selected by the user for peeling, then the model would need to be
 provided with the id of the banana to peel, read it from the database
 and then peel it :)

 I would not let the controller know whether to read the banana in the
 model, that is the models responsibility, to ensure that the correct
 banana is being peeled :) - so the controller would just provide the
 id to the model through the peel method and the model compares whether
 the current banana is the requested one!

 I usually separate the model methods into those that works with an
 individual record and those that work with a collection of records.

 On Dec 28, 4:14 am, Christian cdamiani...@gmail.com wrote:



  When i come across situations that I feel needs to be coded inside the
  model I'm not sure whether (form the perspective of the controller or
  a different model) to treat a model as an object, or just as a
  collection of class methods.

  For example:

  If I want to peel a banana..

  Is it correct to instantiate the Banana
  $this-Banana-read(null,$id);

  and then call the method
  $this-Banana-peel();

  and in banana.php:
  function peel() {
     //since this method was called on a specific instance
     //it should have access to it's private variables (tuple from the
  database)

  }

  OR do i just call the method on the id and sort that out in the model

  $this-Banana-peel($id);

  then...
  function peel($id) {
     //need to instantiate the banana first before we can operate on it
    $this-Banana-read(null,$id);

  }

  I'm curious about the practices of some of you regular cakers.
  thanks

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: Containable query

2009-12-03 Thread Martin Westin
Well,
Containable will not do what you want in this case.
Containable will not limit your primary result-set by conditions on
some associated model.

Logically it might be said to flow like this:
Your query will find all Users since you have no condition to limit
the users.
Each User will also contain it's Student if it has one.
Each such related Student will contain it's Submissions if it has any
and student_id is null.

What you want is a join. One that returns only if there is no record
to join to in the submissions table.
You can do joins a bit Cake-like. Pass 'joins' and an array of
parameters to find. It is not well documented in the manual but Nate
wrote a great article for the bakery about it:
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find

You don't have to build anything like what he suggests but at least it
contains some examples of using the joins key.

A quick googling gave me this page detailing some variations of joins
that might help you figure out which type of join you need.
http://www.wellho.net/solutions/mysql-mysql-joins-using-left-join-and-right-join-to-find-orphan-rows.html


/Martin




On Dec 3, 1:53 am, Bryan Paddock bryanpadd...@gmail.com wrote:
 Hmm... nobody have any ideas?

 On Tue, Nov 24, 2009 at 4:05 PM, Bryan Paddock bryanpadd...@gmail.comwrote:



  Hey all,

  I have this relationship in question:

  User - hasOne Student - hasMany Submission

  I'm a bit stumped on how I can fetch all the users who do not have any
  submissions linked to their name.

  I've tried:

          $list = $this-User-find('all', array(
            'contain' = array(
              'Student' = array(
                'Submission' = array(
                  'conditions' = array(
                    'Submission.student_id' = null
                  )
                ),
              )
            )
          ));

  I have the actAs in the model so the containable behaviour is functioning -
  there is just a problem with my specific query.

  Any ideas?

  thanks!

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: HABTM questions

2009-12-03 Thread Martin Westin
About the pagination:
http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
Look at the bottom. The last examples abut binding can be used to let
paginator deal with your habtm.

When it comes to finding related data find is better than read. But
probably find('first') in this case since it does more or less the
same as read. Use Containable to specify what and how deep you want
your data returned. That should do it...



On Dec 3, 4:02 am, Alan Asher a...@asteriskpound.com wrote:
 I've been scouring the web for a while trying to figure this out.  My brain
 is fried, so I need some help.

 I have a model called Containers, a model called Assets and HABTM table
 called AssetsContainer.

 So a container can have many assets.

 The first question I have is when I'm doing this operation

 $this-Container-read(null,$id);

 How do I paginate the assets.  right now I am only testing so there's only 2
 assets linked to the container.  Am I assuming right that there would be an
 endless number of assets?  If not, still, how do I paginate this data?

 Next question is, each asset can be one of three different tables, Photos,
 Profiles, Blogs.  Each of these models has a hasOne relationship of asset_id
 in each model.  How do I get the read() function to retrieve this data
 automatically?  My first instinct is to put a nominal field for each
 potential table of photo_id, profile_id and blog_id and update the model for
 Asset with the hasOne of each.. This way it will grab the data right?

 Also, is this an instance where instead of read, I use find('all') instead?

 Many thanks,

 Alan

 Example of my Container-read below

 Array
 (
     [Container] = Array
         (
             [id] = 1
             [user_id] = 1
             [title] = Default
             [total_items] =
             [mime_type] = image
             [photo_id] = 1
             [created] = 2009-12-02 11:53:21
             [modified] = 2009-12-02 11:53:21
             [is_fan_club] = 0
             [fan_club_requirements] =
             [nsfw] = 0
             [ordering] =
             [active] =
             [deleted] =
         )

     [User] = Array
         (
             [id] = 1
             [user_type_id] = 2
             [user_group_id] = 3
             [username] = user
             [email] =
             [name] =
             [gender_id] = 1
             [password] =
             [salt] =
             [birthday] = 1991-11-23
             [created] = 2009-11-23 21:41:24
             [modified] = 2009-11-24 15:24:59
         )

     [Photo] = Array
         (
             [id] = 1
             [user_id] = 1
             [asset_id] = 15
             [created] = 1259625133
             [modified] = 1259625133
             [title] =
             [deleted] =
             [file_name] = c0a80aa6-5aab-f111.jpg
             [rel_path] = users/1/2009/11
             [caption] =
             [server_id] = 1
             [is_featured] =
         )

     [Asset] = Array
         (
             [0] = Array
                 (
                     [id] = 1
                     [asset_type_id] =
                     [user_id] =
                     [created] = 2009-11-30 16:12:05
                     [modified] = 2009-11-30 16:12:05
                     [ordering] = 0
                     [allow_comments] = 1
                     [allow_rates] = 1
                     [nsfw] = 0
                     [total_views] = 0
                     [total_rates] = 0
                     [total_rating] = 0
                     [total_comments] = 0
                     [AssetsContainer] = Array
                         (
                             [id] = 1
                             [asset_id] = 1
                             [container_id] = 1
                             [ordering] = 1
                             [created] =
                             [modified] =
                         )

                 )

             [1] = Array
                 (
                     [id] = 2
                     [asset_type_id] =
                     [user_id] =
                     [created] = 2009-11-30 16:13:47
                     [modified] = 2009-11-30 16:13:47
                     [ordering] = 0
                     [allow_comments] = 1
                     [allow_rates] = 1
                     [nsfw] = 0
                     [total_views] = 0
                     [total_rates] = 0
                     [total_rating] = 0
                     [total_comments] = 0
                     [AssetsContainer] = Array
                         (
                             [id] = 2
                             [asset_id] = 2
                             [container_id] = 1
                             [ordering] = 2
                             [created] =
                             [modified] =
                         )

                 )

         )

 )

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

Re: download API documentation and book

2009-12-03 Thread Martin Westin
These will not be the great answers you were hoping for. It is just my
DIY way of dealing with the problem you describe.

On the start page of The Book (left sidebar, at the bottom) there is a
link to all in one page. I go there. Get a cup of coffee while it
renders and then save it as a pdf. Then I have a searchable offline
version.

Unfortunately you can't really do the same with the api... but then
again you have the source code. The API is generated from that
directly.
I often open the cake core as a project and search for various
things. I use Textmate which means I also  get a quick index of the
methods in a class just by opening the source file. I imagine other
editors have similar features.


/Martin



On Dec 3, 11:42 am, Lorenzo Bettini bett...@dsi.unifi.it wrote:
 Hi

 is there a version of APIs and book documentation to be downloaded for
 offline browsing?

 thanks in advance
         Lorenzo

 --
 Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
 HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com
 BLOGS:http://tronprog.blogspot.com http://longlivemusic.blogspot.com

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-12-03 Thread Martin Westin
Really interesting thread guys.

I often resort to just disabling SecurityComponent (I know) when I run
into the black hole of death a few times and can't figure out why.
Is there a good way to debug SecurityComponent problems so that
dealing with specific issues on some forms can be less hit and miss?

For example, I'd like a log or output or something telling me exactly
why my post was denied. Was it because jQuery did the submission?
Because a field doesn't have a corresponding Model? Because...  things
like that.

I don't intend to hijack the thread but since you both (ionas and AD)
seem to have done a fair bit of work on these things I imagine you
have some technique you might be willing to share.

/Martin


On Dec 3, 1:40 pm, AD7six andydawso...@gmail.com wrote:
 On 2 dic, 17:27, j0n4s.h4rtm...@googlemail.com

 j0n4s.h4rtm...@googlemail.com wrote:
  A mostly working solution[1][2], that you can see 
  here:http://github.com/ionas/sna/blob/master/www/app/app_controller.php#L1...

  It is based on Teknoids great information at his blog[3][4], combined
  with a helper that triggers a javascript::confirm(), doubleposts are
  essentially not possible due to SecurityComponent. If you really
  require an js-free confirmation, why not add a checkbox to that helper
  that you have to check before clicking (check if it was clicked in the
  helper and before that onSubmit via javascript)

  [1]http://code.cakephp.org/tickets/view/377
  [2]http://code.cakephp.org/tickets/view/354
  [3]http://teknoid.wordpress.com/2008/11/05/make-your-cakephp-forms-a-lot...
  [4]http://teknoid.wordpress.com/2008/11/06/clearing-up-some-confusion-re...

 That's ... a lot of code. You also have to remember/know in the view
 if you should or should not use your helper.

 FWIW I prefer for things to be a lot more transparent that that.
 Here's an example:http://dl.dropbox.com/u/1027790/csrf-protect-confirm.png

 That's using ajax - but it doesn't have to be (it's not a requirment
 or inherant to the technique/solution).

 The 'magic' is 
 here:http://code.assembla.com/mi/subversion/nodes/branches/mi_plugin/views...

 There's no 'magic' 
 here:http://code.assembla.com/mi/subversion/nodes/branches/blog/views/entr...

 Anyway, good for the topic to be discussed.

 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: Views/layouts/js folder

2009-12-01 Thread Martin Westin
I believe it is supposed to contain layout files for any action you
have that outputs javascript (using parseExtensions). You can return
pure javascript from ajax calls and have that code executed in the
browser.

I have only ever used rss, xml, and a few of my own like xls and
mms... never js, though.

/Martin



On Dec 1, 1:40 pm, Dave davidcr...@gmail.com wrote:
 I believe that is there so when you are coding your layouts, if you link to
 js/whatever.js it will redirect to the proper app/webroot/js folder



 On Tue, Dec 1, 2009 at 7:01 AM, thomaus tho...@saimiris.com wrote:
  Hi,

  Just a simple question. I can't figure out why is there a default
  Views/layouts/js/ folder in Cake. I thought that all the Javascripts
  should go into webroot/js/

  Does anybody know?

  Thanks in advance.

  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.comcake-php%2bunsubscr...@googlegroups.c 
  omFor 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: CakePHP performance 1.2 - is future any better?

2009-11-24 Thread Martin Westin
I can only agree with all these suggestions and add a little beauty i
was introduced to recently. X-Sendfile is a great for performance if
you do any file output from php. It offloads all the actual output of
the file to the webserver (nginx, Apache, lighttpd...).

For me, implementing sendfile for all file output was a 10-minute job
and I improved download speed by about 25% when testing to my home-
computer... and the cpu load showed that receiving an email was more
CPU-intenceive than sending a few dvd-image-sized files with nginx. I
believe that is what they like to call low hanging fruit in
corporate bullshit (that is a real language you know).

(I did also spend a few minutes finding out that nginx wants paths
relative to a configured folder while the other two main players take
a full system path)

/Martin



On Nov 24, 8:12 am, Crazy crazy...@gmail.com wrote:
 Judging by your setup I believe you should start using a profiler, and
 optimize your code a bit or take a better look at why your machines
 perform poorly.

 I run a site that has around 250k hits/day and it's on one box
 (Core2Quad 8800 8GB RAM) with the db on the same machine + .
 It runs on average 75% idle. Only thing that puts it under heavy load
 is the cronjobs that are running.

 Don't know how far you've optimized everything, like ppl say, use an
 opcode cacher(APC in my experience is the most stable) and do other
 things like gzip, fix your keepalives, use cdn, etags,

 In cake, also don't do any find('all'), always specify the fields you
 need, don't use recursion if you don't have to, cache large sets of
 unchangeable data in memcache.

 Use a profiler(I use XDebug), every ms you can optimize will lower the
 load.

 From your description it sounds like an inefficient setup or code.

 I agree that cakephp isn't the fastest framework around, but it isn't
 that slow!

 On Nov 24, 7:37 am, j0n4s.h4rtm...@googlemail.com



 j0n4s.h4rtm...@googlemail.com wrote:
  - Clone all of your application files/code (anything besides /app/
  webroot but including /app/webroot/index.php) to a ram based file
  system on your *nix host.
  - Try lazyloader:http://github.com/mcurry/lazy_loader
  - Never use recursive  -1, make sure containable does not do multiple
  queries, if it does use complex find queries and joins
  - Use elements that are being cached, if you use requestAction make
  sure those are cached too

  On Nov 23, 10:08 pm, Pablo Viojo pvi...@gmail.com wrote:

   Yes, APC and Memcache is a must if you want good performance.

   Regards,

   Pablo Viojo
   pvi...@gmail.comhttp://pviojo.net

   ¿Que necesitas?http://needish.com

   On Mon, Nov 23, 2009 at 5:58 PM, Miles J mileswjohn...@gmail.com wrote:
Haha funny you ask. The mozilla addons site actually runs CakePHP 1.1
and they recently announced they are switching to Django.

All I can say is use APC for opcode caching and memcache for user
caching.

On Nov 23, 11:02 am, Balrog kraus.it...@gmail.com wrote:
 Hello!
 We are running quite growing social network in Poland for students at
 CakePHP, now 70k users and 0.5M hits a day.

 We have 3 app servers for it with CakePHP 1.2.5 installed on each.
 Servers are Quad Core i7 920 + 8G RAM, so rather good machines.

 DB on separate box + nginx frontend for static content on other box.

 Load on each machine is now 5+, i see addons.mozilla using CakePHP
 with far greater traffic than ours

 Have they released info if they have made any significant changes to
 the Cake core ? It is rather publicly known that Cake seems to be
 rather poorly comparing to RoR or Django in performance.

 Any good pieces of advice on how to optimize your app (the cake
 itself, cause app is prettily good written, db also optimized) ?

 Is upcoming 1.3 or 2.0 anyhow faster or less-cpu-using?

 Regards

--

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.comcake-php%2bunsubscr...@googlegroups.c
 om
.
For more options, visit this group at
   http://groups.google.com/group/cake-php?hl=.

--

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




Re: About multilingual websites

2009-11-24 Thread Martin Westin
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 tho...@saimiris.com 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 php...@gmail.com
 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/usesentire paragraphs.

 http://cakeqs.org/isanother example, the cakeqs.pot for it is located
  here:http://groups.google.com/group/cake-php/filesyoucan open 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=n1;

  #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 extract

  This will create the pot file that you would use to create the .po files
  using a tool likewww.poedit.net

  /**
  * @author Larry E. Masters
  * @var string $userName
  * @param string $realName
  * @returns string aka PhpNut
  * @access  public
  */

  On Mon, Nov 23, 2009 at 5:35 AM, thomaus thomas.ausse...@gmail.com wrote:
   Hi there,

   One month ago, I did a multilanguage website using CakePHP but putting
   all the multilangual content in my dB.

   From what I read today, this was the right way to display short
   messages in various languages with CakePHP :
  http://book.cakephp.org/view/162/Internationalizing-Your-Application

   From what I read too, 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.

   Then my question is : is there a standard way to translate dynamically
   long paragraphs?

   Thanks,

   --

   You received this message because you are subscribed to the Google 

Re: File upload size (copy by value)

2009-11-24 Thread Martin Westin
You are looking at the problem form the wrong angle. Don't store 42MB
files in the database, that's all.

Files are best stored in the filesystem. Then you store the filename
(and path) in your database. You will never even need to have the file
in php-memory at all.


/Martin


On Nov 24, 7:37 am, Наргиза Саркулова snt.joc...@gmail.com wrote:
 Hi,

 I recently implemented a file upload feature in one of my cakephp
 project following the guidelines in:

 http://cakebaker.42dh.com/2006/04/15/file-upload-with-cakephp/

 The upload feature is working nice but the only problem is that it
 requires a huge amount of memory because cakephp save function and DB
 function pass their argument by copy so for a 42 megabyte file, for
 example, I get:

 5       0.6854  9126724 ApplicantdataController-attachment( )       
 ../object.php:
 118
 6       0.6855  9126724 ApplicantdataController-saveAttachments( )  ../
 applicantdata_controller.php:195
 7       0.7750  49591836        Model-save( )       
 ../applicantdata_controller.php:398
 8       0.7761  49602268        DboSource-create( ) ../model.php:1253
 9       0.7767  49602220        DboMysql-value( )   ../dbo_source.php:571

 requiring a 120mega PHP request.

 I was wondering if it makes sense to create my own version of the save
 function passing by reference or maybe there is a better way to
 implement the file upload feature. Passing by reference should allow
 me to not have the 49mega copied twice.

 Thanks for your help,
 Nargiza

--

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




Re: CakePHP performance 1.2 - is future any better?

2009-11-24 Thread Martin Westin
Maybe someone should answer the original question: Will future
versions improve performance?

1.3 - most likely not too much.
2.0 - this will likely see some more significant improvements since
php4 is dropped.

Any advancements after 2.0 are also likely to offer improvements as
more and more code is php5 optimized.



On Nov 24, 3:38 pm, Javier javier.cor...@gmail.com wrote:
 CakePHP performance is really poor. To improve it you must use APC and/
 or memcached

 On 23 nov, 16:02, Balrog kraus.it...@gmail.com wrote:



  Hello!
  We are running quite growing social network in Poland for students at
  CakePHP, now 70k users and 0.5M hits a day.

  We have 3 app servers for it with CakePHP 1.2.5 installed on each.
  Servers are Quad Core i7 920 + 8G RAM, so rather good machines.

  DB on separate box + nginx frontend for static content on other box.

  Load on each machine is now 5+, i see addons.mozilla using CakePHP
  with far greater traffic than ours

  Have they released info if they have made any significant changes to
  the Cake core ? It is rather publicly known that Cake seems to be
  rather poorly comparing to RoR or Django in performance.

  Any good pieces of advice on how to optimize your app (the cake
  itself, cause app is prettily good written, db also optimized) ?

  Is upcoming 1.3 or 2.0 anyhow faster or less-cpu-using?

  Regards

--

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




Re: CakePHP performance 1.2 - is future any better?

2009-11-24 Thread Martin Westin
Straight from the source. Thanks Larry, I was mostly guessing that 2.0
would see the bigger improvements. :)



On Nov 24, 4:17 pm, Larry E. Masters aka PhpNut php...@gmail.com
wrote:
 On Tue, Nov 24, 2009 at 9:07 AM, Martin Westin
 martin.westin...@gmail.comwrote:

  Maybe someone should answer the original question: Will future
  versions improve performance?

 Yes



  1.3 - most likely not too much.

 Yes 1.3 already has improvements and more are being found and implemented.

  2.0 - this will likely see some more significant improvements since
  php4 is dropped.

 There are other improvements that are not related specifically to dropping
 php 4, these changes will be back ported to 1.x series of the code to help
 improve performance.



  Any advancements after 2.0 are also likely to offer improvements as
  more and more code is php5 optimized.

 Yes

 --
 /**
 * @author Larry E. Masters
 * @var string $userName
 * @param string $realName
 * @returns string aka PhpNut
 * @access  public
 */

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: addons.mozilla.org soon will leave CakePHP..

2009-11-18 Thread Martin Westin

A lot of their reasoning is solid but part of it sound like classic
1.1 issues. They note some of it in their google spreadsheet.

Reading partly between the lines it sounds like they don't like
Simpletest, the cake shell and php4 limitations (=ORM with array-
data). With that one has to understand that they compare Cake's
roadmap with other frameworks and feel that they will be better served
by a framework with, for example, object-based ORM today and not at
some point in the future.

@jburns, @Okto
I have been building stuff with CakePHP for almost 4 years (on and
off) and I can still recognize the worry you guys express. Will Cake
survive?, Is everyone abandoning the sinking ship? and thoughts
like that can easily crop up when you hear things like this. Back in
2006 the question was wether a rails ripoff could survive at all...
Cake is still here among numerous competitors more or less inspired
by Rails.

Just remember... The Mozilla team are not (afaik) the driving force
behind CakePHP. They have been big users and probably quite big
contributors. They have provided a real-world showcase and test-case
for big deployments that have probably helped find optimization
bottlenecks and things like that.

Also, in relation to the whole li3 thing, the last time CakePHP had a
big crisis (core members disagreeing in public in early 2008 I
believe) it ended up kickstarting the final push towards 1.2 stable.
Mark really started to make himself known as THE driving force behind
a lot of the work and improvements and bug fixes sped up.

CakePHP is like any open project... some people leave as others join
and the fate of the framework is up to you guys, me and anyone who
cares to make any contributions they can to it. You can and certainly
should consider other frameworks, that is just good sense. But you
hopefully chose Cake for a reason and I hope that reason was not that
Mozilla used it :)

Also, a lot of what you learn now will translate quite well to other
frameworks.

/Martin


On Nov 18, 5:07 am, Okto Silaban o...@silaban.net wrote:
 Maybe some of you haven't heard about this..

 Just FYI, AMO (addons.mozilla.org) now still using cakephp 1.1. But
 they've planned to migrate to Django.

 Link :http://micropipes.com/blog/2009/11/17/amo-development-changes-in-2010/

 labanux,http://okto.silaban.net

--

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




Re: Timeout in Internet Explorer but no other browsers

2009-11-10 Thread Martin Westin
I'll say from the start: I don't have the answer to your question.

I reply simply to clarify some points and ask for a few more details.

IE spends 12sec loading before displaying the error on one page. At
the same time IE spends 3min loading on another page before
displaying the same error. Is that correct? If so, it does not sound
at all like a timeout.

If other browsers take similar amounts of time but successfully
display the page, then a php memory problem is unlikely. More likely
is a (small) problem in your output or headers that make IE go nuts.

You get no error, warning or notice from php during the execution? (I
assume you are at debug 1 and have not in some other way suppressed
php's error output)

You are outputting html? Not xml, xls, csv or any other type of
generated file, right?


My best advice for you is to not fix this problem but instead fix
your report-gathering so that it does not take 3min to process the
page. I suggest you look into aggregating and caching your data so
that the pages do not have to do the calculations each time. Data from
3 months ago is not going to change is it? So, if you can process the
raw data via a cron job or something and store the aggregated data
ready for viewing then your page should load in a fraction of a
second, server cpu, ram sql... all will see significantly less load.
Everyone will be happy.

I prefer the star schema type of reports gathering. This is a
theoretical method of re-arranging your data so that it is suitable
for reports and in and you will be able to pull vastly different
reports from that same data a lot quicker than straight from your
normal data. On top of this you may want to further aggregate certain
data for specific reports.

I have written a few base-classes and methods to enable star-schema
generation in Cake. You will find my code and explanations in the
bakery.
http://bakery.cakephp.org/articles/view/starschema-olap-setup-for-reporting

/Martin



On Nov 10, 11:18 am, Adrian gond...@gmail.com wrote:
 Hi,

 I am having the same issue as the following post:

 http://old.nabble.com/Timeout-on-IE-but-not-on-other-browsers-td18082...

 I have a controller for generating (sometimes large) reports and
 Internet Explorer times out whenever I try to run a report. Firefox,
 Chrome and Safari are fine but Internet Explorer (tested on IE7 and
 IE8) displays the following error:

 Internet Explorer cannot display the webpage

 The strange thing is the browser will take longer to load for a large
 report than it would for a smaller then show the error when it should
 render the page.

 As an example I generated a report with results from the last month
 for all clients and it took about 12 seconds then showed the error
 message. I then tried a report for all clients for the last year and
 it took about 3 minutes before showing the error message. Other
 browsers take around the same amount of time to load but show the page
 when finished.

 This issue is definitely not caused by Javascript as I have disabled
 this and it made no difference.

 I tried putting a line above my big query that outputs a space like
 suggested in the previous post:

 echo ' '; // Force IE to actually load the page

 This works, but only on my local machine. I uploaded the exact same
 change to the live (FreeBSD based) server and had the same problem as
 before.

 This only affects IE and I am out of ideas...

 If anyone could help it would be appreciated :).

--

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




Re: Mod rewrite skip

2009-11-10 Thread Martin Westin

Am I right when I say that you want
/app/webroot/manager/existing_file -- should be accessible
/app/webroot/manager/nonexistent_file -- should not be rewritten to a
missing controller page

It that is what you want, the lazy answer is that you don't have to
worry. When you are live... at debug 0... Cake will render a 404 page
for the missing file. It might just look a little different from the
default one Apache renders.

The less lazy answer was found on stackoverflow:

RewriteRule ^manager - [L,NC]

put that before the existing Cake rules and it should do the trick...
if app/webroot is in fact the web root. The thread contains a few
other variations if the above doesn't work.
http://stackoverflow.com/questions/163302/how-do-i-ignore-a-directory-in-modrewrite



On Nov 10, 9:47 am, Walther waltherl...@gmail.com wrote:
 Not sure exactly what you are wanting to do, but CakePHP automatically
 allows you to access files in webroot.

 So if you have a app/webroot/manager and you visit domain.com/manager
 you will automatically access whatever files are in app/webroot/
 manager. This allows you to have 3rd party scripts (like forums, etc.)

 On Nov 9, 9:19 am, kangur91 kangu...@gmail.com wrote:



  I've got problem. Is a possibility to skip folder in modrewrite? For
  example I have folder in /app/webroot/manager/ -- I want to skip
  rewrite on manager folder. PS: this folder is on manager.domain.com

--

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




Re: Date Calculation Problem

2009-10-30 Thread Martin Westin


I do a lot of this kind of thing:

date('Y-m-d H i s', strtotime('+1 hour',strtotime($start_datetime)));

You can use handy things like +2 monday to get to monday two weeks
from now and a number of cool things that I prioritize.

/Martin


On Oct 30, 8:08 am, Jiru jiransl...@gmail.com wrote:
 hii,

  In my project there is issue date and due date in dropdown list.
 My problem is,
  if the issue date is October 10 2009 i want to display the due date
 as October 20 2009 automatically. How i can add/calculate the date.

 regards,
                 jiru
--~--~-~--~~~---~--~~
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: 404 Status

2009-10-30 Thread Martin Westin

debug = 1 and you are expected to be in development and any missing
file is likely to be a missing controller or action.
debug = 0 and you are expected to be deployed... Cake now returns 404
for missing items.



On Oct 30, 7:01 am, #2Will willjbar...@gmail.com wrote:
 Hi,

 My installation of cake returns a 200 status for missing items, eg
 controller not found, action not found etc etc.

 Am i right in thinking this is a bit of a no-no seo wise? I thought
 google likes to see a 404 code for 404 pages.

 Also, it makes it hard to look in firebug and see what files are
 missing (am i incuding jquery correctly etc) because everything is 200
 ok, not 404 and red.  If i open in anouther tab, i get the helpfull
 cake page prompting me to create a controller.

 Is this normal cake behaviour?  how can i change it?  Should cake not
 do this?

 Thanks

 Will
--~--~-~--~~~---~--~~
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: Odd code in sanitize core lib?

2009-10-29 Thread Martin Westin

I am just guessing here but couldn't it be replacing looks like an
exclamation but is really far out into outfer space with a normal
exclamation?

Using a bad font and the code look different.


On Oct 29, 7:32 am, Miles J mileswjohn...@gmail.com wrote:
 I thought you were lying so I checked, and haha it is there. Im
 curious on this as well.

 On Oct 28, 8:51 pm, George H acher...@gmail.com wrote:



  Hi guys,

  I've been debugging my controller that is using Sanitize and I had a
  peek inside the CakePHP Sanitize core lib file, where I found
  something odd.

  Is it possible if someone could explain to me (I'm just genuinely
  curious) the reasoning behind line 223 in /cake/libs/sanitize.php
  (version 1.2.5)?

  $data = str_replace(', ', str_replace(!, !, $data));

  From what I can tell, this line is replacing ! chars with !, and then
  replacing ' chars with '. I've done some checks and the search and
  replace strings are exactly the same.

  As I mentioned, I am genuinely curious (probably more curious if I am
  lost my marbles or not and maybe I'm seeing things), so any core devs
  out there please do not see this as a personal attack on you, or your
  intelligence, or ability to cut good code, etc etc.

  Cheers,
  -- George
--~--~-~--~~~---~--~~
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: Simple question from a newbie seeking help from the gods

2009-10-19 Thread Martin Westin

No, you still need a controller action... but that action does not
need to do more than call the model in this case... well, and format
response data for the view and things like that. The point was that
you mentioned calling one controller from another... that was the main
reason behind pushing this simple functionality down into the model.



On Oct 18, 10:42 am, Will Poillion lorew...@gmail.com wrote:
 Thanks Martin!

 So i can put the method in the model class, but how would I call it
 within a view?

 This is the link I have that calls the ingredients function to remove
 it from the group. If I put the method in the model, I can't call it
 directly like I'm doing below can I?

 Right now this works, but I'm open to a better way:

 ?php echo $html-link(__('Remove', true),
                             array('controller'='ingredients',
                                      'action'='removeFromGroup',
                                      $ingredient['id'],
                                      $ingredientGroup
 ['IngredientGroup']['id']),
                            null, sprintf(__('Are you sure you want to
 remove \'%s\' from this group?', true), $ingredient['name'])); ?

 Can I just put

 $this-IngredientGroup-Ingredient-removeFromGroup( $ingredient
 ['id'], $ingredientGroup['IngredientGroup']['id'])

 directly in the view somehow? That seems to go away from the MVC
 methodology.

 Thanks again!

 Will
 On Oct 17, 10:27 am, Martin Westin martin.westin...@gmail.com wrote:



  First the quickfix... hopefully.

  This will try to save a PHP-null value.
  $this-data['ingredient_group_id'] = null;

  Instead try to save an SQL-null value.
  $this-data['ingredient_group_id'] = 'null';

  Or even just a zero if the above doesn't work.
  $this-data['ingredient_group_id'] = '0';

  Now for a suggestion. For saving a single field Cake models have a
  special function... called saveField no less :)

  $this-Ingredient-id = $id; // this line if very very important
  $successful = $this-Ingredient-saveField
  ('ingredient_group_id','null'); // or 0

  And finally another suggestion. You don't have to call a method in one
  controller from another for this... Better to put the whole
  removeFromGroup() method into the Model and call it from wherever.
  You know you can call a model like: $this-IngredientGroup-Ingredient
  right?

  ... and by answering I am not implying I am a God of any kind ;)

  /Martin

  On Oct 17, 7:56 am, Will Poillion lorew...@gmail.com wrote:

   Just trying to update a single field within a function called from its
   associated model:

   I'm calling 'removeFromGroup' in Ingredients controller from my
   IngredientGroups controller.

   I basically want to remove the ingredient from the group, so set the
   ingredient_group_id to null.

           function removeFromGroup($id = null, $group_id = null) {
                   if (!$id) {
                           $this-Session-setFlash(__('Invalid id for 
   Ingredient', true));
                           $this-redirect(array('controller'= 
   'IngredientGroups',
   'action'='view', $group_id));
                   }

                   $this-data = $this-Ingredient-read(null, $id);

                   $this-data['ingredient_group_id'] = null;
                   $this-Ingredient-save($this-data);
                   $this-redirect(array('controller'= 'IngredientGroups',
   'action'='view', $group_id));

           }

   There's my function. It just won't save the ingredient_group_id to
   null. Not sure what I'm doing wrong. Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple question from a newbie seeking help from the gods

2009-10-17 Thread Martin Westin

First the quickfix... hopefully.

This will try to save a PHP-null value.
$this-data['ingredient_group_id'] = null;

Instead try to save an SQL-null value.
$this-data['ingredient_group_id'] = 'null';

Or even just a zero if the above doesn't work.
$this-data['ingredient_group_id'] = '0';


Now for a suggestion. For saving a single field Cake models have a
special function... called saveField no less :)

$this-Ingredient-id = $id; // this line if very very important
$successful = $this-Ingredient-saveField
('ingredient_group_id','null'); // or 0


And finally another suggestion. You don't have to call a method in one
controller from another for this... Better to put the whole
removeFromGroup() method into the Model and call it from wherever.
You know you can call a model like: $this-IngredientGroup-Ingredient
right?

... and by answering I am not implying I am a God of any kind ;)

/Martin



On Oct 17, 7:56 am, Will Poillion lorew...@gmail.com wrote:
 Just trying to update a single field within a function called from its
 associated model:

 I'm calling 'removeFromGroup' in Ingredients controller from my
 IngredientGroups controller.

 I basically want to remove the ingredient from the group, so set the
 ingredient_group_id to null.

         function removeFromGroup($id = null, $group_id = null) {
                 if (!$id) {
                         $this-Session-setFlash(__('Invalid id for 
 Ingredient', true));
                         $this-redirect(array('controller'= 
 'IngredientGroups',
 'action'='view', $group_id));
                 }

                 $this-data = $this-Ingredient-read(null, $id);

                 $this-data['ingredient_group_id'] = null;
                 $this-Ingredient-save($this-data);
                 $this-redirect(array('controller'= 'IngredientGroups',
 'action'='view', $group_id));

         }

 There's my function. It just won't save the ingredient_group_id to
 null. Not sure what I'm doing wrong. Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



What kind of Model-methods do you write?

2009-10-17 Thread Martin Westin

Dumb question? I hope not. I wanted to see which is the most popular
way of writing methods in models. And by which way and what kind I
am referring to if the methods assume and require a loaded row from
the database or not.

Better use an example. Drawing from the ever present blog tutorial,
assume you want to change a post from draft to published. That is: a
simple method that operated on the model data. Would you write:

function publish() {
$this-saveField('published', 1);
}

or

function publish($id) {
$this-id = $id;
$this-saveField('published', 1);
}

Note: both very condensed and without any returns or error-checking
just to keep things short.

The important bit is wether you prefer to write methods that assume
$this = the table or $this = a row. Variations of save and find will
always be table-level methods but a lot of other methods could be
written either way. Row-level methods would be more natural in
something like rails since results are objects.

From the controller the first method above would be called like this:
$this-Post-read($id); // or find('first',..)
$this-Post-publish();

and the second:
$this-Post-publish($id);


Possibly the example is a poor one but I hope you can discern what I
am driving at.
I have tried writing both ways. I like writing row-level methods but
they can be problematic because of Cake's data handling.

/Martin
--~--~-~--~~~---~--~~
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: gwoo Leaving CakePHP??

2009-10-16 Thread Martin Westin


Best of luck to Garret in his future endeavors.

I am confident that Larry, Nate, Mark, Joel, Andy and everyone else
active in developing CakePHP will continue to do a beautiful job. I
also hope I can continue, if not increase, my miniscule contributions.

/Martin
--~--~-~--~~~---~--~~
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 implement multiple pagination with SAME model on a single view?

2009-10-14 Thread Martin Westin

The support for multiple pagination on the same page is not complete.
The source and API reveals that work did start on this feature but it
was not finished for 1.2. I am not sure if it is suppsed to be in 1.3
or if you have to wait for 2.0.






On Oct 14, 1:30 pm, doze doze...@gmail.com wrote:
 Hello,

 Is there a way to do multiple pagination with same model on a single
 view?

 I know about the $options['model'] in pagination to do multiple
 paginations in single view with different models, but what about
 multiple paginations with same model.

 The model contains a datetime column and I'm trying to do two
 different paginated lists in the view, past events and future events.
 I cannot find a way to tell the paginator how to separate the two
 different lists.

 Please help!
--~--~-~--~~~---~--~~
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 deal with empty data in index-views (example inside...)

2009-10-13 Thread Martin Westin


I just check for empty data and switch out part of the view. Much like
the code sample Ceryl supplied.

For more advanced use you can go all the way to using a status field
in your database. An example, still from my file manager, User hbtm
File can be used to figure out if a user has seen a file before or
if it is new. Each time a file is displayed to a user an association
is created indicating the file has been seen by this user. Each load
of a list of files does a check and formats data for the view so it
can know which files to indicate as new. The trick here is to do this
kind of thing without slowing your application down to a crawl. I had
to do a lot of trickery to be able to handle a few thousand files in a
folder without slowing down or even running out of memory (using
recursive = out of memory).

For your situation you might use a field (fields) in the User model to
determine if it is the first time a user has activated a feature.

Most of the time the smart thing is to write the copy cleverly so it
works for both first-time and I just erased everything situations.


On Oct 12, 6:28 pm, DigitalDude e.blumsten...@googlemail.com wrote:
 @Ceryl:

 yeah I did a little test-view and I think you're right, when you have
 a lot of different pages where empty data can occur, there would be
 many elements. So I tried to check the data within the view and
 displayed a certain div-container when the data-array was empty. It
 works without any problems.

 @Martin:
 This is exactly what I meant. First run information should be given to
 the user, after the user registers and sees a function or category
 for the first time. How did you implement that? Do you check if the
 data is empty within the view? What other ways could we go to achieve
 the desired behaviour?
--~--~-~--~~~---~--~~
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: Can you recommend quality (virtual) server hosting?

2009-10-13 Thread Martin Westin

Thanks for the suggestions guys. I'll look into these and see if one
strikes a chord.


On Oct 13, 6:16 am, 10drill chro...@gmail.com wrote:
 Linode - better virtual machine and DNS management then Slicehost,
 higher specs for the price, and offers 32 and 64 bit architecture.

 On Oct 12, 3:34 pm, Martin Westin martin.westin...@gmail.com wrote:



  Hi, at my day-job we have plans to expand to the US. For that purpose
  I wanted to find a reliable hosting provider. Any good/bad experiences
  you can share would be welcome.

  I am looking for:
  • Server hosting / real, virtual or cloud. (we run special system
  software want to control the OS)
  • Able to scale. (the app is heavy by nature so scaling is
  anticipated)
    • Scaling needs are more likely be disk-space and speed, cpu for
  image/video conversion more than traditional SQL/webfront needs.
  • Very reliable. (clients in out field are not going to like downtime
  one bit)

  The tech-geek in me would really like to put the system on a cloud
  since it looks to help scaling and the cost of scaling.. plus it is
  kewl :)

  I have looked at Amazon a bit but mostly keep reverting to drooling
  over Rackspace cloud.

  Any favorites for deploying critical apps? Please share.

  Martin
--~--~-~--~~~---~--~~
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 deal with empty data in index-views (example inside...)

2009-10-12 Thread Martin Westin


This kind of view is often a good candidate for first-run
information. If you know that empty data will predominately occur for
new users you can use the blank page to display suggestions and
instructions about how to get started.

For example: In my file manager application, an empty folder will
contain a short text suggesting the user uploads some files into it.

/Martin


On Oct 11, 8:04 pm, DigitalDude e.blumsten...@googlemail.com wrote:
 Hey,

 today I was wondering about how I could deal with an index-view where
 no data is available. The main point I'm trying to demonstrate here is
 the following scenario:

 In index-views, commonly we have let's say a table where the data we
 grab from our tables is displayed. But when a user just registered for
 your app, there won't be any data to display. In this case, there
 would be an EMPTY table and that looks really bad in my opinion.

 I think in this case it would be better if there would be NO TABLE and
 instead, there should be a message like Currently you have no entries
 in this category. Add some data by clicking this link...!

 So what I mean is, there should be a check if there is any data to
 display, and if NOT, a message like the one above should be printed.

 But what's the best practice for that? I figured out two
 possibilities, but I'm not quite sure if it's really the perfect
 way...

 1.
 We could use two elements; one where the message is displayed, and one
 where the data is displayed (for example in a table or so...)
 I would do the following check:

 if($somedata) {
     echo $this-renderElement('DataShowElement');} else {

     echo $this-renderElement('EmptyDataMessage');

 }

 2.
 pretty much the same, but without elements so in the view there would
 be a check if the data-variable has any elements and the table would
 only be shown when the data-array has any entries, otherwise there
 would be only the message.

 What is the correct way to do this? Are there any other techniques to
 deal with this kind of problem?

 Regards,

 DD
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Can you recommend quality (virtual) server hosting?

2009-10-12 Thread Martin Westin

Hi, at my day-job we have plans to expand to the US. For that purpose
I wanted to find a reliable hosting provider. Any good/bad experiences
you can share would be welcome.

I am looking for:
• Server hosting / real, virtual or cloud. (we run special system
software want to control the OS)
• Able to scale. (the app is heavy by nature so scaling is
anticipated)
  • Scaling needs are more likely be disk-space and speed, cpu for
image/video conversion more than traditional SQL/webfront needs.
• Very reliable. (clients in out field are not going to like downtime
one bit)

The tech-geek in me would really like to put the system on a cloud
since it looks to help scaling and the cost of scaling.. plus it is
kewl :)

I have looked at Amazon a bit but mostly keep reverting to drooling
over Rackspace cloud.

Any favorites for deploying critical apps? Please share.

Martin
--~--~-~--~~~---~--~~
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 https

2009-10-08 Thread Martin Westin

Find a certificate authority you like (price vs trust).
They all have tutorials and detailed information on how to install
their certificates.

Or google for senf-signed certificates.

(and non of it has anything to do with CakePHP...)


On Oct 8, 5:45 am, wiky wqsha...@gmail.com wrote:
 Hi i am working on Solaris 10 with apcahe and php is configured.
 I have my website placed at /var/apache/htdocs/index.html as document root.
 and i access it on local apache server.

 Now i want to shift it on https to secure it from other systems on LAN.

 what steps i should take to implement.

 Urgent help is needed.

 Thanks

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



Beginners guide to php security

2009-10-06 Thread Martin Westin

I stumbled across this link today. Very good clear example-driven
guide to basic php security.

http://phpsec.org/projects/guide/

Deals with sql injection, xss, hijacking globals, validating input.
All the basics.

It should be said that you get a lot of these things for free with
Cake but I will still keep it in my back pocket for the next time I
get a question about security.

/Martin
--~--~-~--~~~---~--~~
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: afterSave causing save to fail

2009-10-06 Thread Martin Westin

If you are staying on MySQL you can do something like:

SET @pos=0;
UPDATE busstops SET pos = ( SELECT @pos := @pos +1 ) WHERE route = 1
ORDER BY pos ASC

Found that on:
http://dev.mysql.com/doc/refman/5.0/en/update.html

Roughly half-way down the comments. Search for:
Posted by Christian Hansel on July 1 2005 9:13am
and you should find the explanations to go with the code.

good luck



On Oct 6, 10:16 am, WebbedIT p...@webbedit.co.uk wrote:
 You are right I am trying to achieve the simple task of resetting the
 ordering each time to 1, 2, 3, 4, 5 etc.

 If there is a more efficient way to do it then I would love to
 implement it.  I must confess I am no MySQL expert, but I have done
 various searches to find a single SQL query that would do the job and
 came up short.

 Strange thing is though, the afterSave works fine if you are not
 uploading a new image ... and uploading an image should have no baring
 on resetting the number values of the records.

 I have created a workaround for this though by creating my own model
 action which I manually call after a create/edit/delete which in
 effect is doing exactly the same as the above, just called differently.
--~--~-~--~~~---~--~~
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: $form-input('') when database-field contains special characters

2009-10-06 Thread Martin Westin

Strange indeed. I can't remember getting blank strings myself.

/Martin


On Oct 3, 7:01 pm, Melanie Sommer melanie-som...@mailinator.com
wrote:
 Hello Martin Since the field is empty I suspect you may have Sanitize in 
 place, or
  some other text cleaner.

 No (not that I know, just the standard content that cakephp gives you
 when baking)

  A simple character set problem should give you garbage but not empty 
  strings.

 This is also was I thought. But when changing the default settings of
 my webhoster from latin1 (iso-something) to utf-8 everything worked
 fine. Strange but impressive.

 Melanie
--~--~-~--~~~---~--~~
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: Where request comes from?

2009-10-03 Thread Martin Westin

Looks like a handy Ajax handler Miles. But I can't see where it makes
SecurityComponent work with Ajax. All I see is form security being
disabled (lines 85-87).

Making Ajax work with SecurityComponent would involve actually
validating that an ajax post came from the correct form. As with
session ids, the problem again is the asynchronous part of Ajax.

The only half-secure alternative I find remotely practical is to set a
hash as a global javascript variable on each real page load and
store that in the session. On Ajax requests you let that hash stick
around and you require ajax to pass that hash along each call. This
would require the session and the last full page to be hijacked to be
able to post data via Ajax.


/Martin


On Oct 2, 6:02 pm, Miles J mileswjohn...@gmail.com wrote:
 Well you can use my ajax handler, it wraps the security component so
 it works with AJAX calls.

 http://www.milesj.me/resources/script/ajax-handler-component

 On Oct 2, 7:12 am, Martin Westin martin.westin...@gmail.com wrote:



  You CAN... but it is painful to say the least.

  Since you can't have your cake and eat it ;) your best bet is to look
  inside the Security Component to see what parts you want to use and
  then put that into your own component, extend the core component or
  something like that. You can also look at the Security class but it
  does not offer any turn-key solutions for you.

  At the risk of being misinterpreted, I am tempted to say that you
  should not care where requests comes from. Either a request is a
  public request like /posts/display/123 or a protected action like /
  posts/delete/123. Where the request comes from has little relevance in
  the first case. In the second case it really has little relevance too
  since you will be much more concerned about a valid session
  identifying an authorized user, right?

  If your security model needs to include has been posted from exactly
  my form on my page then ajax should not be used for those requests.
  IMHO.

  /Martin

  On Oct 1, 11:05 pm, Dave Maharaj :: WidePixels.com

  d...@widepixels.com wrote:
   But no good for AJAX.

   I have AJAX forms in my app so I cant use the security component.

   Can I? I know it wont work for AJAX submitted forms. I was just curious.

   Dave

   -Original Message-
   From: Martin Westin [mailto:martin.westin...@gmail.com]
   Sent: October-01-09 5:45 PM
   To: CakePHP
   Subject: Re: Where request comes from?

   The Security Component does this kind of thing for you. For example, it 
   will
   embed a hash value into the form which is a checksum of the form. If a 
   field
   is missing or added it will be captured. If a hidden value is modified 
   this
   will also be captured. Also sessions will be more secure and a lot harder 
   to
   hijack since the session id is replaced for each request.

   And a buch more stuff.

   /Martin

   On Oct 1, 9:36 pm, Bert Van den Brande cyr...@gmail.com wrote:
I believe the FormHelper has some 'secure' stuff available for this
... best to consult the documentation ...

On Thu, Oct 1, 2009 at 8:50 PM, Dave Maharaj :: WidePixels.com 

d...@widepixels.com wrote:
  Is there a way to determine / ensure that any requested action
 comes from the server?

 I mean more towards the aspect of forms. That when a form is
 submitted the request is coming from the site and not someone who
 made a form and trying to submit it to your site.

 Just curious

 Thanks,

 Dave
--~--~-~--~~~---~--~~
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: Where request comes from?

2009-10-02 Thread Martin Westin

You CAN... but it is painful to say the least.

Since you can't have your cake and eat it ;) your best bet is to look
inside the Security Component to see what parts you want to use and
then put that into your own component, extend the core component or
something like that. You can also look at the Security class but it
does not offer any turn-key solutions for you.

At the risk of being misinterpreted, I am tempted to say that you
should not care where requests comes from. Either a request is a
public request like /posts/display/123 or a protected action like /
posts/delete/123. Where the request comes from has little relevance in
the first case. In the second case it really has little relevance too
since you will be much more concerned about a valid session
identifying an authorized user, right?

If your security model needs to include has been posted from exactly
my form on my page then ajax should not be used for those requests.
IMHO.

/Martin

On Oct 1, 11:05 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 But no good for AJAX.

 I have AJAX forms in my app so I cant use the security component.

 Can I? I know it wont work for AJAX submitted forms. I was just curious.

 Dave



 -Original Message-
 From: Martin Westin [mailto:martin.westin...@gmail.com]
 Sent: October-01-09 5:45 PM
 To: CakePHP
 Subject: Re: Where request comes from?

 The Security Component does this kind of thing for you. For example, it will
 embed a hash value into the form which is a checksum of the form. If a field
 is missing or added it will be captured. If a hidden value is modified this
 will also be captured. Also sessions will be more secure and a lot harder to
 hijack since the session id is replaced for each request.

 And a buch more stuff.

 /Martin

 On Oct 1, 9:36 pm, Bert Van den Brande cyr...@gmail.com wrote:
  I believe the FormHelper has some 'secure' stuff available for this
  ... best to consult the documentation ...

  On Thu, Oct 1, 2009 at 8:50 PM, Dave Maharaj :: WidePixels.com 

  d...@widepixels.com wrote:
    Is there a way to determine / ensure that any requested action
   comes from the server?

   I mean more towards the aspect of forms. That when a form is
   submitted the request is coming from the site and not someone who
   made a form and trying to submit it to your site.

   Just curious

   Thanks,

   Dave
--~--~-~--~~~---~--~~
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: Where request comes from?

2009-10-01 Thread Martin Westin

The Security Component does this kind of thing for you. For example,
it will embed a hash value into the form which is a checksum of the
form. If a field is missing or added it will be captured. If a hidden
value is modified this will also be captured. Also sessions will be
more secure and a lot harder to hijack since the session id is
replaced for each request.

And a buch more stuff.

/Martin


On Oct 1, 9:36 pm, Bert Van den Brande cyr...@gmail.com wrote:
 I believe the FormHelper has some 'secure' stuff available for this ... best
 to consult the documentation ...

 On Thu, Oct 1, 2009 at 8:50 PM, Dave Maharaj :: WidePixels.com 



 d...@widepixels.com wrote:
   Is there a way to determine / ensure that any requested action comes from
  the server?

  I mean more towards the aspect of forms. That when a form is submitted the
  request is coming from the site and not someone who made a form and trying
  to submit it to your site.

  Just curious

  Thanks,

  Dave
--~--~-~--~~~---~--~~
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: $form-input('') when database-field contains special characters

2009-10-01 Thread Martin Westin

In reference to the bottom f your post. utf-8 and latin1_swedish_ci do
not mix.

Since the field is empty I suspect you may have Sanitize in place, or
some other text cleaner. A simple character set problem should give
you garbage but not empty strings.

/Martin


On Oct 1, 5:59 pm, Dr. Loboto drlob...@gmail.com wrote:
 1. App.encoding must be UTF-8 (core.php)
 2. Database encoding must be UTF8 (MySQL)
 3. Database connection encoding must be UTF8 (database.php)
 4. Layout or server settings must define pages encoding as UTF-8 (app/
 layouts/default.ctp and etc or Apache AddDefaultCharset)
 5. Files with non-latin symbols must be in UTF-8 ecoding without BOM

 On Oct 1, 7:48 pm, Melanie Sommer melanie-som...@mailinator.com
 wrote:



  Hello,

  I have the following problem, I already googled but did not find an
  answer although I think it must be a quite common problem:

  When adding or editing and inserting a special character in a text
  field (for example ä, ö, ü, ², µ, ...) everything seems at first to
  work fine. The text is correct in the mysql databse and is displayed
  correctly in any view.ctp or index.ctp.

  But when trying to edit this entry, that means calling edit.ctp with
  $form-input('title'); the text field containing special characters
  simply stays completely empty. So I do not have the problem that the
  special characters are displayed wrong, the whole content is simply
  not displayed at all.

  If it is important my settings are:
  app/core.php
  Configure::write('App.encoding', 'UTF-8');
  my mysql database collation is latin1_swedish_ci

  Thanks for any advise!
--~--~-~--~~~---~--~~
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: afterSave causing save to fail

2009-10-01 Thread Martin Westin

Maybe Cake does not like you calling a saveAll inside a saveAll?

A bit unrelated, but what is that afterSave doing? It looks like a lot
of work for little result. What I see is you finding all images in a
gallery ordered by the order_id. Then you set the order id of each one
to a number in increasing order and then saving them all again. That
is a lot of work just to make sure you don't have any gaps in the
numbering. Or I may be reading the code wrong. Google has an evil line
wrap as I'm sure you know.

I am guessing you allow the user to set the order of the edited image
in the form? Maybe you should look at an ordering solution that is
more suitable to the way the interface work? Or try to optimize the re-
ordering (you may want to give that job to MySQL).


/Martin


On Oct 1, 3:29 pm, WebbedIT p...@webbedit.co.uk wrote:
 I am having a problem with the below setup. All works well if editing
 a record without uploading new images, but if I upload an image the
 final line of my afterSave() function causes the saveAll() in my
 action to fail.  I know this as commenting out that line allows
 everything to work, but my numbering then goes out of sync without it.

 Any ideas why uploading an image through this form would stop that
 call running, the data that I am fetching and saving within the
 afterSave function is identical either way?!?

 form:
 echo $form-create('Image', array('type'='file', 'url'=$html-url
 (array('action'='add'), true)));
   echo $form-input('Image.id');
   echo $form-input('Image.name');
   echo $form-input('Image.gallery', array('options' = array
 ('portfolio'='portfolio', 'art-prints'='art-prints')));
   echo $form-input('Image.full_image', array('type'='file'));
   echo $form-input('Image.thumb_image', array('type'='file'));
   echo $form-input('Image.html_title');
   echo $form-input('Image.meta_description');
   echo $form-input('Image.order_no');
 echo $form-end('Submit');

 action:
 if (!empty($this-data)) {
   if ($this-data['Image']['full_image']['name']) $files[0] =
 'full_image';
   if ($this-data['Image']['thumb_image']['name']) $files[1] =
 'thumb_image';
   if (isset($files)) {
     if ($data = $this-Uploader-uploadAll($files, true)) {
       if ($this-data['Image']['full_image']['name']) $this-data
 ['FullImage'] = Set::merge($this-data['FullImage'], $data
 ['full_image']);
       if ($this-data['Image']['thumb_image']['name']) $this-data
 ['ThumbImage'] = Set::merge($this-data['ThumbImage'], $data
 ['thumb_image']);
       if ($this-Image-saveAll($this-data, array
 ('validate'='first'))) {
         $this-Session-setFlash('pImage updated./p', 'default',
 null, 'admin');
         $this-redirect(array('action'='index'));
       } else {
       echo '1';
         $this-Session-setFlash('pImage not updated, correct errors
 and resubmit./p', 'default', array('class'='error'), 'admin');
       }
     } else {
       $this-Session-setFlash('pImage not updated, correct errors
 and resubmit./p', 'default', array('class'='error'), 'admin');
     }
   } elseif ($this-Image-save($this-data)) {
     $this-Session-setFlash('pImage updated./p', 'default', null,
 'admin');
     $this-redirect(array('action'='index'));
   } else {
     $this-Session-setFlash('pImage not updated, correct errors and
 resubmit./p', 'default', array('class'='error'), 'admin');
   }} else {

   $this-data = $this-Image-find('first', array('conditions'=array
 ('Image.id'=$id)));

 }

 afterSave:
 $result = $this-find('all', array(
   'fields'=array('Image.id', 'Image.order_no'),
   'conditions'=array('Image.gallery'=$this-data['Image']
 ['gallery']),
   'order'='order_no',
   'contain'=array()
 ));
 if ($result) {
   foreach($result AS $k = $v):
   $data['Image'][$k]['id'] = $v['Image']['id'];
   $data['Image'][$k]['order_no'] = ($k + 1);
   endforeach;}

 $this-saveAll($data['Image'], array('validate'=false,
 'callbacks'=false));
--~--~-~--~~~---~--~~
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: slow static multilingual site made with cakephp

2009-09-28 Thread Martin Westin


Loads very fast most of the time but it does load very slowly at other
times. I get results mostly around 0.06-0.1s but a few were all the
way up at 4.5s.

To me that suggests either some problem with disk speed. Are you on
(an overloaded) shared server or is this site all that is running on
the system?

Set debug to 0. Anything else and cach will not work at full capacity.
At debug 1 Cake will re-write the language cache, database schema
cache, paths... every 10s or so. That in combination with an
overloaded or for some other reason slow server could account the the
intermittent slowness.

If the server is under your control in any way I would also check if
it is hacked or someone trying to hack it (bombing the ftp or some
other service with logins). Check the logs. Is the web access log full
of requests to things that do not exist (like windows exploits on a
Linux server)? Is the general logs full of failed logins? Is some
process taking up a lot of cpu when it shouldn't? And so on...

/Martin


On Sep 27, 11:41 am, Number 23 qfl...@yahoo.it wrote:
 Hello, i made a static website with cakephp, using the
 internazionalization functionality.

 preview is at http:\\www.sunchaser.it, login/pwd is emo/emo.

 The initial loading is very slow, and i don't understand why, the page
 is very light. Any help please? can it depend because cakephp is
 translating the text?

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



Re: Javascript inside a ajax content not work

2009-09-28 Thread Martin Westin

Some (most?) javascript libraries will strip the response of live
javascript. You should configure the ajax call to evaluate the script
instead. Exactly how you do that depends on the library.



On Sep 28, 10:34 am, marco.rizze...@gmail.com
marco.rizze...@gmail.com wrote:
 Hi
 I use ajax helper to load the content of a div inside my page.
 In this ajax content I have this:
 ?php        echo $javascript-codeBlock('var value='.$value.';');        ?

 But when I try to use the javascript variable value I get the error
 that the value doesn't exist.
 In my ajax call I have set eval to true.
 Can someone tell me what is the best practise to use javascript inside
 ajax content?
 Many Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: MAMP + CakePHP issues

2009-09-25 Thread Martin Westin


On 1 I second the opinion that vhosts are the way to go. I have never
ever ever bothered modifying htaccess files just to get a few apps to
run under localhost/one, /two and so on. You are on a Mac and in
perfect position to setup in a way that is 100% identical to a
production deployment. You need two things. vhosts in the apache conf
and fake hostnames for each vhost.
There might be a gui but I just edit the file /etc/hosts adding fake
names pointing to 127.0.0.1
127.0.0.1   one.site
127.0.0.1   two.site
...
That is very convenient.

Managing vhosts were mentioned by Frederick. An alternative is to pay
for MAMP pro which has built-in support for vhosts and advanced
features. Personally I use Apples supplied Apache and PHP and install
MySQL as a pkg so I have no details to offer on vhosts in MAMP.

Speaking of MySQL. Your second problem might be caused by differing
versions of MySQL if the errors apply only to certain queries. If they
are advanced as you say then they might require a more up-to-date
version than MAMP has. Either that or the version of Cake.

And when reading the backtrace, the top line is closest to the error.
Cake is born in webroot and looking at the error MySQL has problems
interpreting __getUsersForUsers as a SQL syntax... which I can
understand. That indicates to me that your version of Cake might be
the problem. It looks like a bug in your code but if you are sure the
same code is executed without problem on another install then it may
be a version problem.

/Martin



On Sep 25, 3:58 pm, FrederickD manzanillo.engl...@gmail.com wrote:
 Hi Fahd!

 I can advise you on the first question, but not the second. I had been
 using MAMP but decided to take it off and go with a stock approach. It
 took a little bit, but works solidly now. What makes it very easy is
 to use a cheap product called VirtualHostX. You can find it 
 athttp://www.macupdate.com/info.php/id/25689/virtualhostx. The price
 recently went up it appears, but it is so worth it to not be
 frustrated while developing multiple sites. VirtualHostX is MAMP-
 friendly.

 I use it to have a sandbox site where I'm testing code and integration
 before moving that code over to the development site. Both can be up
 at the same time, obviously with different databases, but it could be
 the same one. Hmmm...

 Anyway, I am also using a product called ModelBaker fromhttp://widgetpress.com
 that also is MAMP-friendly and removes the need to use a command line
 when baking. All the database design is visual and the configuration
 of Cake is a snap. It is a RAP (rapid application prototype) tool that
 does a great job at generating 80% of the Cake code so you can focus
 on the 20% that is unique to your application. Plus it can generate an
 iPhone-aware web application. That's like getting a two-for-one deal!
 Very promising product.

 I hope some of this helps.

 On Sep 24, 3:10 pm, fahd fahd...@gmail.com wrote:



  Hey fellow Cakers,

  I've been developing on CakePHP for a bit and decided to have a
  localhost version on MAMP so that I could demo my app to people
  without being dependent on an Internet connection.

  Ran into a few issues ofcourse and hoping someone can give some
  insight:

  1) I have several sites under the /Sites/ folder and I pointed MAMP's
  Apache document root there. For example /Sites/project1/ is where the
  Cake app sites.  It finds the /project1/ site fine (after some
  htaccess mods) but there are issues with relative links. Any link that
  is manually coded and not using $html-link uses /Sites/ instead of /
  Sites/project1/ as the base. This is for images and any Ajax calls
  from jQuery. (css and js files are fine). The images I can bare, but
  the site is unusable without Ajax.

  Temp solution: changed the document root to /Sites/project1/. This is
  not ideal, but I'd like to know if you guys have a fix so I don't have
  to change the document root all the time for previewing different
  projects.

  2) We have a lot of complex MySQL queries being made, using 
  $this-query('SELECT...'). We've placed these in the appropriate models

  within a function. Hence from the Controller we'll have something like
  $this-Users-getMeSomething($variable), that goes to the user.php
  model and runs that function. This works fine on our live and dev
  sites, but for some reason on MAMP I'm getting the error:

  Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
  check the manual that corresponds to your MySQL server version for the
  right syntax to use near '__getUsersForUsers' at line 1 [CORE/cake/
  libs/model/datasources/dbo_source.php, line 525]

  The context:
  ==
  DboSource::showQuery() - CORE/cake/libs/model/datasources/
  dbo_source.php, line 525
  DboSource::execute() - CORE/cake/libs/model/datasources/
  dbo_source.php, line 201
  DboSource::fetchAll() - CORE/cake/libs/model/datasources/
  dbo_source.php, line 336
  DboSource::query() - 

Re: Doubt in cake php

2009-09-24 Thread Martin Westin

Ever heard of a can of worms :)
(The whole -This is MVC. -No, this is MVC thing can turn nasty at
times.)

Cake allows no direct access to Models from Views. That is how the MVC
pattern has been implemented in Cake even though there are other
interpretations in other Frameworks. If everyone had the same
preference there wouldn't be such an abundance of frameworks doing
more or less the same things but is slightly different ways.

I have never found cakes strict partitioning to be a problem in any
particular situation I can recall. This is likely to be because the
web is request based. Every time you will ever see a view rendered
that has to have been as the result of a request. And all requests go
through a Controller so you will always have access to Model data in
every request and the ability to pass that data to the view. Things
can be very different in a desktop application or something like a
Flash application in which the code runs continuously throughout the
session. In these types of applications the MVC works a bit
differently.

I get the feeling from your question that you may be thinking too
strict in another way (as may seem to do). You are not limited to
locking the User model to the Users controller and the users views
only. I tend to think of the models on the one side and the controller
and view as a pair on the other. That is, the controller and view(s)
are tightly linked but the models can be utilised a bit more freely.

I would never render the Posts/index view from the Users controller
for example. But I would, and often do, access the Post model from the
Users controller and pass the data to the users views. To finally get
to some kind of point: Why would it be a problem to get the list of
user clubs in the controller and pass it to the view as you put it?
That is the primary purpose of the controller. It is essentially there
to interpret the request, access the model(s) and present that data to
the view. If you accessed the Models from the Views, the Controller
would not do much more than request routing.

I hope you are not offended by this accidental lecture on MVC. A topic
I am not an expert in by any stretch of the imagination. I was trying
to explain my limited knowledge of the reasoning behind the design of
CakePHP and to explain that there is more than one way to design an
MVC framework. You already mentioned yourself that you knew of a way
to access your data. I am afraid the better way you are looking for
is not allowed. You could of-course probably set the whole Model
instance as a view variable but I have never tried that.




On Sep 24, 10:59 am, hunny saurabh85maha...@gmail.com wrote:
 Hi Guys,

 I am new to cakephp. I am having the following issue:

 I am displaying list of checkbox containing clubs to a login user. The
 list of clubs I am passing through the models via controllers in the
 traditional way.

 Now the logged in user should see his list of clubs automatically
 ticked. This list is present in another database.

 One solution is to get the list of user clubs in the controller itself
 and pass it to the view.

 But is there any alternative way, where I can access the user clubs in
 the view itself without loading in the controller.

 Basically i am looking for something similar like View Helpers in
 Zend. We can access the model data in views using view Helpers. Is
 there something similar in cakephp.

 P.S: I have asked this question to a few people who knew cake php and
 their first reaction is that you shouldn't access model data in views
 as it is against MVC. But let me assure you we can access model data
 in view as long as it is read only. At least that is what we are used
 to follow in Zend Framework. :)
--~--~-~--~~~---~--~~
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: i18n table with 180 000+ entrys

2009-09-23 Thread Martin Westin

One thing I have yet to figure out is how to deal with charset/
collation problems using an i18n table. Because of this I would
probably go for separate tables even though it requires more work to
make id's sync and all that.

The problems I am referring to are queries like
$this-Person-findByFirstName('Pär');
which in Swedish should return users that are called just that but in
English should return any name with any variation of the a character
since ä is not a character in the English alphabet. It is only seen as
an a with some irrelevant bling bling.

I have not seen any supported way of telling the database which
language you want to search in. All I have know of is to try to hack
it into the conditions and order clauses and end up just one step
short of a custom query.

Using separate tables you at least have the option to set them to the
correct collation for the intended language.


Sorry for taking up space with this explanation. It ran a bit long but
it can be unpleasant finding out your searches return the wrong data
when your app is already live. :) I hope someone with good experience
using the translate behaviour can shed some light on how they get make
it work.





On Sep 22, 6:33 pm, chrispie cpiet...@gmail.com wrote:
 hei list!

 I was wondering if the i18n table is still state of the art for about
 30 000 entrys (cities) in a model (=180 000 entrys in i18n).

 Or is there a better solution like using a table prefix for different
 languages (de_cities, en_cities,)?

 thankYouVeryMuch

 chris!
--~--~-~--~~~---~--~~
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: Advanced setup

2009-09-22 Thread Martin Westin

Your problem is likely the cause of one of your .htaccess files not
set correctly. You probably need a rewrite base. If I get your setup
correctly (and I am not at all sure I do) you have the Apache document
root set to var/www and everything else if in sub-folders of that.

I can't really figure out what you are trying to achieve by this
setup.If it is just allowing you and a college to use the same cake
core on different development branches of the app on the same server I
think you are doing this too complicated for yourself. For example:
- Why define APP_DIR with a foldername in an index.php that is in the
app dir already? index in webroot will do that correctly for you.
Renaming it doesn't hurt this.
- The same question for ROOT

All you really should need to set is CAKE_CORE_INCLUDE_PATH since it
is the only folder you have moved. (you still need working rewrite
rules, though.)


I never install in this way myself so I have not examples of rewrite
settings for you. I hope I could at least point you vaguely in the
right direction.

/Martin


On Sep 22, 1:20 am, The Roman mtes...@gmail.com wrote:
 Hello, this is my first post so please accept my apologies if I break
 any conventions.  Searches of this site and google at large have not
 yeilded any results for me, so here goes.

 I have created a cakePHP site which is to be a sub-system within a
 larger PHP based intranet.  It is hosted on a clients site, to which I
 have full access.  Now, my fellow developer and I use svn source
 control and so I have been going through the process of making the
 cake install svn friendly -- splitting of the cake core (cake_1.2.5)
 to /var/www, having svn ignore the app/tmp directory etc.

 This is how I have split cake: (from app/index.php) --

         if (!defined('ROOT')) {
                 define('ROOT',
 DS.'var'.DS.'www'.DS.'programmer1'.DS.'main_system'.DS.'cake_systems');
         }
         if (!defined('APP_DIR')) {
                define('APP_DIR', 'statement_archive');
         }
         if (!defined('CAKE_CORE_INCLUDE_PATH')) {
                 define('CAKE_CORE_INCLUDE_PATH', DS . 'var' . DS .
 'www' . DS . 'cake_1.2.5');
         }

 Note that this file is one of those excluded from svn, my coworker
 will have the same file but his ROOT will use his initials rather than
 'programmer1' so that we each have our own development area.

 So from the above you can see (or hopefully you cannot see, and that
 is my problem!) that the cake 'app' directory has been renamed to
 'statement_archive' and is a sub directory of 'cake_systems'.  The
 idea is that other modules of the php based system may also be done in
 cake, and that these would also be sub directories of 'cake_systems'
 and all would share /var/www/cake_1.2.5.

 Here is where the problem starts.  By setting the route for '/' I can
 get a correctly displayed (layout and all) screen via the 
 urlhttp://xxx.yyy.aaa.bbb/programmer1/main_system/cake_systems/statement
 This screen provides other links such as 
 --http://xxx.yyy.aaa.bbb/programmer1/main_system/cake_systems/statement
 Clicking on that link gives a 404 not found -- The requested URL /
 programmer1/main_system/cake_systems/statement_archive/statements/
 generate/280060 was not found on this server.

 Of course, while under development, when the standard 'development
 style' cake setup (app directory was called 'app' etc) this all
 worked.  It is almost like cakePHP is getting its hands on the url to
 do its routing, something is beating it to the punch perhaps?  To try
 and get around this I set some routes manually in statement_archive/
 config/routes.php -

         Router::connect('/statements/generate/*', array('controller'
 = 'statements', 'action' = 'generate'));
         Router::connect('/statements/view/*', array('controller' =
 'statements', 'action' = 'view'));
         Router::connect('/statements/edit/*', array('controller' =
 'statements', 'action' = 'edit'));
         Router::connect('/statements/delete/*', array('controller' =
 'statements', 'action' = 'delete'));
         Router::connect('/statements/add/*', array('controller' =
 'statements', 'action' = 'add'));
         Router::connect('/logos', array('controller' = 'logos',
 'action' = 'index'));
         Router::connect('/logos/add/*', array('controller' = 'logos',
 'action' = 'add'));
         Router::connect('/statement_controls', array('controller' =
 'statement_controls', 'action' = 'index'));
         Router::connect('/', array('controller' = 'statements',
 'action' = 'index'));

 Any advice as to how and I can links working again?

 Many Thanks,
 The Roman.
--~--~-~--~~~---~--~~
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 

Re: CakePHP and scalability

2009-09-22 Thread Martin Westin


http://www.mysqlperformanceblog.com/

I hope you have seen this blog? They have had a number of post lately
about indexes and always post about optimization in one way or the
other (funny enough).

If you have added indexes which did not improve much you may be
defining them wrong for the query you make. You may also need to
modify your queries so that they can make use of the indexes. When
adding an index it is good to run an explain on the query before and
after to see that the index is being used.

300'000rows for a join-table doesn't sound like too much for one
server unless you really need to scan most of that table for a lot of
queries... like showing a users friends friends friends... I have that
and more in both normal tables and joining tables, though your app
probably sees more requests than mine (not a public app).

I wanted to get to the point that I used to have huge problems with
performance. 9/10 of them needed php related optimizations like
Containable or doing 3 queries instead of a for loop or a Set::extract
(). Once I needed to cache the returned data from Mysql... when
generating reporting data and identical queries could be issued 200
times during the same request.



On Sep 21, 11:00 pm, byqsri marco.rizze...@gmail.com wrote:
 My table is about 30 records with only 5 fields
 It's a jointable of a HABTM relation.
 But I use this table in some INNER JOIN in some queries that are very
 slowly.
 I use memcache.
 In these cases what is the best practise to consider?
 On 21 Set, 20:20, Ma'moon phpir...@gmail.com wrote:



  i was successfully able to handle tables with more than 200 records
  yes, above 2 million records! with CakePHP and with a very acceptable
  performance and speed, the first thing that you should be thinking of is
  sharding the database into smaller chunks DBs, second thing is enabling
  memcached to reduce DB access specially reducing the master DB hits,
  thirdly enable APC or whatever bytecode cacher you might be able to use
  this will gain your web server a very good performance boost, and finally
  set the debug level for you cake app to 0 to cache the tables DESC
  operations.
  Taking all the above into consideration CakePHP can be a very powerful
  framework to handle huge databases!.

  On Mon, Sep 21, 2009 at 8:50 PM, Miles J mileswjohn...@gmail.com wrote:

   Well how big is your table? I have tables with over 200,000+ rows and
   it works just fine.

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



Auth redirects ssl back to plain http

2009-09-22 Thread Martin Westin

I was doing a test to see how my app runs under ssl and found that
Auth redirects me out of ssl. All other links and redirects appear to
work which is why I ask for help. It is surely some detail I have
missed since it can't be a bug in Auth or Router. Does anyone know
what I might be doing wrong?

Examples:
https://example.com/ - Location: http://example.com/login
https://example.com/login (post form)- http://example.com/ (logged
in)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Configure Cake under Nginx with ssl

2009-09-22 Thread Martin Westin

If you are running your CakePHP app under Nginx, this might interest
you.

Cake relies on the php environment variable HTTPS (as in $_SERVER
['HTTPS']) for SSL to be considered by RequestHandler and
SecurityComponent.

This is a problem for anyone running nginx. HTTPS is not mentioned as
a parameter in any php/fastcgi example I have found. Even worse, the
ssl module in nginx does not add any variable at all that can be used
to set this dynamically.

To let php know of the port used you would do fastcgi_param
SERVER_PORT $server_port using the provided variable $server_port to
set the desires environment variable. No $ssl variable exists and
setting true or false based on the port is a bad idea. (I don't know
why, that is just what I have read. Performance presumably.)

If, like me, you make use of includes a lot there is another stumbling
block. Simply adding in the paramater in the server block is not good
enough you have to add it on the same structural level as
fastcgi_pass and those things. So if you have a vhost file contaning
just the barest of info and then you include a cakephp.inc which
deals with all the php setups you need do some more work. I went with
the cheesy quickfix of copying the cake include and calling it
cakephp.ssl.inc... I won't change a lot in those two files so I guess
I can remember to make any alterations in both. I hope. (did that make
sense without a flowchart?)

In short, you need this line among your fcgi params, but only for
https requests! just adding it to the list of params will make php
think it is always running under ssl.

fastcgi_param HTTPS on;


/Martin




On Sep 22, 10:38 am, Martin Westin martin.westin...@gmail.com wrote:
 I was doing a test to see how my app runs under ssl and found that
 Auth redirects me out of ssl. All other links and redirects appear to
 work which is why I ask for help. It is surely some detail I have
 missed since it can't be a bug in Auth or Router. Does anyone know
 what I might be doing wrong?

 Examples:https://example.com/- 
 Location:http://example.com/loginhttps://example.com/login(post 
 form)-http://example.com/(logged
 in)
--~--~-~--~~~---~--~~
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: Encoding problem

2009-09-16 Thread Martin Westin

Thanks for finding that one. I had not caught that before and I use
non-english characters all the time. Guess Iäd better slow my
application down by replacing all strtolower with the mb_ version...
and possibly if clauses and things to make sure mb is installed.

But have a look at php.net... it is possibly quicker to ask mysql to
convert to lowercase than php (oh dear). It sounds incredible and I
haven't run a test of this myself.
http://se2.php.net/manual/en/function.mb-strtolower.php


Quick rant:
It makes my blood boil every time PHP makes my jaw to drop to the
floor like this. Come on! Shouldn't this kind of thing be handled by
PHP internally? mb this and mb that. Utf8 is 8bit, single byte, is it
not? I don't have a single setting in my installation of php that
suggests I prefer 8859. Take a hint why don't you, you silly language!

BTW, why is this in the comments on php.net:
mb_strtolower($str, mb_detect_encoding($str));
Why is that not built into the function? If PHP can detect the
encoding... don't give me the option to screw it up but entering the
wrong one! I can not come up with a single situation where I would
want to make a string lowercase but do it badly and treat some
characters the wrong way. Artistic reasons? I would have liked to see
strtolower() do just that. They could have added a
artistic_encoding_reinterpretation_strtolower() so that the 99.999% of
calls to the function did what that name suggested.

end rant.

thanks again for posting this... I have some work to do :)


On Sep 16, 8:04 am, Roman roman.janowc...@gmail.com wrote:
 finally I found the solution to my problem. It was not the  issue with
 DB either CakePHP. Problem was in PHP - low function. Never use it if
 you use encoding different than iso-8859-1. Instead of low use
 mb_strtolower(string, 'UTF-8).

 Thanks for help.

 On 15 Wrz, 14:16, brian bally.z...@gmail.com wrote:



  Also, use a terminal to verify that the data is as it should be. If
  all you have to work with is PHPMyAdmin, check that its pages are
  using UTF-8.

  It's easy, with MySQL, to import UTF-8 data that gets destroyed. If
  using an import file, put the following at the top:

  SET NAMES 'utf8';

  And, of course, make sure that database.php has 'encoding' = 'utf8'
  and that your layout has the proper character set meta tag.

  On Tue, Sep 15, 2009 at 2:06 AM, Sergei yatse...@gmail.com wrote:

   What DB do you use? It is not CakePHP, it 's DBMS problem.

   If MySql, set encoding to UTF8 and DB collation to utf8_unicode_ci,
   not utf8_general_ci.

   On Sep 15, 5:11 am,Romanroman.janowc...@gmail.com wrote:
   Hi,
   I have created filter using paginate with extra options taken from
   input fields. Service and database use UTF-8 (checked). When I try to
   filter word with polish characters (e.g. ósma) cakephp does not return
   proper value.
   Do you have any idea ?
   Regards,
  Roman
--~--~-~--~~~---~--~~
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: Question about Reverse Routing

2009-09-16 Thread Martin Westin

I think you can drop the wildcard and it will work.
Router::connect('/search', array('controller' = 'skateparks',
'action' = 'index'));

/Martin


On Sep 16, 4:38 am, Kyle Decot kdec...@gmail.com wrote:
 I am having a little bit of trouble w/ my reverse routing. In my
 routes.php file I have:

 Router::connect('/search/*', array('controller' = 'skateparks',
 'action' = 'index'));

 Then in my view I do something like:

 $html-link(Search for Something,array
 (controller=skateparks,action=index,q=search+terms));

 I want to get something like:

 http://localhost/search/q:search+terms/

 but instead I get:

 http://localhost/skateparks/index/q:search+terms/

 What is it that I am doing wrong?
--~--~-~--~~~---~--~~
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: Encoding problem

2009-09-16 Thread Martin Westin

I noted that you need to do some extra work on ucfirst() since it has
no direct mb_ equivalent. You have to roll your own or pick one from
php.net since mb_convert_case() can only work like ucwords().



On Sep 16, 11:42 am, Martin Westin martin.westin...@gmail.com wrote:
 Thanks for finding that one. I had not caught that before and I use
 non-english characters all the time. Guess Iäd better slow my
 application down by replacing all strtolower with the mb_ version...
 and possibly if clauses and things to make sure mb is installed.

 But have a look at php.net... it is possibly quicker to ask mysql to
 convert to lowercase than php (oh dear). It sounds incredible and I
 haven't run a test of this 
 myself.http://se2.php.net/manual/en/function.mb-strtolower.php

 Quick rant:
 It makes my blood boil every time PHP makes my jaw to drop to the
 floor like this. Come on! Shouldn't this kind of thing be handled by
 PHP internally? mb this and mb that. Utf8 is 8bit, single byte, is it
 not? I don't have a single setting in my installation of php that
 suggests I prefer 8859. Take a hint why don't you, you silly language!

 BTW, why is this in the comments on php.net:
 mb_strtolower($str, mb_detect_encoding($str));
 Why is that not built into the function? If PHP can detect the
 encoding... don't give me the option to screw it up but entering the
 wrong one! I can not come up with a single situation where I would
 want to make a string lowercase but do it badly and treat some
 characters the wrong way. Artistic reasons? I would have liked to see
 strtolower() do just that. They could have added a
 artistic_encoding_reinterpretation_strtolower() so that the 99.999% of
 calls to the function did what that name suggested.

 end rant.

 thanks again for posting this... I have some work to do :)

 On Sep 16, 8:04 am, Roman roman.janowc...@gmail.com wrote:



  finally I found the solution to my problem. It was not the  issue with
  DB either CakePHP. Problem was in PHP - low function. Never use it if
  you use encoding different than iso-8859-1. Instead of low use
  mb_strtolower(string, 'UTF-8).

  Thanks for help.

  On 15 Wrz, 14:16, brian bally.z...@gmail.com wrote:

   Also, use a terminal to verify that the data is as it should be. If
   all you have to work with is PHPMyAdmin, check that its pages are
   using UTF-8.

   It's easy, with MySQL, to import UTF-8 data that gets destroyed. If
   using an import file, put the following at the top:

   SET NAMES 'utf8';

   And, of course, make sure that database.php has 'encoding' = 'utf8'
   and that your layout has the proper character set meta tag.

   On Tue, Sep 15, 2009 at 2:06 AM, Sergei yatse...@gmail.com wrote:

What DB do you use? It is not CakePHP, it 's DBMS problem.

If MySql, set encoding to UTF8 and DB collation to utf8_unicode_ci,
not utf8_general_ci.

On Sep 15, 5:11 am,Romanroman.janowc...@gmail.com wrote:
Hi,
I have created filter using paginate with extra options taken from
input fields. Service and database use UTF-8 (checked). When I try to
filter word with polish characters (e.g. ósma) cakephp does not return
proper value.
Do you have any idea ?
Regards,
   Roman
--~--~-~--~~~---~--~~
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: I want to know now controller or plugin in routes.php

2009-09-16 Thread Martin Westin

If the names conflict the plugin has precedence.

I thinks these are right:

/abcs =
1. index on abcs controller in abcs plugin (aka the pluginname
controller)
2. index on abcs controller in app

/abcs/cba =
1. index on cba controller in abcs plugin
2. cba on abcs controller in abcs plugin (aka the pluginname
controller)
3. cba on abcs controller in app

and so on.



On Sep 16, 12:42 pm, enjoyman i.am.the.king.of.the.h...@gmail.com
wrote:
 I want to do something in routes.php but now I don't know what plugin
 or what controller for now.

 If my url is :http://localhost/[cakephp] /[APP] /abc I need to get
 abc as my now position, how can I do that?

 another problem is : I dont know if controller name same plugin name ,
 if I access my app by url:http://localhost/[cakephp] /[APP] /abcs

 and if my controller name is abcs and my plugin is same name,abcs,
 I want to know the order , what section that cakephp access before and
 after?

 Thank you for advance.
--~--~-~--~~~---~--~~
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: Pizza Online Order Notification?

2009-09-16 Thread Martin Westin

I think Tim is right here. Individual logins work in theory but in a
busy restaurant where supposedly a single computer will be logged in
all day and used by everyone... passwords would get swapped, written
on a post-it and other secure things in a heartbeat. Security =
putting the post-it under the keyboard so you have to move it 4in to
see the password. :)

As for updating the page. Go with ajax. The page loads displaying
new orders to fill. javascript is provided with a timestamp of when
the page loaded and can poll the server any new orders since ...
17:46:32. The server can simply reply true or false to this request
and only when there are new orders do you need to refresh the page.
Since this will be lightweight and invisible to the user you can poll
every few seconds if you want since the request should be very
efficient and not take up a lot of time for the server. (You can also
update the list with ajax if you like but it is s bit more work for
little benefit.)

/Martin


On Sep 16, 3:56 pm, Aivaras faifas1...@gmail.com wrote:
 Create each employee a different user and log which orders did the employee
 see.

 Then, after firing a employee you will only have to delete his/her user.
 Simple as that.

 Faifas



 On Wed, Sep 16, 2009 at 14:48, Tim t...@gurske.com wrote:

  Thanks for the replies. The IP restriction was since the employees
  know (or probably find out) the password. They don't want a situation
  where they fire somebody and they have to worry about that person
  logging in from home and messing with orders. The IP restriction would
  be an extra layer of security so they wouldn't have to change the
  password as often/quickly.
--~--~-~--~~~---~--~~
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: caching engines

2009-09-16 Thread Martin Westin


Since you ask, I'd say file. Sorry, that is my least favorite answer
to get.
All the others require special setups. All the others are better than
file under the right circumstances.

APC and XCache provide a big performance boost if you need it and like
installing php extensions yourself.
Memcached is generally the weapon of choose for clustered deployment
since it can share it's data between servers.

Your circumstances and which fits your setup the best can really only
be fully determined by proper testing. You can get a good idea of
their general pro's and con's by reading the docs for each and some of
the published benchmarks available. Some testing can be done using one
of the WAMP, XAMPP, MAMP flavors. I know MAMP is compiled with both
APC and XCache and I assume the others are aswell.





On Sep 16, 12:54 pm, irshad irsh...@rightwaysolution.com wrote:
 Hi All,

 Can anyone let me know which caching engine is best among the four
 caching engine(APC, XCache, memcache, file) in cakephp 1.2? And how to
 decide which caching engine should be used?

 Thanks in advance,
 Irshad
--~--~-~--~~~---~--~~
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: Bug?

2009-09-15 Thread Martin Westin


If you really did set username, email to unique and not username
unique and email unique (see the difference?) all is as it should be.
In the first instance (one index combining the two fields) would have
to have the same username and email combination for MySQLs index to
throw an error.

Is that it, you think?

/Martin



On Sep 15, 12:28 pm, vla...@gmail.com vla...@gmail.com wrote:
 Cake PHP 1.2.5, MySQL 5.*

 What I have:

 model user (all default) and:

  var $validate = array(
           'username' = 'alphaNumeric',
           'password' = 'notEmpty',
           'name' = 'notEmpty',
           'email' = 'email',
         );

 In MySQL I set for this table (users) fields: username, email - unique

 Also add Security component for security ;-)

 Now, I add ticket component for password remainding. And make a
 mistake:

 /users/remind.ctp:

 div class=users form
 ?php echo $form-create('User');?
         ?php
                 echo $form-input('email');
         ?
 ?php echo $form-end('Submit');?
 /div

 As you see form-create - I generate form /users/add

 So. I write in one field my email (already present in DB) and got
 message User was added

 I don't believe it. But in Mysql table I see record with email (which
 was present second time!) and other empty fields.

 How it possible???
--~--~-~--~~~---~--~~
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: Cache Problem with safari 4

2009-09-14 Thread Martin Westin


I am sure Safari does cache the page for you. My feeling is that you
can't fix this with a header. My feeling is that Safari has this
feature for some kinds of back-clicking no matter what you do.
Possibly it is to aid javascript-heavy sites.

If I click away now, in the middle of typing this post, I can click
back and still have my text in this ajax-loaded field on the page.
Neither the field nor the text were there when the page loaded. That
is not how FF or any other browser works afaik.

I guess the old rule still applies. Back-buttons are for websites...
not applications. :)
(try clicking back in gmail for example)

/Martin


On Sep 13, 7:33 am, p_tucky p_tu...@whatinthai.com wrote:
 Please test on FF3.5, IE7+ , and Safari4

 http://perhabs.com/cake_test

 user: test
 pass: test

 please look at display current time under login button.
 After login then click back button then see display time Firefox and
 IE will show you new time but Safari still display cache time.

 That's why I mention Safari still cache.

 Thanks

 On Sep 11, 2:03 pm, Martin Westin martin.westin...@gmail.com wrote:



  I am not sure that is a cache problem or anything you can fix. Are you
  sure

  I use Safari 4 all the time and I am under the impression that the
  browser sometimes doesn't do any request at all when using the back
  button. It simply re-displays what it a few moments ago. I have not
  checked if the browser technically does a request or not. It is just a
  feeling I get.

  /Martin

  On Sep 11, 6:13 am, p_tucky p_tu...@whatinthai.com wrote:

   Hi, I have cache problem with safari 4.
   Any one have problem like me?

   I’ve tried with this code but does not work. It take me to the
   previous page and have still show the text on form.

   function beforeFilter()
   {

      if($this-action == ‘login’) {
             $this-disableCache();
      }

       Header( “Last-Modified: ” . gmdate( “D, j M Y H:i:s” ) . ” GMT” );
       Header( “Expires: ” . gmdate( “D, j M Y H:i:s”, time() ) . ”
   GMT” );
       Header( “Cache-Control: no-store, no-cache, must-revalidate” );

   }

   FF and IE both don’t have any problem, when click “back button” and no
   cache.
   Safari 4 it seem still have cache when click “back button”.

   Any solution please advise.
   Thanks in advance.
--~--~-~--~~~---~--~~
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: session lost during ajax calls problem

2009-09-14 Thread Martin Westin

You might want to looks at some of these suggested solutions.

http://bakery.cakephp.org/articles/view/redirects-with-ajax

Pick the one that works the best for you.

/Martin


On Sep 11, 6:03 am, learning_cake_php lunaro...@gmail.com wrote:
 so theres no way on switching to normal redirect from ajax redirect?
 as what i have understood on your suggestion,correct me if im wrong,
 is to have a view containing a plain javascript redirect?
 how about this one:
 What I have done though is to have that logic in javascript. Cake
 simply returns success or error on the request and then my javascript
 knows whether to redirect or not. 
 how can this be done?can you please give me some snippets?
 thanx
--~--~-~--~~~---~--~~
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: isUnique Validation for Multiple Fields

2009-09-14 Thread Martin Westin

I could easily skip that validation and always let a new vote through.
Only when the same user votes again their original vote would be
updated. That is totally a matter of taste. I just happen to like
being abel to change my mind and update my vote. That doen't work
better for rating users, posts or other social stuff that is does
for competition entries.

For that kind of saves I wish there was a Cake version of INSERT ...
ON DUPLICATE KEY UPDATE For votes you would likely want to know
if the save was an update or not and inform the user, so it is no
great loss.

/Martin




On Sep 14, 2:51 pm, rich...@home richardath...@gmail.com wrote:
 I wrote one a while back and posted it to this group. can't seem to
 find it now, but here's a link to it stored elsewhere:

 http://markmail.org/message/nleqrkgtm2ji6sfe

 On Sep 14, 11:10 am, Shaun sbef...@gmail.com wrote:



  I have a table called comment_ratings where users can rate comments up
  or down.  It looks like this:

  TABLE:  comment_ratings
      id = INT
      rating_value = TINYINT
      comment_id = INT
      user_id = INT
      created = DATETIME
      modified = DATETIME

  Users should only be allowed one vote on each comment, so I have
  created a unique key on two fields, comment_id and user_id. The name
  of the key is unique_rating_per_user.  This works fine in my database,
  but how can I add the unique validation to the CommentRating model?
  As far as I know, isUnique only handles one field.
--~--~-~--~~~---~--~~
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: Cache Problem with safari 4

2009-09-11 Thread Martin Westin

I am not sure that is a cache problem or anything you can fix. Are you
sure

I use Safari 4 all the time and I am under the impression that the
browser sometimes doesn't do any request at all when using the back
button. It simply re-displays what it a few moments ago. I have not
checked if the browser technically does a request or not. It is just a
feeling I get.

/Martin


On Sep 11, 6:13 am, p_tucky p_tu...@whatinthai.com wrote:
 Hi, I have cache problem with safari 4.
 Any one have problem like me?

 I’ve tried with this code but does not work. It take me to the
 previous page and have still show the text on form.

 function beforeFilter()
 {

if($this-action == ‘login’) {
   $this-disableCache();
}

 Header( “Last-Modified: ” . gmdate( “D, j M Y H:i:s” ) . ” GMT” );
 Header( “Expires: ” . gmdate( “D, j M Y H:i:s”, time() ) . ”
 GMT” );
 Header( “Cache-Control: no-store, no-cache, must-revalidate” );

 }

 FF and IE both don’t have any problem, when click “back button” and no
 cache.
 Safari 4 it seem still have cache when click “back button”.

 Any solution please advise.
 Thanks in advance.
--~--~-~--~~~---~--~~
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: Release: CakePHP 1.2.5

2009-09-10 Thread Martin Westin


Thank you so much for this update. The php 5.3 fixes especially.
--~--~-~--~~~---~--~~
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: session lost during ajax calls problem

2009-09-10 Thread Martin Westin


For that one there is no one-click simple trick.

I guess you could return an ajax html snippet containing a javascript
that trigger a redirect... unless it gets captured in some security
check.

What I have done though is to have that logic in javascript. Cake
simply returns success or error on the request and then my javascript
knows whether to redirect or not.

/Martin


On Sep 10, 1:06 pm, learning_cake_php lunaro...@gmail.com wrote:
 ah ic..well thanx so much for that information..well i guess i have to
 lower my
 security level for this matter...one more thing, how can i redirect an
 entire page
 when im submitting a form using ajax? say for instance
 if($this-Model-save(){
 $this-redirect('theWholePageToSomeWhereElse');}else{

 $this-redirect('toPreviousViewUsingAjax');

 }

 how can i do that?
--~--~-~--~~~---~--~~
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: PHP IDEs

2009-09-10 Thread Martin Westin

On Sep 10, 1:05 pm, jason m ippatsu.ya...@gmail.com wrote:
 The only downside of textmate is that it doesn't really
 support any
 other encodings besides UTF8.

 Jason

Say what? How do you mean Textmate doesn't support any other encoding?
It works quite happily in 8859-1 (aka latin1) and Mac roman, and I am
Swedish and frequently have documents containing problematic
characters like åäö. It does lac the myriad of encodings some editors
support (like all the different iso variations) so I guess to some
language-specific documents there might be a problem.

Textmate is a bit obscure on how to convert encodings. It involves re-
opening documents with a new encoding and then save as and setting
the new one which is not as flexible as SubEthaEdit for example.
--~--~-~--~~~---~--~~
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 Security component and form submit

2009-09-10 Thread Martin Westin

I don't think is affects your problem but in the code you posted the
html would be invalid. The form and /form should be at the same
hierarchical leven in the html but you have the end inside a div.

A 404 is what you would get is SecurityComponent decided to kick you
in the behind. It is called blackHole() and is the end of the road for
any bad request. You can specify blackHoleCallback on the component
(in the beforeFilter of your controller) and name one method in your
controller as the callback. This method will then receive the error
and giving you the opportunity to debug what is going on.

$this-Security-blackHoleCallback = 'some_method_name';

Or you can open the Security Component directly and insert a debug in
blackHole... if you prefer that.




On Sep 10, 12:39 pm, byqsri marco.rizze...@gmail.com wrote:
 The url is the same.
 With FireFox plugin Tamper Data I get status header  Not Found - 404

 On 10 Set, 12:14, Bert Van den Brande cyr...@gmail.com wrote:



  What's the url of the page with the form, and what's the url of the white 
  page ?

  Maybe inspect traffic with the FireFox plugin Tamper Data to detect
  what's going on ...

  On Thu, Sep 10, 2009 at 11:46 AM, byqsri marco.rizze...@gmail.com wrote:

   I try to set the debug mode to 1 and to 2 but there is no errors

   On 10 Set, 11:37, Bert Van den Brande cyr...@gmail.com wrote:
   A clean white page suggests an error that can't be shown because you
   have set the debug level to 0.

   Try setting it to 1 or 2 and see if the 'white page' now outputs an
   error message.

   On Thu, Sep 10, 2009 at 11:32 AM, byqsri marco.rizze...@gmail.com 
   wrote:

On 10 Set, 11:16, WebbedIT p...@webbedit.co.uk wrote:
How do you know if this is a security component issue as the form is
not being submitted to a Controller/Action to be processed?!?

Because if I don't use the Security component the form is correctly
submit.

What should happen if the form submits to the url /test/?
It doesn't anything.Simply it reloads the page.
--~--~-~--~~~---~--~~
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: Flow Control with Ajax

2009-09-09 Thread Martin Westin


On successful login, Auth Component does a redirect to either:
1. where you were before you were redirected to the login screen (not
in your case I guess)
2. whatever default you have set
3. the website index page.
(I think that is the correct order)

I guess your problem is that your ajax call does not follow the
redirect and loads the resulting page. I don't use ajax enough to be
sure of that or what can be done about it.

What you can do is to turn off the auto redirect for Auth and yourself
check if the login was a success and if that success was due to an
ajax call. Use the RequestHandler to check for ajax.

/Martin


On Sep 9, 5:45 am, young.steveo young.ste...@gmail.com wrote:
 I've posted this elsewhere on the internets, and finally I'm bringing
 it to you guys.

 Just started using cake and it's fantastic!  Love it.

 Here's my little problem:

 I have a form that I am suppressing with jQuery and doing an AJAX call
 to a controller 'UsersController' with a 'login' action that is
 working automagically using the built in Auth component.

 I'm following ProLoser's example from the bakery:

 http://bakery.cakephp.org/articles/view/serving-up-actions-as-ajax-wi...

 The only exception is that I'm using the livequery jQuery plugin to
 support the submit event.

 My homepage has a copy of the form inside a div, and the the 'users/
 login.ctp' view has a copy of the form as well. When the user submits
 the form, jQuery removes the form from the div.  The form is submitted
 via ajax to the UsersController, and if the user has failed to
 authenticate, he is served the 'users/login.ctp' view inside the same
 div using ajax. This all works.

 If the user DOES authenticate, he is also served the login.ctp inside
 the div. Instead, I want to change the view to something that says
 welcome, etc. etc. etc. with no login form.

 I've bashed my brains into the cookbook, the API, and google to no
 avail. I feel like this is something super easy to do, but I'm barking
 up the wrong trees.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: cake cant find model's method!!!

2009-09-09 Thread Martin Westin

I am not sure about this but I have a vague memory about reading that
for habtm Cake does not look for any real model unless you specify
with in the association. The automagic being that you don't have to
make a real linking model for those simple habtm associations and Cake
does not have to spend time looking for it.


/Martin


On Sep 8, 11:18 am, learning_cake_php lunaro...@gmail.com wrote:
 WELL WELL..hehe.. nice trick you had ther..i read the manual aboyt
 HABTM's with and kablamm!! it works..
 so why is cake behaving things like that?they always used the word
 automagically but then dont know how to
 automagically interpret the names i used even i followed the
 convention..or maybe i did something wrong somewhere..
 for now,ill stick with the with key..hard to find the bug there(for
 me)...
 thank you guys...deadline is fast approaching..still nid to add auth
 to my project...acos and aros are still
 complicated for me this time..hehe

 On Sep 8, 12:02 am, Martin Westin martin.westin...@gmail.com wrote:



  I agree with the good doctor.
  One detail you may not realise is that it matters little if if you
  name the model correctly unless you also specify with on the
  associations... and that you do it from both sides.

  Unless you specify with and specify the Modelname Cake might be
  loading AppModel (I believe this happened to me a few months ago even
  though it shouldn't).

  More definite is that you must specify with from both sides of the
  habtm. If you do it only from one side you can be sure the other one
  is loaded first and Cake chooses AppModel. From that point on there is
  nothing you can do to bring up the real model since the AppModel will
  be in the registry.

  I noticed this when normal requests worked and shell access was messed
  up... because the models were loaded in a different order.

  /Martin

  On Sep 8, 8:33 am, Dr. Loboto drlob...@gmail.com wrote:

   Output get_class($this-EnrolleesOfferedSubject) in your controller.
   If it is AppModel cake cannot find your model file.

   On Sep 8, 10:32 am, learning_cake_php lunaro...@gmail.com wrote:

i already check my model names and codes...
i have a controller named EnrollmentController and from there
i used the $uses property for me to user the EnrolleesOfferedSubject
model..
why is it that save,create and delete method works just fine..saves
and delete to/from
correct table(enrollees_offered_subjects) but my custom method wont
work..here is the actual code:

//enrollment_controller.php
?
        class EnrollmentController extends AppController {
                var $name = 'Enrollment';
                var $uses = array(
                                                'Enrollment',
                                                'Student',
                                                'EnrollmentPayment',
                                                'Enrollee',
                                                'OfferedSubject',
                                                
'EnrolleesOfferedSubject',
                                                'Major',
                                                'Campus',
                                                'College',
                                                'Course',
                                                'Subject',
                                                'Program',
                                                'Scholarship',
                                                'Users'
                                        );

                function subjectView(){
                        $this-setCRUD('subject');

                        
$student=$this-Student-isStudent($this-Session-read
('Student.id'));
                        if(!$student){
                                $this-Session-setFlash(__('Student 
Not Found.', true));
                                
$this-redirect(array('action'='index'));
                        }

                        $this-Session-write('Student.id', 
$student['Student']['id']);
                        $this-Session-write('Student.full_name', 
$student['Student']
['last_name']
                                                                        
                ., .$student['Student']['first_name']
                                                                        
                . .$student['Student']['middle_name']
                                                                        
                . .$student['Student']['sur_name']
                                                                        
                );

                        
$enrollmentPayment=$this-EnrollmentPayment-isPaid($this-Session-

read('Student.id

Re: Two paginations on one page, can't figure it out

2009-09-09 Thread Martin Westin


Yes I saw defaultModel too after I posted.

Both my paginated models were in paginator's params array but using
them both seems, as you say, to only affect parst of the helper. For
example, numbers pulls the correct values provided by the component
and uses them for counting pages but does not use them for
constructing model-specific links themselves.

I can see why. How often is it a good idea to paginate two models on
the same page? My case was a bit of a gui-playground. It was a log
view of text and picture messages sent to a certain phone and I
thought it would be cool to split the page and have both types of
messages paginated right there. Not your typical page.

The funny thing was that numbers printed two sets of numbers correctly
for the two models but all the links were the same for both. That got
me all exited and sure I had just missed some array trickery. :)


/Martin


On Sep 8, 6:37 pm, Miles J mileswjohn...@gmail.com wrote:
 The paginator class seems a bit incomplete. From your example with
 options() it looks like the paginator should work with multiple
 models, but then it also calls $model = $this-defaultModel(); which
 always defaults to a single model and your additional models aren't
 added to the params (lines 103-112).

 However, on your numbers() method it also seems correct, but then
 again, the model doesnt exist in the params array?
--~--~-~--~~~---~--~~
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 Call Library Function from a Component

2009-09-09 Thread Martin Westin


I believe you can call it statically like this: Security::hash(...);

/Martin


On Sep 9, 8:45 am, Sarah sarah.e.p.jo...@gmail.com wrote:
 I want to call the hash function from the Core Security Library.

 In this controller I can simply call $this-hash(...);

 but in the component I get an error: Fatal error: Call to undefined
 method obAuthComponent::hash()

 I tried $this-ControllerName-hash and $this-ModelName-hash

 and I can't find anything in the manual about it.

 I would appreciate it if someone could point out how to call a
 function from the core libraries in a component (or post a link of a
 resource, I just can't find one!).

 Many thanks,
 ~Sarah
--~--~-~--~~~---~--~~
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: session lost during ajax calls problem

2009-09-09 Thread Martin Westin

At security level high CakePHP creates a new session id for each
request (often enough anyway). This behaviour might be causing you
problems using Ajax. The intermittent aspect of the problem is because
ajax will be fine as long as you don't make use of the A too much.

Cake will only allow one concurrent request from the same session. if
you send a second request to the server without the first having
returned (and updated the session id in the browser) you will be
sending an old used session id and Cake will think you are a hacker
and shut you down.

So in practice whenever you use ajax you set the level to medium and
live with it. maybe someone has built some kind of queu-system for
Prototype or jQuery, I don't know.


Initial page load
Cake id=1 = Browser id=1

link clicked
Browser id=1 = Cake gets 1 and changes to 2 = Browser gets=2

ajax update and link clicked at the same time
Browser id=2 = Cake gets 2 and changes to 3 = Browser gets=3
Browser id=2 = Cake gets 2 again, gets upset and flips you off :)


Apart from the session timeout time, this is afaik the only difference
between high and medium security level.

The other thing to beware of in relation to this is the Security
component and the way it protects forms. You will almost certainly get
locked out is you submit forms using ajax to update something... since
each form will contain a hash and can only be sent once.

/Martin


On Sep 9, 4:35 am, learning_cake_php lunaro...@gmail.com wrote:
 i dont think im the only one asked this question but i just wanted to
 be sure
 that solutions i found in the net is correct and secure..
 my problem is when i do an ajax call sometimes my session is lost
 sometimes its not..say for instance, i have a textbox where every time
 the value is change the ajax call is triggered. sometimes the session
 i just set
 is lost then when i typed again on the textbox, the session is not
 lost..

 some solution says that i have to:
 Set Configure::write(’Security.level’, ‘medium’);

 well i havnt tried it though, but they said it will not destroy the
 session when
 the browser is being closed, which is not good..

 is there any way around this?
 im using cake 1.2..
--~--~-~--~~~---~--~~
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: Setting Up CakePHP on MAC with MAMP and Eclipse

2009-09-08 Thread Martin Westin

I have been developing in folders like project_name for years and I
like it. I only need to keep and manage one Cake installation and it
keeps my clutter of files to a minimum :)

The way I host that locally is with one virtual host for each project.
I point the Apache root folder for each one to the equivalent of app/
webroot. That way I host locally in exactly the same way as a
production installation.  also set fake domain names in my computer's /
etc/hosts file. I prefer project_name.site as no real site would be
called that.

I think you can get away with dumping it all into the same vhost the
way you did now. If you create a few apps in named folders they should
(hopefully) run if you access them using http://localhost/project_name/.
Not sure though.



On Sep 7, 5:38 pm, Kludge jvanul...@gmail.com wrote:
 Thanks, that's really helpful. I now have CakePHP using MAMP MySQL and
 PHP5. Another question... what is the usual workflow. Do I create a
 copy of the Cake/app folder for my project (project_name)? Do I bake
 in another directory or directly into my Cake/project_name folder? I
 notice in the tutorial that it recommends to work directly in the app
 folder but I will definitely have more than one project... any
 guidance would be appreciated.

 Thank you in advance!

 On Sep 6, 11:32 pm, Martin Westin martin.westin...@gmail.com wrote:



  A few points for installing Cake to run in Mamp.

  Simplest way is to drop the whole Cake folder (containing
  cake,app,vendors...) into Mamp's htdocs folder.
  Should be: /Applications/MAMP/htdocs

  That should have Cake running but you probably need / want the
  database too, right. You need to rename and edit the file app/config/
  database.php. That file has to know how to reach Mamp's MySQL. You can
  see instructions in the Mamp control panel on the port/sockets,
  username, password and things.

  Those are really the two common head-scratchers I know of. I can't
  help you with Eclipse but if you have some specific question about the
  Mamp-Cake thing let me know.

  /Martin

  On Sep 7, 4:59 am, FrederickD manzanillo.engl...@gmail.com wrote:

   Hey Kludge!

   Try going towww.widgetpress.comandcheckingout ModelBaker. It is a
   Mac front-end to CakePHP so that you never have to use the CLI. The
   product has a graphical representation of the database model you are
   creating for the project.

   ModelBaker is not an end-all solution. It is designed to quickly get
   you up and running with CakePHP code that you then tweak for the
   unique business logic for your project.

   It has some limitations as it was just released at MacWorld in
   January. Overall it promises to be a very strong product for Mac
   development with CakePHP. There is a demo version available for you to
   try out.

   I am not affiliated with WidgetPress at all. I do use ModelBaker
   because I'm a Mac guy and don't care much for the Terminal and command
   line interfaces anymore. Been there, did that, haven't done it for 25
   years now.

   Check it out!

   On Sep 6, 4:14 pm, Kludge jvanul...@gmail.com wrote:

Anyone have any idea on how to do this? I have MAMP and Eclipse
installed correctly and have been doing PHP development for a while
now and everything works fine. I now want to jump into CakePHP but
can't wrap my head around setting it up. Any insight and or steps on
getting there would be great. Thank you in advance!
--~--~-~--~~~---~--~~
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: help::sending data from one controller to another controller

2009-09-08 Thread Martin Westin

You have had your first bump into the wall of strictly linking views,
controller and model. I generally tend to link the views and
controller more and keep my models more loose. That is, I don't have a
problem with using ModelB in ControllerA.

I read that you want one click to save both Contact and related phone
numbers.
If so, I have a two things to offer (off the top of my head):

You can possibly just switch to $this-Contact-saveAll($this-data)
if your data is returned correctly from the form. Hint: one single
form. You can check the cookbook for the details on how to use
saveAll.

You can reach the PhoneNumber model like $this-Contact-PhoneNumber
and save data that way if you need to.






On Sep 7, 8:28 pm, BrAt mrasik...@yahoo.com wrote:
 Hi , i am new to cakePHP , in order to learn php i am just making my
 first test application which is
 a simple telephone directory.
 in my database there are two entities named contacts and phone_numbers
 which has One-to-Many relationship.

 Now i have a form in contacts view add.ctp , i want that single form
 to add Contact as well as the numbers. so by clicking add button
 Contact, data should be stored in contacts table and phone number
 should be stored in phone_numbers. i have added another form for phone
 number and i m dynamically adding fields for input of phone number
 using javascript.
 But when the user clicks add button the data we put in phoneNumber
 form also goes to ContactsController,

 Now is there any way to send my PhoneNumber data to
 PhoneNumbersController to add action ,so that i can save that data in
 phone_numbers table. or any other way to do this job.

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



Re: cake cant find model's method!!!

2009-09-08 Thread Martin Westin
I agree with the good doctor.
One detail you may not realise is that it matters little if if you
name the model correctly unless you also specify with on the
associations... and that you do it from both sides.

Unless you specify with and specify the Modelname Cake might be
loading AppModel (I believe this happened to me a few months ago even
though it shouldn't).

More definite is that you must specify with from both sides of the
habtm. If you do it only from one side you can be sure the other one
is loaded first and Cake chooses AppModel. From that point on there is
nothing you can do to bring up the real model since the AppModel will
be in the registry.

I noticed this when normal requests worked and shell access was messed
up... because the models were loaded in a different order.

/Martin


On Sep 8, 8:33 am, Dr. Loboto drlob...@gmail.com wrote:
 Output get_class($this-EnrolleesOfferedSubject) in your controller.
 If it is AppModel cake cannot find your model file.

 On Sep 8, 10:32 am, learning_cake_php lunaro...@gmail.com wrote:



  i already check my model names and codes...
  i have a controller named EnrollmentController and from there
  i used the $uses property for me to user the EnrolleesOfferedSubject
  model..
  why is it that save,create and delete method works just fine..saves
  and delete to/from
  correct table(enrollees_offered_subjects) but my custom method wont
  work..here is the actual code:

  //enrollment_controller.php
  ?
          class EnrollmentController extends AppController {
                  var $name = 'Enrollment';
                  var $uses = array(
                                                  'Enrollment',
                                                  'Student',
                                                  'EnrollmentPayment',
                                                  'Enrollee',
                                                  'OfferedSubject',
                                                  'EnrolleesOfferedSubject',
                                                  'Major',
                                                  'Campus',
                                                  'College',
                                                  'Course',
                                                  'Subject',
                                                  'Program',
                                                  'Scholarship',
                                                  'Users'
                                          );

                  function subjectView(){
                          $this-setCRUD('subject');

                          
  $student=$this-Student-isStudent($this-Session-read
  ('Student.id'));
                          if(!$student){
                                  $this-Session-setFlash(__('Student Not 
  Found.', true));
                                  $this-redirect(array('action'='index'));
                          }

                          $this-Session-write('Student.id', 
  $student['Student']['id']);
                          $this-Session-write('Student.full_name', 
  $student['Student']
  ['last_name']
                                                                              
              ., .$student['Student']['first_name']
                                                                              
              . .$student['Student']['middle_name']
                                                                              
              . .$student['Student']['sur_name']
                                                                              
              );

                          
  $enrollmentPayment=$this-EnrollmentPayment-isPaid($this-Session-

  read('Student.id'));

                          if(!$enrollmentPayment){
                                  $this-Session-setFlash(__('Not Yet 
  Paid.', true));
                                  
  $this-redirect(array('action'='paymentAdd'));
                          }

                          
  $enrollee=$this-Enrollee-isEnrolled($this-Session-read
  ('Student.id'));

                          if(!$enrollee){
                                  $this-Session-setFlash(__('Student Not 
  Yet Enrolled.', true));
                                  
  $this-redirect(array('action'='enrolleeAdd'));
                          }

                          $this-EnrolleesOfferedSubject-recursive = 0;
                          //$this-EnrolleesOfferedSubject-unbindModel(array
  ('belongsTo'=array('Enrollee','OfferedSubject')));
                          
  $this-EnrolleesOfferedSubject-bindModel(array('belongsTo'=array(
                                          'Enrollee'=array(
                                                  'foreignKey'='enrollee_id',
                                                  'type'='INNER'
                                          ),
                      'OfferedSubject'=array(
              

Two paginations on one page, can't figure it out

2009-09-08 Thread Martin Westin

Hi, I just can't seem to figure this out.

I want to paginate two models on the same page. I can't figure out how
to make the Helper output links correctly.

Example:
$paginator-numbers(array('model'='ModelA'));
$paginator-numbers(array('model'='ModelB'));

I thought that would be it. Those two will output the numbers for each
model (3 pages for A and 5 for B) but the links will both just be
page:2 and so on. No model-specific links. Same for next and prev.

$paginator-options(array(
'ModelA'=$this-passedArgs,
'ModelB'=array('url' = $this-passedArgs)
));

I tried a few variations of this kind of options because I saw in the
source that options looked for model names but that has not yielded
anything good either.

As you can tell I a lost here and I feel like I am missing something
obvious since multiple paginations are supposed to be supported afaik.

any suggestions?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



  1   2   3   4   5   >