AND/OR fails

2008-08-28 Thread zpon

Hi

I am doing a nested AND in a OR, like this:

array('conditions' =>
array(
'OR' => array(
'AND' => array(
'ForloebElements.coach_id' => 
$this->Session->read('user_id'),
'ForloebElements.coach_betalt' => 0
),
'AND' => array(
'ForloebElements.coach2_id' => 
$this->Session->read('user_id'),
'ForloebElements.coach2_betalt' => 0
)
)
)
)

I was hoping for something like

"WHERE ((`ForloebElements`.`coach_id` = $this->Session-
>read('user_id') AND `ForloebElements`.`coach_betalt` = 0) OR
((`ForloebElements`.`coach2_id` = $this->Session->read('user_id') AND
`ForloebElements`.`coach2_betalt` = 0))"

but instead I get only the last part

"WHERE ((`ForloebElements`.`coach2_id` = 5) AND
(`ForloebElements`.`coach2_betalt` = 0))"

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



Re: Association recursive hasMany

2008-08-28 Thread vj vj
No still it won't work.

I have 3 Models having following association:

Model1 hasMany Model2
Model2 belongsTo Model1
Model2 hasMany Model3
Model3 belongsTo Model2

I had primary key value of Model1 and want to retrieve All Information
from Model3.

But
$this->Model1->contain( 'Model2',
   'Model2.Model3'
)

won't give me Data from Model3,Instead it shows blank array.


On Wed, Aug 27, 2008 at 7:34 PM, Guillaume <[EMAIL PROTECTED]>wrote:

>
> $this->Model1->contain(array('Model2"=>"Model3"); should work.
>
> $this->Model1->contain( 'Model2.Model3'); too
>
>
> http://bakery.cakephp.org/articles/view/bindable-behavior-control-your-model-bindings
>
> Guillaume
> --
> http://cherryonthe.popnews.com
>
>
> On 27 août, 14:49, vj <[EMAIL PROTECTED]> wrote:
> > I have 3 Models having following association:
> >
> > Model1 hasMany Model2
> > Model2 belongsTo Model1
> > Model2 hasMany Model3
> > Model3 belongsTo Model2
> >
> > I had primary key value of Model1 and want to retrieve All Information
> > from Model3.
> >
> > But
> > $this->Model1->contain( 'Model2',
> > 'Model2.Model3'
> >  )
> >
> > won't give me Data from Model3,Instead it shows blank array.
> >
> > Can any one resolve this.
> >
>

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



Re: HABTM database tables not found after update to 1.2.0.7531

2008-08-28 Thread David Zentgraf

Hmm, this seems to be a problem of Cake not honoring the custom
$useDbConfig on the models and expecting the join table to be in the
default db configuration. Just creating an empty model like this
solved the problem:

class PlacesStation extends AppModel {
var $useDbConfig = 'alternative';
}

Is that how it's supposed to be now?

On Aug 29, 1:08 pm, David Christopher Zentgraf <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I just updated to the latest svn version 1.2.0.7531, and suddenly Cake  
> won't find my DB tables anymore.
>
> class Place extends AppModel {
>         ...
>         var $hasAndBelongsToMany = array(
>                 'Station' => array(
>                         'className'     => 'CgStation',
>                         'joinTable'     => 'places_stations',
>                         'foreignKey'    => 'place_id',
>                         'associationForeignKey' => 'station_id',
>                         'unique'        => true
>                 ),
>         );
>
> }
>
> class CgStation extends AppModel {
>         ...
>         var $useTable = 'stations';
>         var $hasAndBelongsToMany = array(
>                 'Place' => array(
>                         'className'     => 'Place',
>                         'joinTable'     => 'places_stations',
>                         'foreignKey'    => 'station_id',
>                         'associationForeignKey' => 'place_id',
>                         'unique'        => true
>                 )
>         );
>
> }
>
> This worked perfectly fine in RC2, now Cake is giving me:
> "Database table places_stations for model PlacesStation was not found."
>
> The table is there though, and I do not have a model "PlacesStations".  
> Should I?
> Both models have $useDbConfig for a non-default DB configuration  
> (mysql) BTW.
>
> The SQL debug states:
>
> Nr      Query                                           Affected        Num. 
> rows       Took (ms)
> 1       DESCRIBE `places`                       31              31            
>           11
> ...
> 5       DESCRIBE `stations`                     10              10            
>           82
> 6       DESCRIBE `places_stations`      5               5                     
>   14
>
> No errors there...
>
> Anybody know what's going on?
>
> Chrs,
> Dav
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



HABTM database tables not found after update to 1.2.0.7531

2008-08-28 Thread David Christopher Zentgraf

Hi,

I just updated to the latest svn version 1.2.0.7531, and suddenly Cake  
won't find my DB tables anymore.

class Place extends AppModel {
...
var $hasAndBelongsToMany = array(
'Station' => array(
'className' => 'CgStation',
'joinTable' => 'places_stations',
'foreignKey'=> 'place_id',
'associationForeignKey' => 'station_id',
'unique'=> true
),
);
}

class CgStation extends AppModel {
...
var $useTable = 'stations';
var $hasAndBelongsToMany = array(
'Place' => array(
'className' => 'Place',
'joinTable' => 'places_stations',
'foreignKey'=> 'station_id',
'associationForeignKey' => 'place_id',
'unique'=> true
)
);
}

This worked perfectly fine in RC2, now Cake is giving me:
"Database table places_stations for model PlacesStation was not found."

The table is there though, and I do not have a model "PlacesStations".  
Should I?
Both models have $useDbConfig for a non-default DB configuration  
(mysql) BTW.

The SQL debug states:

Nr  Query   AffectedNum. 
rows   Took (ms)
1   DESCRIBE `places`   31  31  
11
...
5   DESCRIBE `stations` 10  10  
82
6   DESCRIBE `places_stations`  5   5   
14

No errors there...

Anybody know what's going on?

Chrs,
Dav

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



Re: Named parameters with subdomaining

2008-08-28 Thread M4ngoB00M

OK - so I have discovered that Windows+Apache has this problem. It is
described here:
https://trac.cakephp.org/ticket/2583
However not described adequately.  The posted "workaround" is
incomplete and unclear as there is no obvious argSeparator attribute.

After some digging I discovered how to change the argument separator
without changing the core inside cake.

In your routes.php file add a call to connectNamed().  If you are
already using this function, you will likely already have values set.
Simply add the argSeparator array name/value pair and use whatever
separator you like.  In my call shown below I modify all routes to use
the separator of the caret (^).

Router::connectNamed(true, array('argSeparator' => '^'));

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



Shortcut to shared folder

2008-08-28 Thread azlanms

Dear all,

I'm trying to provide a link from my website to a folder residing in
other server. I'd normally specify the link as

System Design

if the file (SYSTEM DESIGN.ppt) is placed directly under C:\wamp\www
\mywebportal\app\webroot\files\file\technical\ (I'm using Wampserver
by the way).

But what if the file is located in another shared folder in another
server? I've tried creating a shortcut under C:\wamp\www\mywebportal
\app\webroot\files\file\ that points to that shared folder e.g. \
\Fileserver\technical but it doesn't work. Any suggestion?

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



Re: Complex ACL & Auth

2008-08-28 Thread Rafael Bandeira aka rafaelbandeira3

Paste your code and your approach, a test approach at least. I don't
think someone will actually *do* it for you. But many people can point
out what you're missing
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Complex ACL & Auth

2008-08-28 Thread Colombian

I was hoping to get good pointers as to the best way to tackle our
problem:

We have 4 roles. (4 'aros')
However, the permissions depend on the project status.
While the status is 'draft' some aros can edit/delete etc.
But when the project status is submitted or finalize, the permissions
would change to only allow view. Our

How would you approach this within the ACL and Auth in CakePHP 1.2
RC2?

Thank you.


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



Named parameters with subdomaining

2008-08-28 Thread M4ngoB00M

I am using the method described here for subdomaining with cake and it
works:
http://bakery.cakephp.org/articles/view/subdomaining-with-cake#comment-2774

However, when I introduce named parameters - I immediately get a 403
Permission Denied from Apache.  This is odd because if I directly
access the controller/view/ in the URL even with the named parameters
it works fine.

Thus, I have set things up according to this article such that:
http://username.localhost/cakejunction/
essentially goes to:
http://localhost/cakejunction/partners/load/username

Works great.  However, If I add named parameters to the URL like this:
http://username.localhost/cakejunction/p1:page1/p2:value2
I immediately get a 403 - Permission Denied from Apache.

What is interesting, is if I use the direct equivalent URL that this
would have translated into:
http://localhost/cakejunction/partners/load/username/p1:page1/p2:value2
It works fine.

So - I conclude that it is likely some combination of the subdomaining
mechanism, the named parameters with colons and the Apache
configuration.

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



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Andreas

On 28 Aug., 22:14, trustfundbaby <[EMAIL PROTECTED]> wrote:
> At the risk of repeating myself, I am looking for something that works
> the same way as virtual attributes in rails.
> the right direction?
As far as i know there is no such thing in CakePHP. The closest thing
I could imagine is to use a afterFind-callback to inject the
"attribute" to the returned array...

Regards
Andreas

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



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Gonzalo Servat
On Thu, Aug 28, 2008 at 6:55 PM, mattcamuto <[EMAIL PROTECTED]> wrote:

>
> i fully apologize. i started writing the email to somebody else,
> this email came through and i accidently cut-n-paste to the wrong window.
>
> i am totally sorry, did not mean to hijack anything
>

I really don't think you offended anyone unless you got someone in a
"delicate mood". I thought the sudden change of subject was pretty funny!!

- Gonzalo

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



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread mattcamuto

i fully apologize. i started writing the email to somebody else, 
this email came through and i accidently cut-n-paste to the wrong window.

i am totally sorry, did not mean to hijack anything

matt

Gonzalo Servat wrote:
> On Thu, Aug 28, 2008 at 6:39 PM, mattcamuto <[EMAIL PROTECTED] 
> > wrote:
>
>
> hi sam
>
> i think i made things even more confusing in my post.
>
> I am just ttrying to accomplish plain ajax in multiple pages.
>
> Suppose I have 3 pages
>
> a.html
> b.html
> c.html
>
> And they all in some form have an 'Article' model in them.
>
> I want to rate the article (i.e. /Article/rate//)
> for instance on any of these pages and then update a DIV on any of
> those
> pages.
>
>
> [..snip..]
>
> This is like taking thread hijacking to a new level! Matt, didn't you 
> just start a different thread on a totally different subject to what 
> "trustfundbaby" was asking about?
>
> - Gonzalo
>
> >


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



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Gonzalo Servat
On Thu, Aug 28, 2008 at 6:39 PM, mattcamuto <[EMAIL PROTECTED]> wrote:

>
> hi sam
>
> i think i made things even more confusing in my post.
>
> I am just ttrying to accomplish plain ajax in multiple pages.
>
> Suppose I have 3 pages
>
> a.html
> b.html
> c.html
>
> And they all in some form have an 'Article' model in them.
>
> I want to rate the article (i.e. /Article/rate//)
> for instance on any of these pages and then update a DIV on any of those
> pages.
>

[..snip..]

This is like taking thread hijacking to a new level! Matt, didn't you just
start a different thread on a totally different subject to what
"trustfundbaby" was asking about?

- Gonzalo

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



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread mattcamuto

hi sam

i think i made things even more confusing in my post.

I am just ttrying to accomplish plain ajax in multiple pages.

Suppose I have 3 pages

a.html
b.html
c.html

And they all in some form have an 'Article' model in them.

I want to rate the article (i.e. /Article/rate//) 
for instance on any of these pages and then update a DIV on any of those 
pages.

HOWEVER suppose in my cake controller

ArticlesController() {

function rate() {
   ///...
   /// 
   $this->set('rating',$rating);
}
}

If i use this using ajax helpers it complains that I have no view file 
rate.ctp. What I want to do is have this method just return so it can be 
used in any ajax/html context it is used. The only examples I have seen 
have something like this:

function rate() {
   ///...
   /// 
   $this->set('rating',$rating);
   $this->render('index'); // To foward back to the page it came from
}

which seems kludgy.. Maybe I should use a component that can be called 
from anywhere instead of the controller?!?!

thanks

m












Sam Sherlock wrote:
> As I understand the example of virtual attributes in rails (that link 
> being the only basis of info)  it concats two fields depending on 
> certain things (eg spaces in the names)
>
> so virtual attributes perform set routines on data under certain 
> circumstances.   without know what you want these *custom properties* 
> to *do* and without knowing the ins and outs of rails its really hard 
> to say.
>
> I believe that whatever your trying to accomplish can be achieved with 
> cake but unless you explain what your trying to achieve any answer may 
> well be misleading.
>
> so what are you trying to accomplish?
>
> 2008/8/28 trustfundbaby <[EMAIL PROTECTED] >
>
>
> At the risk of repeating myself, I am looking for something that works
> the same way as virtual attributes in rails.
>
>
>
> On Aug 28, 2:25 pm, "Sam Sherlock" <[EMAIL PROTECTED]
> > wrote:
> > models have behaviours
> >
> > controller have components
> >
> > and views have helpers
> >
> > also you can add a function to the appmodel and then all models
> have access
> > to it
> > there is an example that shows this on the link to book you posted.
> >
> > 2008/8/28 trustfundbaby <[EMAIL PROTECTED]
> >
> >
> >
> >
> > > I guess I'm talking more along the lines of virtual attributes in
> > > Rails.
> > >http://railscasts.com/episodes/16
> > > I just called it custom properties because thats what its
> called here
> > > (although there are no examples)
> > >http://manual.cakephp.org/view/72/custom-methods-and-properties
> >
> > > On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]
> > wrote:
> > > > I don't get what you mean with "custom properties". Maybe
> it's just me
> > > > but, can you elaborate a bit more please?
> >
> > > > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby
> <[EMAIL PROTECTED] >
> > > wrote:
> >
> > > > > How do you specify custom properties in a CakePHP model?
> > > > > I'm trying to do this, but there is no sample code any
> where that
> > > > > shows how its done, can someone point me in the right
> direction?
>
>
>
> >


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



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Sam Sherlock
As I understand the example of virtual attributes in rails (that link being
the only basis of info)  it concats two fields depending on certain things
(eg spaces in the names)

so virtual attributes perform set routines on data under certain
circumstances.   without know what you want these *custom properties* to
*do* and without knowing the ins and outs of rails its really hard to say.

I believe that whatever your trying to accomplish can be achieved with cake
but unless you explain what your trying to achieve any answer may well be
misleading.

so what are you trying to accomplish?

2008/8/28 trustfundbaby <[EMAIL PROTECTED]>

>
> At the risk of repeating myself, I am looking for something that works
> the same way as virtual attributes in rails.
>
>
>
> On Aug 28, 2:25 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> > models have behaviours
> >
> > controller have components
> >
> > and views have helpers
> >
> > also you can add a function to the appmodel and then all models have
> access
> > to it
> > there is an example that shows this on the link to book you posted.
> >
> > 2008/8/28 trustfundbaby <[EMAIL PROTECTED]>
> >
> >
> >
> > > I guess I'm talking more along the lines of virtual attributes in
> > > Rails.
> > >http://railscasts.com/episodes/16
> > > I just called it custom properties because thats what its called here
> > > (although there are no examples)
> > >http://manual.cakephp.org/view/72/custom-methods-and-properties
> >
> > > On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> > > > I don't get what you mean with "custom properties". Maybe it's just
> me
> > > > but, can you elaborate a bit more please?
> >
> > > > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > How do you specify custom properties in a CakePHP model?
> > > > > I'm trying to do this, but there is no sample code any where that
> > > > > shows how its done, can someone point me in the right direction?
> >
>

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



Ajax method to span multiple pages (re-use widget) help/best practices

2008-08-28 Thread mcamuto

hi there.

first post here but have been using cake for a few months now...

i am trying to figure out he best practice here.

Suppose I have a model (call is 'story' that will be used in possibly
a few pages or in a few other models). I want to have a rating system
for any article that will work in an ajax way. i.e.:

/artictle/rate/12234/

in the controller i would want someting like

function rate() {
// bla bla bla
$this->set('rating',$rating);
}


and I would like to be able to use this function in multiple pages.
What is the best design practice for such a method. Do I want it in a
component or in a controller? From all the examples (ajax on the web)
it seems like the
in your controller method you need to specify the page you are going
to render on? I want universal usage and re-use.

Any pointers would be great.


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



Re: Multiple languages with dynamic content

2008-08-28 Thread OvenCMS

Hi,

may be beter to use OvenCMS ? :)

OvenCMS is an open source content management system, built on the
CakePHP (tested on rc2) framework and jQuery (1.2.6.) Javascript
library. OvenCMS are ideal for small site but also for large-scale
community websites and corporate applications. OvenCMS is fully
modularized and has a lot of working plugins (modules). For more
information see http://ovencms.tarkvaratehas.ee

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



Re: Attm behaviour without finfo functions

2008-08-28 Thread David Persson

Hi Jared,
Thank you very much for your feedback. The problem with the missing
files has been solved by us. The incompatibility with the security
component is an outstanding issue. Next release will include hopefully
better documentation

On Aug 28, 9:39 pm, Jared <[EMAIL PROTECTED]> wrote:
> David,
> I got the plugin to work. Had to download it from the svn repository.
> The available files on the forge to download are missing some files in
> the attm-package. Also I don't know if this is something I did but
> when I include the security component the plugin won't upload images.
>
> On Aug 19, 10:34 am, Jared <[EMAIL PROTECTED]> wrote:
>
> > David,
> > The documents confused me when it asked me to go to the other text
> > file and do the install except for a certain part. I also was confused
> > on what actually media root refers to and where to put the directories
> > that it talks about. Maybe just combine the instructions into one
> > document. I've had to move on from trying to get this to work but will
> > come back to it in a bit.
>
> > On Aug 7, 11:34 am, David Persson <[EMAIL PROTECTED]> wrote:
>
> > > Hi Alessandro,
>
> > > I'm not going to update the Bakery article before the 0.50er series is
> > > at least beta and I'm sure it works in most cases. Did you find the
> > > READMEs in the plugins/attachements/docs and plugins/media/docs
> > > directories? I'm sorry that I can't provide you with an instant
> > > solution. I hope you can wait a 3-5 weeks (this seems very long in
> > > webdevelopment isn't it?).
>
> > > David
>
> > > p.s.: if you can tell me where the docs confuse you i fix that.
>
> > > On 7 Aug., 12:04, Alessandro Daducci <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > Thanks David,
> > > > but now I have problem in figuring out how to use this version of your
> > > > code. I'm new in using plugins and I'm not even able to build your
> > > > example.. :-(
> > > > Did you write any sort of tutorial for using it like the wonderful one
> > > > article you wrote on the Bakery (http://bakery.cakephp.org/articles/
> > > > view/attachments)?
>
> > > > Alessandro
>
> > > > On 6 Ago, 01:00, David Persson <[EMAIL PROTECTED]> wrote:
>
> > > > > Hi Alessandro,
>
> > > > > I was aware of the problem that a very few hosters won't have the
> > > > > finfo extension nor the mime_content_type function. The Mimetype class
> > > > > which is in the package too is responsible for handling all mimetype
> > > > > requests. It should fall back to extension based lookup if content
> > > > > based is not available or does not yield anything.
>
> > > > > There are e.g.  temporary files ("/tmp/3234kjfsdf") where both methods
> > > > > would fail in your case.
>
> > > > > If you are using the latest unstable == 0.50alphaattmpackage and you
> > > > > experience those mimetype detection problems during uploads then
> > > > > simply exclude the mimetype rule by commenting or removing it from
> > > > > plugins/attachments/models/attachment.php.
>
> > > > > On 5 Aug., 21:27, Alessandro Daducci <[EMAIL PROTECTED]>
> > > > > wrote:
>
> > > > > > I'm trying tu use the 'attmbehaviour' by David Persson, but I can't
> > > > > > figure out how to use this behaviour if I only need to work on file-
> > > > > > extensions and not on mime-type.
>
> > > > > > This is because on my localhost there are no problems at all, but I
> > > > > > have to install a cakephp site on a hosting service not supporting
> > > > > > 'finfo' nor 'mime_content_type' functions.
>
> > > > > > How can I solve this problem?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread trustfundbaby

At the risk of repeating myself, I am looking for something that works
the same way as virtual attributes in rails.



On Aug 28, 2:25 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> models have behaviours
>
> controller have components
>
> and views have helpers
>
> also you can add a function to the appmodel and then all models have access
> to it
> there is an example that shows this on the link to book you posted.
>
> 2008/8/28 trustfundbaby <[EMAIL PROTECTED]>
>
>
>
> > I guess I'm talking more along the lines of virtual attributes in
> > Rails.
> >http://railscasts.com/episodes/16
> > I just called it custom properties because thats what its called here
> > (although there are no examples)
> >http://manual.cakephp.org/view/72/custom-methods-and-properties
>
> > On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> > > I don't get what you mean with "custom properties". Maybe it's just me
> > > but, can you elaborate a bit more please?
>
> > > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]>
> > wrote:
>
> > > > How do you specify custom properties in a CakePHP model?
> > > > I'm trying to do this, but there is no sample code any where that
> > > > shows how its done, can someone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Initialization function on the model core

2008-08-28 Thread Rafael Bandeira aka rafaelbandeira3

Nah, sorry for being a little rude...
Enjoy cake community and don't use me and nate as params - we are a
little rude. - Sorry nate but you are... but I know it's your way of
doing things, just like me... not everyone has soft lips!

andbe sure to check my blog rafaelbandeira3.wordpress.com - and don't
forget to catch on my typos!

On 28 ago, 16:39, villalvilla <[EMAIL PROTECTED]> wrote:
> Sorry, I haven't seen your post clearly!
>
> I thought you put something like this:
>
> class xample extends appModel
> {
>
>    var $validate = array('name' => array(
>                                                                 
> 'regla1_nombre' => array(
>                                                                               
>                         'rule'    =>
> array('minLength','3'),
>                                                                               
>                         'message' => __('Minimum
> length of 3 characters',true)
>                                                                               
>                       )
>                                                        )
>                                );
>
> }
> > You can't define things with function in a class...
> > Oh man, go read php.net... come on...
>
> as you can see, i thought you were telling me that it was possible to
> call a function in the declaration of a variable in a class
>
> Sorry for your loosed time, Rafa
>
> regards
>
> On 28 ago, 21:18, Rafael Bandeira aka rafaelbandeira3
>
> <[EMAIL PROTECTED]> wrote:
> > On 28 ago, 15:46, villalvilla <[EMAIL PROTECTED]> wrote:> Wrong!
> > > have you tried that?
>
> > Yes... as with any object in PHP...
>
> > > I have tried it before posting this, trust me, and due to the Model
> > > constructor specifications it fails!
> > > that's why i've done this hooking!
>
> > Are you nuts or something? Have you called parent::__construct()?
>
> > > Even more, if you go to the documentation page of the validation
> > > issue, it says there that you can't do the localization in the Model,
> > > it says that you must do it on the form helper!
>
> > You can't define things with function in a class...
> > Oh man, go read php.net... come on...
>
> > > regards,
> > > mike
>
> > Blah ;-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Initialization function on the model core

2008-08-28 Thread villalvilla

I work for the comunity with my group too!
I don't have a blog, but all the rest of the world has one...
So I think that with that rate of blogs, there will be blogs for
almost every one who wants to read cool things...XD

Dont worry, I think that all of us (the devs) are a little bit rude!

> > regards
> blah
> ;-)

kisses in the ass!!


On 28 ago, 21:49, Rafael Bandeira aka rafaelbandeira3
<[EMAIL PROTECTED]> wrote:
> Nah, sorry for being a little rude...
> Enjoy cake community and don't use me and nate as params - we are a
> little rude. - Sorry nate but you are... but I know it's your way of
> doing things, just like me... not everyone has soft lips!
>
> andbe sure to check my blog rafaelbandeira3.wordpress.com - and don't
> forget to catch on my typos!
>
> On 28 ago, 16:39, villalvilla <[EMAIL PROTECTED]> wrote:
>
> > Sorry, I haven't seen your post clearly!
>
> > I thought you put something like this:
>
> > class xample extends appModel
> > {
>
> >    var $validate = array('name' => array(
> >                                                                 
> > 'regla1_nombre' => array(
> >                                                                             
> >                           'rule'    =>
> > array('minLength','3'),
> >                                                                             
> >                           'message' => __('Minimum
> > length of 3 characters',true)
> >                                                                             
> >                         )
> >                                                        )
> >                                );
>
> > }
> > > You can't define things with function in a class...
> > > Oh man, go read php.net... come on...
>
> > as you can see, i thought you were telling me that it was possible to
> > call a function in the declaration of a variable in a class
>
> > Sorry for your loosed time, Rafa
>
> > regards
>
> > On 28 ago, 21:18, Rafael Bandeira aka rafaelbandeira3
>
> > <[EMAIL PROTECTED]> wrote:
> > > On 28 ago, 15:46, villalvilla <[EMAIL PROTECTED]> wrote:> Wrong!
> > > > have you tried that?
>
> > > Yes... as with any object in PHP...
>
> > > > I have tried it before posting this, trust me, and due to the Model
> > > > constructor specifications it fails!
> > > > that's why i've done this hooking!
>
> > > Are you nuts or something? Have you called parent::__construct()?
>
> > > > Even more, if you go to the documentation page of the validation
> > > > issue, it says there that you can't do the localization in the Model,
> > > > it says that you must do it on the form helper!
>
> > > You can't define things with function in a class...
> > > Oh man, go read php.net... come on...
>
> > > > regards,
> > > > mike
>
> > > Blah ;-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Initialization function on the model core

2008-08-28 Thread Rafael Bandeira aka rafaelbandeira3

Nah, sorry for being a little rude...
Enjoy cake community and don't use me and nate as params - we are a
little rude. - Sorry nate but you are... but I know it's your way of
doing things, just like me... not everyone has soft lips!

andbe sure to check my blog rafaelbandeira3.wordpress.com - and don't
forget to catch on my typos!

On 28 ago, 16:39, villalvilla <[EMAIL PROTECTED]> wrote:
> Sorry, I haven't seen your post clearly!
>
> I thought you put something like this:
>
> class xample extends appModel
> {
>
>    var $validate = array('name' => array(
>                                                                 
> 'regla1_nombre' => array(
>                                                                               
>                         'rule'    =>
> array('minLength','3'),
>                                                                               
>                         'message' => __('Minimum
> length of 3 characters',true)
>                                                                               
>                       )
>                                                        )
>                                );
>
> }
> > You can't define things with function in a class...
> > Oh man, go read php.net... come on...
>
> as you can see, i thought you were telling me that it was possible to
> call a function in the declaration of a variable in a class
>
> Sorry for your loosed time, Rafa
>
> regards
>
> On 28 ago, 21:18, Rafael Bandeira aka rafaelbandeira3
>
> <[EMAIL PROTECTED]> wrote:
> > On 28 ago, 15:46, villalvilla <[EMAIL PROTECTED]> wrote:> Wrong!
> > > have you tried that?
>
> > Yes... as with any object in PHP...
>
> > > I have tried it before posting this, trust me, and due to the Model
> > > constructor specifications it fails!
> > > that's why i've done this hooking!
>
> > Are you nuts or something? Have you called parent::__construct()?
>
> > > Even more, if you go to the documentation page of the validation
> > > issue, it says there that you can't do the localization in the Model,
> > > it says that you must do it on the form helper!
>
> > You can't define things with function in a class...
> > Oh man, go read php.net... come on...
>
> > > regards,
> > > mike
>
> > Blah ;-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Initialization function on the model core

2008-08-28 Thread villalvilla

Sorry, I haven't seen your post clearly!

I thought you put something like this:

class xample extends appModel
{

   var $validate = array('name' => array(
'regla1_nombre' 
=> array(

  'rule'=>
array('minLength','3'),

  'message' => __('Minimum
length of 3 characters',true)

)
   )
   );
}

> You can't define things with function in a class...
> Oh man, go read php.net... come on...

as you can see, i thought you were telling me that it was possible to
call a function in the declaration of a variable in a class

Sorry for your loosed time, Rafa

regards

On 28 ago, 21:18, Rafael Bandeira aka rafaelbandeira3
<[EMAIL PROTECTED]> wrote:
> On 28 ago, 15:46, villalvilla <[EMAIL PROTECTED]> wrote:> Wrong!
> > have you tried that?
>
> Yes... as with any object in PHP...
>
> > I have tried it before posting this, trust me, and due to the Model
> > constructor specifications it fails!
> > that's why i've done this hooking!
>
> Are you nuts or something? Have you called parent::__construct()?
>
> > Even more, if you go to the documentation page of the validation
> > issue, it says there that you can't do the localization in the Model,
> > it says that you must do it on the form helper!
>
> You can't define things with function in a class...
> Oh man, go read php.net... come on...
>
> > regards,
> > mike
>
> Blah ;-)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Attm behaviour without finfo functions

2008-08-28 Thread Jared

David,
I got the plugin to work. Had to download it from the svn repository.
The available files on the forge to download are missing some files in
the attm-package. Also I don't know if this is something I did but
when I include the security component the plugin won't upload images.

On Aug 19, 10:34 am, Jared <[EMAIL PROTECTED]> wrote:
> David,
> The documents confused me when it asked me to go to the other text
> file and do the install except for a certain part. I also was confused
> on what actually media root refers to and where to put the directories
> that it talks about. Maybe just combine the instructions into one
> document. I've had to move on from trying to get this to work but will
> come back to it in a bit.
>
> On Aug 7, 11:34 am, David Persson <[EMAIL PROTECTED]> wrote:
>
> > Hi Alessandro,
>
> > I'm not going to update the Bakery article before the 0.50er series is
> > at least beta and I'm sure it works in most cases. Did you find the
> > READMEs in the plugins/attachements/docs and plugins/media/docs
> > directories? I'm sorry that I can't provide you with an instant
> > solution. I hope you can wait a 3-5 weeks (this seems very long in
> > webdevelopment isn't it?).
>
> > David
>
> > p.s.: if you can tell me where the docs confuse you i fix that.
>
> > On 7 Aug., 12:04, Alessandro Daducci <[EMAIL PROTECTED]>
> > wrote:
>
> > > Thanks David,
> > > but now I have problem in figuring out how to use this version of your
> > > code. I'm new in using plugins and I'm not even able to build your
> > > example.. :-(
> > > Did you write any sort of tutorial for using it like the wonderful one
> > > article you wrote on the Bakery (http://bakery.cakephp.org/articles/
> > > view/attachments)?
>
> > > Alessandro
>
> > > On 6 Ago, 01:00, David Persson <[EMAIL PROTECTED]> wrote:
>
> > > > Hi Alessandro,
>
> > > > I was aware of the problem that a very few hosters won't have the
> > > > finfo extension nor the mime_content_type function. The Mimetype class
> > > > which is in the package too is responsible for handling all mimetype
> > > > requests. It should fall back to extension based lookup if content
> > > > based is not available or does not yield anything.
>
> > > > There are e.g.  temporary files ("/tmp/3234kjfsdf") where both methods
> > > > would fail in your case.
>
> > > > If you are using the latest unstable == 0.50alphaattmpackage and you
> > > > experience those mimetype detection problems during uploads then
> > > > simply exclude the mimetype rule by commenting or removing it from
> > > > plugins/attachments/models/attachment.php.
>
> > > > On 5 Aug., 21:27, Alessandro Daducci <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > I'm trying tu use the 'attmbehaviour' by David Persson, but I can't
> > > > > figure out how to use this behaviour if I only need to work on file-
> > > > > extensions and not on mime-type.
>
> > > > > This is because on my localhost there are no problems at all, but I
> > > > > have to install a cakephp site on a hosting service not supporting
> > > > > 'finfo' nor 'mime_content_type' functions.
>
> > > > > How can I solve this problem?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread trustfundbaby

Thanks for that.
I'll have to look into it further, but I'm hoping it works the same
way as virtual attributes in Rails.


On Aug 28, 9:15 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
> A CakePHP Model is just a PHP class. You can still use all of PHP's
> class abilities.
>
> for example:
>
> class MyModel extends AppModel {
>
>    var $myCustomPropery = "w00t!";
>
> }
>
> in controller:
>
> echo $this->MyModel->myCustomProperty;
>
> On Aug 28, 2:19 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
>
> > I don't get what you mean with "custom properties". Maybe it's just me
> > but, can you elaborate a bit more please?
>
> > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]> wrote:
>
> > > How do you specify custom properties in a CakePHP model?
> > > I'm trying to do this, but there is no sample code any where that
> > > shows how its done, can someone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Sam Sherlock
models have behaviours

controller have components

and views have helpers

also you can add a function to the appmodel and then all models have access
to it
there is an example that shows this on the link to book you posted.

2008/8/28 trustfundbaby <[EMAIL PROTECTED]>

>
> I guess I'm talking more along the lines of virtual attributes in
> Rails.
> http://railscasts.com/episodes/16
> I just called it custom properties because thats what its called here
> (although there are no examples)
> http://manual.cakephp.org/view/72/custom-methods-and-properties
>
> On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> > I don't get what you mean with "custom properties". Maybe it's just me
> > but, can you elaborate a bit more please?
> >
> > On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]>
> wrote:
> >
> > > How do you specify custom properties in a CakePHP model?
> > > I'm trying to do this, but there is no sample code any where that
> > > shows how its done, can someone point me in the right direction?
> >
>

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



Dimensional/comparative search

2008-08-28 Thread Un

Each game in my games database has fields that represent dimensions.
They are simply numbers ranging from 0-7, basically "how X" or "how
Action-style" the game is. We'll call these fields X, Y, and Z.

I wish to create a search tool that finds other games that are most
similar to the inputted game (using the X, Y, and Z fields' numerical
values).

Below is my current solution. For each game, I proceed to compare each
numerical field. I will call our original game $original. Just take a
looksy:

function specialsearch($original) {
   $games = $this->Game->find('all', array('fields'=>array('X', 'Y',
'Z')));
   foreach ($games as $game) {
  $results[ $game['Game']['id'] ]['X'] = abs( $game['Game']['X'] -
$original['Game']['X'] );
  //We'd repeat this for each field, Y, Z and so on...

  $results[ $game['Game']['id'] ]['strength'] =
$results[ $game['Game']['id'] ]['X'] + $results[ $game['Game']['id'] ]
['Y'] + $results[ $game['Game']['id'] ]['Z'];
   }

   //This is where we'd put all the logic for saving or returning the
results.
}

This should work well. We wind up with a distance from your original
in each dimension. So when we add them together, we find exactly how
dissimilar it is. 0 would be a game that's identical to this one, and
infinity would be the opposite of this game.

But this seems inefficient, especially if I want to display, for
example, 5 other games that are similar to this one on every "view"
action! Does anybody have a better solution?

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



Re: Initialization function on the model core

2008-08-28 Thread Rafael Bandeira aka rafaelbandeira3



On 28 ago, 15:46, villalvilla <[EMAIL PROTECTED]> wrote:
> Wrong!
> have you tried that?
Yes... as with any object in PHP...

> I have tried it before posting this, trust me, and due to the Model
> constructor specifications it fails!
> that's why i've done this hooking!
Are you nuts or something? Have you called parent::__construct()?

> Even more, if you go to the documentation page of the validation
> issue, it says there that you can't do the localization in the Model,
> it says that you must do it on the form helper!
You can't define things with function in a class...
Oh man, go read php.net... come on...


> regards,
> mike

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



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread trustfundbaby

I guess I'm talking more along the lines of virtual attributes in
Rails.
http://railscasts.com/episodes/16
I just called it custom properties because thats what its called here
(although there are no examples)
http://manual.cakephp.org/view/72/custom-methods-and-properties

On Aug 28, 8:19 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> I don't get what you mean with "custom properties". Maybe it's just me
> but, can you elaborate a bit more please?
>
> On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]> wrote:
>
> > How do you specify custom properties in a CakePHP model?
> > I'm trying to do this, but there is no sample code any where that
> > shows how its done, can someone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Can CookieComponent verify cookie support?

2008-08-28 Thread Jim Fitzpatrick

Looking at the core code, it seems that CookieComponent::write()
doesn't check the return value of setcookie() when it writes values to
the internal array. As such, using CookieComponent::read() will then
return that value, giving the impression that the cookie is set, when
in fact, this might not be the case. It would seem that, at the very
least, the write method should return false in the case that a cookie
cannot be set.

Is the current functionality desired? Does one need to directly use
setcookie()/$_COOKIE when verifying cookie support?

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



Re: Multiple languages with dynamic content

2008-08-28 Thread Kalt

Hi,

I wrote a complete tutorial on the subject. It's in french, but you
can read the code and ask me questions here if you need.

http://www.formation-cakephp.com/41/multilingue-18n-l10n

On 28 août, 17:03, Julian Guy <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Can somebody give me advise on how best to set up a cakephp site that
> uses multiple languages and has dynamic content. I can find tutorials
> that show how to use the .po files to translate text but the
> application I am working on needs to have translations. Essentially I
> need three links for english, french and german in the page which set
> the language of the user (I was planning on using sessions for this)
> and then I need the main content of the page (title, body) to be shown
> in the languages choosen.
>
> Any help appreciated
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Initialization function on the model core

2008-08-28 Thread villalvilla

thanks a lot for your response!
i'll post it right now!

This comunity is wonderful!

regards,
mike

On 28 ago, 18:42, Daniel Hofstetter <[EMAIL PROTECTED]> wrote:
> Hi,
>
> [snipped]
>
> > So i think it would be great for all the cake comunity to have this
> > concept implementated on the next release of cake!
>
> Please open an enhancement ticket for it on trac (https://
> trac.cakephp.org) so the devs can consider to add it.
>
> --
> Daniel Hofstetterhttp://cakebaker.42dh.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Initialization function on the model core

2008-08-28 Thread villalvilla

Wrong!
have you tried that?
I have tried it before posting this, trust me, and due to the Model
constructor specifications it fails!
that's why i've done this hooking!

Even more, if you go to the documentation page of the validation
issue, it says there that you can't do the localization in the Model,
it says that you must do it on the form helper!

regards,
mike

On 28 ago, 18:54, Rafael Bandeira aka rafaelbandeira3
<[EMAIL PROTECTED]> wrote:
> > > So i think it would be great for all the cake comunity to have this
> > > concept implementated on the next release of cake!
>
> > Please open an enhancement ticket for it on trac (https://
> > trac.cakephp.org) so the devs can consider to add it.
>
> I don't think it's appliable... use MyModel::__construct()
>
> class User extends AppModel
> {
>     var $name           = 'User';
>         var $validate   = NULL;
>
>         function __construct($id = false, $table = null, $ds = null)
>         {
>                 parent::__construct($id, $table, $ds);
>                 $this->validate = array(
>                                 'nombre' => array(
>                                                 'regla1_nombre' =>
> array(
>
> 'rule'  => array('minLength','3'),
>
> 'message'       => __('Minimum length of 3 characters',true)
>                                                                               
>       ),
>                                                 'regla2_nombre' =>
> array(
>
> 'rule'  => array('maxLength','50'),
>
> 'message'       => __('Maximum length of 50 characters',true)
>                                                                               
>      )
>                                                         )
>                                                  );
>         }
>
> }
>
> Why would one have to care about one more method with the same purpose
> of the another?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple is Hard, talked by Rasmus Lerdorf @ FrOSCon 2008

2008-08-28 Thread majna

.. and cake hello world application memory usage is 5 Mb.
So when you put few things more (model recursive instances) you must
fight to be below PHP4 default 8Mb.
(For exmpl. CI has 1.2 Mb.)
(persistModel and which  caches class registry use even more memory)
(profiling cake I can see around 2000- 3000 calls to PHP's strtolower
etc.)



On Aug 28, 5:48 pm, Nate <[EMAIL PROTECTED]> wrote:
> @kiang: That's a great idea.  I think a more general performance-
> tuning guide would really help out.  I know there are some resources
> on this, but I think a comprehensive guide in the Cookbook somewhere
> would be great.  I'll see what we can do about this.
>
> On Aug 28, 11:11 am, kiang <[EMAIL PROTECTED]> wrote:
>
> > Maybe there could be one page like 'Read first before benchmarking' in
> > home page since there exists many mis-understandings around the
> > world. :)
>
> > ---
> > kiang
>
> > On Aug 28, 10:41 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > > One thing we know for sure is that we can always work to improve the
> > > speed. However, we will not do it in earnest until the time is right.
> > > We have been here before, seen similar things, and come up with the
> > > answers.
>
> > > While the hello world is pretty silly, a couple of things strike me
> > > right off the bat. For one, var $helpers = array() will still load 3
> > > files, while setting it to null will stop all loading. So, in a lot of
> > > ways Cake shows up slower because it does more from the start. The
> > > other major place is the session handling. We have no idea what his
> > > settings were in this regard.
>
> > > In any case, now that we are deeper into the RC cycle you will see in
> > > the timeline many efforts to improve and optimize the responsiveness
> > > of the framework. If you would like the historical perspective have a
> > > look at what happened in 1.1 between the 1.1.13 and 1.1.17 releases.
> > > We have a history of squeezing speed out of this language and
> > > framework and we prepared to do it again.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: More HABTM problems, maybe due to complex requirements

2008-08-28 Thread Nightwish

First and final bump...

Any help for me? :) Pretty please?

Thanks anyway,
Paulo

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



Re: Initialization function on the model core

2008-08-28 Thread Rafael Bandeira aka rafaelbandeira3

>
> > So i think it would be great for all the cake comunity to have this
> > concept implementated on the next release of cake!
>
> Please open an enhancement ticket for it on trac (https://
> trac.cakephp.org) so the devs can consider to add it.
>

I don't think it's appliable... use MyModel::__construct()

class User extends AppModel
{
var $name   = 'User';
var $validate   = NULL;

function __construct($id = false, $table = null, $ds = null)
{
parent::__construct($id, $table, $ds);
$this->validate = array(
'nombre' => array(
'regla1_nombre' =>
array(
 
'rule'  => array('minLength','3'),
 
'message'   => __('Minimum length of 3 characters',true)

),
'regla2_nombre' =>
array(
 
'rule'  => array('maxLength','50'),
 
'message'   => __('Maximum length of 50 characters',true)

   )
)
 );
}

}

Why would one have to care about one more method with the same purpose
of the another?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Initialization function on the model core

2008-08-28 Thread Daniel Hofstetter

Hi,

[snipped]

> So i think it would be great for all the cake comunity to have this
> concept implementated on the next release of cake!

Please open an enhancement ticket for it on trac (https://
trac.cakephp.org) so the devs can consider to add it.

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



Prefix routing and html->link()

2008-08-28 Thread Jaime

Hi all,

I can't find out how to correctly link my actions when using prefix
routing. I have two actions: index() for public users, and
admin_index() for the admin, which dumps extra data:

core.php:
Configure::write('Routing.admin', 'admin');

news_controller.php:
class NewsController extends AppController {
  function index() { }
  function admin_index() { }
}

routes.php:
Router::connect('/noticias', array('controller' => 'news', 'action' =>
'index'));
Router::connect('/administracion/noticias', array('controller' =>
'news', 'action' => 'index', 'prefix' => 'admin'));

news.ctp:
echo $html->link('PUBLIC NEWS', array('controller' => 'news', 'action'
=> 'index')); // Links to /noticias
echo $html->link('ADMIN NEWS', array('controller' => 'news', 'action'
=> 'admin_index'));  // Links to /news/admin_index

As you can see, the second link is broken (should say "/administracion/
noticias" instead of "/news/admin_index").

I've been dealing with this for a while and I cannot figure out the
solution. Has anybody run into this before?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Large $_POST variables crashing Controller startup

2008-08-28 Thread neverlosty

Hi David,

I checked the post_max_size, it says its 8M
The wierd thing is, if I look at my $_POST any time before that line
in controller.php its fine.
The post is there in its entirety and I can access it.

It seemed to be specific to cake's bootstrap/startup process.

cheers,
Tony.

On Aug 27, 5:02 pm, David <[EMAIL PROTECTED]> wrote:
> Hi there
>
> Could it be something to do with your php.ini's post_max_size
> directive value?
>
> David
>
> On Aug 27, 4:55 pm, neverlosty <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm having an issue where I'm trying to post a very large (1M) string
> > through http $_POST
>
> > For some reason when cake is starting up, in
> > cake/libs/controller/controller.php
> > [line 387]  $this->Component->init($this);
>
> > After that it just dies. When I try to debug the Component.php
> > function init, it does not get called.
> > This only happens when there is an excessively large $_POST.
>
> > Has anyone ever had this issue?
>
> > cheers,
> > Tony.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple is Hard, talked by Rasmus Lerdorf @ FrOSCon 2008

2008-08-28 Thread Nate

@kiang: That's a great idea.  I think a more general performance-
tuning guide would really help out.  I know there are some resources
on this, but I think a comprehensive guide in the Cookbook somewhere
would be great.  I'll see what we can do about this.

On Aug 28, 11:11 am, kiang <[EMAIL PROTECTED]> wrote:
> Maybe there could be one page like 'Read first before benchmarking' in
> home page since there exists many mis-understandings around the
> world. :)
>
> ---
> kiang
>
> On Aug 28, 10:41 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > One thing we know for sure is that we can always work to improve the
> > speed. However, we will not do it in earnest until the time is right.
> > We have been here before, seen similar things, and come up with the
> > answers.
>
> > While the hello world is pretty silly, a couple of things strike me
> > right off the bat. For one, var $helpers = array() will still load 3
> > files, while setting it to null will stop all loading. So, in a lot of
> > ways Cake shows up slower because it does more from the start. The
> > other major place is the session handling. We have no idea what his
> > settings were in this regard.
>
> > In any case, now that we are deeper into the RC cycle you will see in
> > the timeline many efforts to improve and optimize the responsiveness
> > of the framework. If you would like the historical perspective have a
> > look at what happened in 1.1 between the 1.1.13 and 1.1.17 releases.
> > We have a history of squeezing speed out of this language and
> > framework and we prepared to do it again.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Handling HTML special chars from user generated content ( e.g. forms)

2008-08-28 Thread worthy

You saved my day. :D

I was messing with this problem the whole day and never thought it
would be that simple :).

Thank you so much for this simple solution!

Greetings
worthy

On 28 Aug., 17:38, Günther Theilen <[EMAIL PROTECTED]> wrote:
> Hi,
>
> do you use the form helper?
> If so try something like this:
>
> $form->input('foo.bar', array('escape' => false))
>
> Regards
> Guenther
>
> worthy schrieb:
>
> > Another explaining example for the edit form:
>
> >http://localhost/regions/edit/15
>
> > data['Regions']['id']=15
> > data['Regions']['name']='Test ä'
>
> > Now when cakephp fills the form with this data the value of the field
> > changes from
>
> > 'Test ä' to 'Test ä'
>
> > And so the field shows 'Test ä instead of 'Test ä'
>
> > Is there any way to tell cakephp not to check for specialchars?
>
> > Maybe now there is some help? :P
>
> > Greetings
> > worthy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Handling HTML special chars from user generated content ( e.g. forms)

2008-08-28 Thread Günther Theilen

Hi,

do you use the form helper?
If so try something like this:

$form->input('foo.bar', array('escape' => false))

Regards
Guenther

worthy schrieb:
> Another explaining example for the edit form:
> 
> http://localhost/regions/edit/15
> 
> data['Regions']['id']=15
> data['Regions']['name']='Test ä'
> 
> Now when cakephp fills the form with this data the value of the field
> changes from
> 
> 'Test ä' to 'Test ä'
> 
> And so the field shows 'Test ä instead of 'Test ä'
> 
> Is there any way to tell cakephp not to check for specialchars?
> 
> Maybe now there is some help? :P
> 
> Greetings
> worthy
> > 


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



Re: Handling HTML special chars from user generated content ( e.g. forms)

2008-08-28 Thread worthy

Another explaining example for the edit form:

http://localhost/regions/edit/15

data['Regions']['id']=15
data['Regions']['name']='Test ä'

Now when cakephp fills the form with this data the value of the field
changes from

'Test ä' to 'Test ä'

And so the field shows 'Test ä instead of 'Test ä'

Is there any way to tell cakephp not to check for specialchars?

Maybe now there is some help? :P

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



Re: Simple is Hard, talked by Rasmus Lerdorf @ FrOSCon 2008

2008-08-28 Thread RichardAtHome

Just my two cents: CakePHP is fast enough for me :-)

That's not to say you shouldn't optimize for speed at some point in
the future. I just mean, it shouldn't be a priority.

Keep doing what your doing Cake dev's. Cake hasn't become one of the
most popular PHP frameworks because of its speed ;-)

On Aug 28, 4:11 pm, kiang <[EMAIL PROTECTED]> wrote:
> Maybe there could be one page like 'Read first before benchmarking' in
> home page since there exists many mis-understandings around the
> world. :)
>
> ---
> kiang
>
> On Aug 28, 10:41 pm, Gwoo <[EMAIL PROTECTED]> wrote:
>
> > One thing we know for sure is that we can always work to improve the
> > speed. However, we will not do it in earnest until the time is right.
> > We have been here before, seen similar things, and come up with the
> > answers.
>
> > While the hello world is pretty silly, a couple of things strike me
> > right off the bat. For one, var $helpers = array() will still load 3
> > files, while setting it to null will stop all loading. So, in a lot of
> > ways Cake shows up slower because it does more from the start. The
> > other major place is the session handling. We have no idea what his
> > settings were in this regard.
>
> > In any case, now that we are deeper into the RC cycle you will see in
> > the timeline many efforts to improve and optimize the responsiveness
> > of the framework. If you would like the historical perspective have a
> > look at what happened in 1.1 between the 1.1.13 and 1.1.17 releases.
> > We have a history of squeezing speed out of this language and
> > framework and we prepared to do it again.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Initialization function on the model core

2008-08-28 Thread villalvilla

Hi all!
I'm a cakephp developer, and i love all the great issues that cake
implements for you, like auth, acls, helpers in general and so on.
It's going close to ruby, this is a great effort that way!
congratulations!
As I'm having more and more experience, I find some things that could
be improved, like for example internationalization on the validation
of the models.
I have patched the cake code to make all the models to call a function
named "init", so i inserted a new line in the file "/cake/libs/
class_registry.php" next to the line 128 with this code:

${$class}->init();

Doing this, all the times that a model is instantiated, init() is
immediatetly called. Due to this, i had to put a function named
"init()" in the class "Model" of the file "/cake/libs/model/
model.php", because all the model classes inherit from "Model" class.
Doing this, if you want to override the init function in your model
to, for example, allow localization or method calling in the
validation of the model, you can do it!
The explanation is that, like many other languages like perl, c++, vb,
java,  you cannot call any function during the declaration of a
variable of a class, but you can redefine that variable that you
declare inside the code!
So my model's code would be:

class User extends AppModel
{
var $name   = 'User';
var $validate   = NULL;

function init()
{
$this->validate = array(
'nombre' => array(
'regla1_nombre' =>
array(
'rule'  
=> array('minLength','3'),

'message'   => __('Minimum length of 3 characters',true)

),
'regla2_nombre' => array(
'rule'  
=> array('maxLength','50'),

'message'   => __('Maximum length of 50 characters',true)

   )
)
 );
}

}

as you can see, i redefined validate array inside init() method.

So i think it would be great for all the cake comunity to have this
concept implementated on the next release of cake!
Hope this help any people!
regards

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



Re: Simple is Hard, talked by Rasmus Lerdorf @ FrOSCon 2008

2008-08-28 Thread kiang

Maybe there could be one page like 'Read first before benchmarking' in
home page since there exists many mis-understandings around the
world. :)

---
kiang

On Aug 28, 10:41 pm, Gwoo <[EMAIL PROTECTED]> wrote:
> One thing we know for sure is that we can always work to improve the
> speed. However, we will not do it in earnest until the time is right.
> We have been here before, seen similar things, and come up with the
> answers.
>
> While the hello world is pretty silly, a couple of things strike me
> right off the bat. For one, var $helpers = array() will still load 3
> files, while setting it to null will stop all loading. So, in a lot of
> ways Cake shows up slower because it does more from the start. The
> other major place is the session handling. We have no idea what his
> settings were in this regard.
>
> In any case, now that we are deeper into the RC cycle you will see in
> the timeline many efforts to improve and optimize the responsiveness
> of the framework. If you would like the historical perspective have a
> look at what happened in 1.1 between the 1.1.13 and 1.1.17 releases.
> We have a history of squeezing speed out of this language and
> framework and we prepared to do it again.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple is Hard, talked by Rasmus Lerdorf @ FrOSCon 2008

2008-08-28 Thread Michael Schmalle
> One thing we know for sure is that we can always work to improve the
speed. However, we will not do it in earnest until the time is right.
We have been here before, seen similar things, and come up with the
answers.

This is SO smart and the way leaders lead.

I am in the middle of making a HUGE actionscript/mxml documentor/publisher
for component products, similar to phpDocumentor parser. But I also designed
this application to parse anything(any language/document where you would
create a new analyzer/parser/renderer/publisher). ... why, because I could
and can see the future benefits.

I have chosen scalability over speed. It's a decision that all have to make
but having patients is what in the end shows a frameworks true design.

Once you design something that from the start is scalable, you can EASILY
optimize since you know where to optimize. This all takes time, and the
tortoise(scalable freaks) always beats the hair(speed freaks) in the end.

Peace,
Mike

On Thu, Aug 28, 2008 at 10:41 AM, Gwoo <[EMAIL PROTECTED]> wrote:

>
> One thing we know for sure is that we can always work to improve the
> speed. However, we will not do it in earnest until the time is right.
> We have been here before, seen similar things, and come up with the
> answers.
>
> While the hello world is pretty silly, a couple of things strike me
> right off the bat. For one, var $helpers = array() will still load 3
> files, while setting it to null will stop all loading. So, in a lot of
> ways Cake shows up slower because it does more from the start. The
> other major place is the session handling. We have no idea what his
> settings were in this regard.
>
> In any case, now that we are deeper into the RC cycle you will see in
> the timeline many efforts to improve and optimize the responsiveness
> of the framework. If you would like the historical perspective have a
> look at what happened in 1.1 between the 1.1.13 and 1.1.17 releases.
> We have a history of squeezing speed out of this language and
> framework and we prepared to do it again.
> >
>


-- 
Teoti Graphix, LLC
http://www.teotigraphix.com

Teoti Graphix Blog
http://www.blog.teotigraphix.com

You can find more by solving the problem then by 'asking the question'.

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



Multiple languages with dynamic content

2008-08-28 Thread Julian Guy

Hi,

Can somebody give me advise on how best to set up a cakephp site that
uses multiple languages and has dynamic content. I can find tutorials
that show how to use the .po files to translate text but the
application I am working on needs to have translations. Essentially I
need three links for english, french and german in the page which set
the language of the user (I was planning on using sessions for this)
and then I need the main content of the page (title, body) to be shown
in the languages choosen.

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



Re: Provide Help To develop simple script write in CakePHP

2008-08-28 Thread Donkeybob

You'll have to read the manual -> http://book.cakephp.org/

Run through the blog tutorial to get your started ->
http://book.cakephp.org/view/219/blog

Nobody is going to provide you step-by-step here, when step-by-step
can be achieved by using the google, reading the manual, blogs,
searching this group . . . etc.


On Aug 28, 9:57 am, "divyesh karelia.usa"
<[EMAIL PROTECTED]> wrote:
> Hello all Member
>
> I am fresher for CakePHP. so Please Provide Help me.
>
> give me step by step to develop application
>
> i want develop simple script write in CakePHP say "Hello Word"
>
> give me step how to create this and give me properer directory
> structure we used in cakephp
>
> Thanking you anticipation
> Divyesh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple is Hard, talked by Rasmus Lerdorf @ FrOSCon 2008

2008-08-28 Thread Gwoo

One thing we know for sure is that we can always work to improve the
speed. However, we will not do it in earnest until the time is right.
We have been here before, seen similar things, and come up with the
answers.

While the hello world is pretty silly, a couple of things strike me
right off the bat. For one, var $helpers = array() will still load 3
files, while setting it to null will stop all loading. So, in a lot of
ways Cake shows up slower because it does more from the start. The
other major place is the session handling. We have no idea what his
settings were in this regard.

In any case, now that we are deeper into the RC cycle you will see in
the timeline many efforts to improve and optimize the responsiveness
of the framework. If you would like the historical perspective have a
look at what happened in 1.1 between the 1.1.13 and 1.1.17 releases.
We have a history of squeezing speed out of this language and
framework and we prepared to do it again.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Provide Help To develop simple script write in CakePHP

2008-08-28 Thread divyesh karelia.usa

Hello all Member

I am fresher for CakePHP. so Please Provide Help me.

give me step by step to develop application

i want develop simple script write in CakePHP say "Hello Word"

give me step how to create this and give me properer directory
structure we used in cakephp



Thanking you anticipation
Divyesh


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



Bad Gateway-Web server received an invalid response while acting as a gateway or proxy server.

2008-08-28 Thread tarun bansal

i had uploaded the website made in cakephp to server in a folder named
karanlive.whenever i run http://demo.itmltd.net/karanlive/the
initial page opens quite well but rest of the links doesnt
works...like http://demo.itmltd.net/karanlive/index.php/karanlives/
or http://demo.itmltd.net/karanlive/index.php/asateacher/
it shoots the error "Bad Gateway-Web server received an invalid
response while acting as a gateway or proxy server."

i have checked all the paths declared in index.php .

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



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread RichardAtHome

A CakePHP Model is just a PHP class. You can still use all of PHP's
class abilities.

for example:

class MyModel extends AppModel {

   var $myCustomPropery = "w00t!";

}

in controller:

echo $this->MyModel->myCustomProperty;


On Aug 28, 2:19 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> I don't get what you mean with "custom properties". Maybe it's just me
> but, can you elaborate a bit more please?
>
> On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]> wrote:
>
> > How do you specify custom properties in a CakePHP model?
> > I'm trying to do this, but there is no sample code any where that
> > shows how its done, can someone point me in the right direction?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: no database table

2008-08-28 Thread Donkeybob

This is how i do it . . .in the model . . .

var $useTable = false;

works perfectly for me.


On Aug 27, 5:50 pm, "Abrar Arshad" <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 27, 2008 at 12:53 PM, BiraRai <[EMAIL PROTECTED]> wrote:
>
> > How to does one tell cakephp controller not to use a database table?
>
> >   Re:
>
>   so it means you dont want to use Model class,
>  so you can do it by using it like this
>  var $uses = array();
>  it will not use any table for your controller.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do you specify custom properties in a CakePHP model?

2008-08-28 Thread Dardo Sordi Bogado

I don't get what you mean with "custom properties". Maybe it's just me
but, can you elaborate a bit more please?

On Thu, Aug 28, 2008 at 2:03 AM, trustfundbaby <[EMAIL PROTECTED]> wrote:
>
> How do you specify custom properties in a CakePHP model?
> I'm trying to do this, but there is no sample code any where that
> shows how its done, can someone point me in the right direction?
>
> >
>

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



Re: Simple is Hard, talked by Rasmus Lerdorf @ FrOSCon 2008

2008-08-28 Thread Nate

Sorry, but Rasmus' benchmarks are useless.  There's no documentation
of his methodology. There's not even any indication that he wasn't
running in debug mode.  I've spoken to Paul M. Jones (author of the
original PHP framework benchmarks), and he's getting ready to run
another round soon.  So, we'll see who comes out on top when
everything is actually done right.

On Aug 28, 8:33 am, kiang <[EMAIL PROTECTED]> wrote:
> http://talks.php.net/show/froscon08/
>
> He compared the performance of several PHP frameworks and CakePHP
> seems to be the one which have the biggest space to improve. ^^||
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Saving HABTM, stopped working for me since 1.2rc2.

2008-08-28 Thread [EMAIL PROTECTED]

25 debug()s later... saving HABTM works fine...
On one project (being converted from 1.1 to 1.2) the problem was in
beforeSave which removed the HABTM by using read() (which in 1.1
worked a bit differently).
On the other The problem was a validation rule.

So, sorry for the useless question.

Looking at the test-files, I found something I haven't seen before:

instead of:
$this->Model->create();
$this->Model->save($data);
this was used with the same results:
$this->Model->set($data);
$this->Model->save();

Since save() also calls set() create might be unnecessary now?
(unnecessary for "clearing" the model in a loop, that is)
But where I am still doing that I should probably start using
saveAll().


On Aug 28, 12:46 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi,
> I have noticed that saving HABTM records have stopped working for me.
> (Saving an Article and which Categories it should be linked to for
> example)
>
> Cake1.2rc2 (and the latest nightly) does no longer save my array
> structure as before. I have not found anything in the API, Cookbook or
> here to show me what might have changed or what I am doing wrong. I
> found one thread where one guy had found his answer in the test-file
> (supposedly the test-file for Model) but no more info was given.
>
> Before:
> $data
>   Article
>     id
>     title
>     
>   Category
>     Category
>       2
>       6
>
> That is: $data['Category']['Category'] = $array_of_ids
>
> This does not work anymore. This is true for two separate codebases,
> one where I have not touched the affected models in a while. This
> makes me think it is not just a but I have managed to introduce but
> something subtile that has changed that affects my accosiations.
> The API suggests that saveAll() is now the method to use when saving
> associated data.
> testSaveHabtm() in model.test.php has the same structure as I have (as
> far as I can tell):
> Tag=>Tag=>array_of_ids
>
> Has something changed that now requires me to define the HABTM in more
> detail than simply the name of the model?
>
> Any ideas?
>
> /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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple is Hard, talked by Rasmus Lerdorf @ FrOSCon 2008

2008-08-28 Thread Dr. Tarique Sani

On Thu, Aug 28, 2008 at 6:03 PM, kiang <[EMAIL PROTECTED]> wrote:
>
> http://talks.php.net/show/froscon08/
>
> He compared the performance of several PHP frameworks and CakePHP
> seems to be the one which have the biggest space to improve. ^^||

H  Another "Hello world" benchmark for frameworks?

I would have assumed that we had moved ahead but then I am a mere
mortal and Rasmus is GOD!

Tarique

-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

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



Simple is Hard, talked by Rasmus Lerdorf @ FrOSCon 2008

2008-08-28 Thread kiang

http://talks.php.net/show/froscon08/

He compared the performance of several PHP frameworks and CakePHP
seems to be the one which have the biggest space to improve. ^^||
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Handling HTML special chars from user generated content ( e.g. forms)

2008-08-28 Thread worthy

Hi bakers again :),
i managed to do it another way.

These two function provided below are the key for it. As you can see I
placed them inside of the app_controller.php



class AppController extends Controller {

function htmlchars($data) {

if (empty($data)) {
return $data;
}

if (is_array($data)) {
foreach ($data as $key => $val) {
$data[$key] = $this->htmlchars($val);
}
return $data;
}
else {
$patterns = array("/\&/", "/%/", "//", '/"/', 
"/'/", "/\
(/", "/\)/", "/\+/", "/-/", "/ä/", "/Ä/", "/ö/", "/Ö/", "/ü/", "/Ü/");
$replacements = array("&", "%", "<", ">", 
""",
"'", "(", ")", "+", "-", "ä", "Ä",
"ö", "Ö", "ü", "Ü");
$data = preg_replace($patterns, $replacements, $data);
return $data;
}
}

function unhtmlchars($data) {

if (empty($data)) {
return $data;
}

if (is_array($data)) {
foreach ($data as $key => $val) {
$data[$key] = $this->unhtmlchars($val);
}
return $data;
}
else {
$patterns = array("/&/", "/%/", "//", "/
"/", "/'/", "/(/", "/)/", "/+/", "/-/", "/
ä/", "/Ä/", "/ö/", "/Ö/", "/ü/", "/Ü/");
$replacements = array("&", "%", "<", ">", '"', "'", 
"(", ")", "+",
"-", "ä", "Ä", "ö", "Ö", "ü", "Ü");

$data = preg_replace($patterns, $replacements, $data);
return $data;
}
}

}

So if i retrieve any data for a view i simply do $cleandata = $this-
>htmlchars($this->data); and use $cleandata for now on.
The same with unhtmlchars().



The only problem i have now is the following.

Lets say I have an edit form with a "Name" field.
If the Name contains no special chars like "ä","ö","ü" etc. the value
of the field is filled automatically through the $form helper, but if
the Name contains one of those special chars, the field is not filled.

I don't know how to solve this.

Please help me as I'm stuck here.

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



Re: CakePHP on IIS 6 - open_basedir restriction in effect

2008-08-28 Thread RichardAtHome

After more digging, I've managed to get rid of the open base dir error
(comment out open_basedir setting in php.ini)

Now I have another issue...

Under Apache, the following code:


produces the following output:

/app/webroot/user_muses/foo.jpg

Under IIS, it breaks because the output is:

/index.php/app/webroot/user_muses/foo.jpg

And the images are broken.

Note: This only happens when I use Router::url(). If I use the built
in $html->image() to display images the urls are correct.

Obviously, I can't use $html->image() in this case as the images are
stored in a different location.

I get a similar problem when I try an embed a flash application too.

How do I remove index.php from the urls on IIS?

On Aug 26, 5:23 pm, RichardAtHome <[EMAIL PROTECTED]> wrote:
> After a bit of struggling, I've managed to get a CakePHP app running
> on IIS.
>
> I've running it without mod_rewrite so I followed the instructions in
> core.php and removed .htaccess files and uncommented the line:
>
>         Configure::write('App.baseUrl', env('SCRIPT_NAME'));
>
> I've installed my cake app into:
>
> c:\Inetpub\php_test\
>
> I'm getting an error in a couple of places in my code, along the lines
> of:
>
> Warning (2): file_exists() [function.file-exists]: open_basedir
> restriction in effect. File(/index.php/app/webroot/user_backgrounds/
> 1.xml) is not within the allowed path(s): (c:\Inetpub) [APP\views
> \elements\painter.ctp, line 133]
>
> Reading a bit further I've made the changes to /app/webroot/index.php
>
> /**
>  * The full path to the directory which holds "app", WITHOUT a
> trailing DS.
>  *
>  */
>         if (!defined('ROOT')) {
>                 define('ROOT', "\\Inetpub\\php_test");
>         }
> /**
>  * The actual directory name for the "app".
>  *
>  */
>         if (!defined('APP_DIR')) {
>                 define('APP_DIR', "\\Inetpub\\php_test\\app\\");
>         }
> /**
>  * The absolute path to the "cake" directory, WITHOUT a trailing DS.
>  *
>  */
>         if (!defined('CAKE_CORE_INCLUDE_PATH')) {
>                 define('CAKE_CORE_INCLUDE_PATH', "\\Inetpub\\php_test");
>         }
>
> What am I missing/doing wrong?
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: JQuery + JSON

2008-08-28 Thread David

The reason I suggested changing the Content-Type header to text/
javascript is that jQuery's .getJSON method sends an accept header of
text/javascript, and not text/x-json. You can see this in the dump of
the headers that the op attached to the message.

David


On Aug 27, 6:24 pm, clemos <[EMAIL PROTECTED]> wrote:
> Hi
>
> Maybe I'm missing something, but what he gets from his json queries is
> only headers, no content.
> So I guess his debug is already to 0, because otherwise the content
> would at least be filled with the "" in the
> end...
> From his first message, his problem is not about errors parsing the
> JSON object with javascript, but rather about empty JSON pages...
> That's why I advised him to put debug to 1 or 2, which is often what
> you should do when your output is empty, because blank often hides
> error messages...
>
> +++
> Clément
>
> On Wed, Aug 27, 2008 at 6:19 PM, [EMAIL PROTECTED]
>
> <[EMAIL PROTECTED]> wrote:
>
> > Add this to your view, because JSON can't be parsed if it presents any
> > kind of text besides the JSON string and Cake presents it whe
> > debugging is set to 2 or 1
> > In your view
> >  >        echo $javascript->object($post);
> > Configure::write('debug', 0);
> > ?>
>
> > This will disable the output from the debugging
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Saving HABTM, stopped working for me since 1.2rc2.

2008-08-28 Thread [EMAIL PROTECTED]

Hi,
I have noticed that saving HABTM records have stopped working for me.
(Saving an Article and which Categories it should be linked to for
example)

Cake1.2rc2 (and the latest nightly) does no longer save my array
structure as before. I have not found anything in the API, Cookbook or
here to show me what might have changed or what I am doing wrong. I
found one thread where one guy had found his answer in the test-file
(supposedly the test-file for Model) but no more info was given.

Before:
$data
  Article
id
title

  Category
Category
  2
  6

That is: $data['Category']['Category'] = $array_of_ids

This does not work anymore. This is true for two separate codebases,
one where I have not touched the affected models in a while. This
makes me think it is not just a but I have managed to introduce but
something subtile that has changed that affects my accosiations.
The API suggests that saveAll() is now the method to use when saving
associated data.
testSaveHabtm() in model.test.php has the same structure as I have (as
far as I can tell):
Tag=>Tag=>array_of_ids

Has something changed that now requires me to define the HABTM in more
detail than simply the name of the model?

Any ideas?

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



Re: Please help me

2008-08-28 Thread lacithetemplar

no, I have completely different directory structure on my hosting.
root___logs
 |___sub//directory for subdomains
 |___web   //main directory for website

Is there someone, who has experience with cakephp on websupport.sk
hosting?

Dardo Sordi Bogado wrote:
> > the main problem is, that I don't have an accses to configuration
> > files on the hosting, where I run my pages
>
> Usually you don't need that.
>
> Typical shared hosting setup:
>
> /home/account/
>   public_html <--- configured as document root
> by hosting, put all the files in app/webroot here
>   cake <--- cake core
>   app <--- your app
>
> Then edit public_html/index.php and adjust the constants.
>
>
> > On Aug 27, 1:29 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> >> Try with a production setup: cake, app and webroot sepparated.
> >>
> >> On Tue, Aug 26, 2008 at 7:43 PM, lacithetemplar
> >>
> >>
> >>
> >> <[EMAIL PROTECTED]> wrote:
> >>
> >> > no, problem still remains :(
> >>
> >> > On Aug 26, 3:31 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> >> >> may be try
> >>
> >> >> 
> >> >> RewriteEngine on
> >> >> RewriteRule/$ / [L]
> >> >> RewriteRule^$/app/webroot/[L]
> >> >> RewriteRule(.*) /app/webroot/$1[L]
> >> >> 
> >>
> >> >> 2008/8/26 lacithetemplar <[EMAIL PROTECTED]>
> >>
> >> >> > so, can you help me to configure my .htaccess file?
> >> >> > here is current configuration:
> >>
> >> >> > 
> >> >> >   RewriteEngine on
> >> >> >   RewriteRule^$ app/webroot/[L]
> >> >> >   RewriteRule(.*) app/webroot/$1 [L]
> >> >> > 
> >>
> >> >> > I don't know, where is problem, because at my localhost at home, it
> >> >> > works fine
> >>
> >> >> > On Aug 26, 1:47 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> >> >> > > Then, your .htaccess are screwed, try accessing directly:
> >> >> >http://mpw-test.netlife.sk/index.phpitgivesthe right page.
> >>
> >> >> > > Check your setup. This may help:
> >> >> >http://book.cakephp.org/view/32/installation
> >>
> >> >> > > On Tue, Aug 26, 2008 at 5:05 AM, lacithetemplar
> >>
> >> >> > > <[EMAIL PROTECTED]> wrote:
> >>
> >> >> > > > it is fresh installation of cakephp, no changes in routes.php, 
> >> >> > > > only
> >> >> > > > configured database.php
> >>
> >> >> > > > On Aug 25, 4:05 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> 
> >> >> > > > wrote:
> >> >> > > >> It seems like you screwed the routes, show us your
> >> >> > APP/config/routes.php
> >>
> >> >> > > >> On Mon, Aug 25, 2008 at 6:41 AM, lacithetemplar
> >>
> >> >> > > >> <[EMAIL PROTECTED]> wrote:
> >>
> >> >> > > >> > Is here someone, who knows, how can I solve this problem with
> >> >> > webroot
> >> >> > > >> > athttp://mpw-test.netlife.sk/?
> >> >> > > >> > thanks- Hide quoted text -
> >>
> >> >> > > >> - Show quoted text -- Hide quoted text -
> >>
> >> >> > > - Show quoted text -- Hide quoted text -
> >>
> >> >> - Show quoted text -- Hide quoted text -
> >>
> >> - Show quoted text -
> > >
> >
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Solved -> Re: Create links to navigate back to last visited page

2008-08-28 Thread draikin

Thank you all for posting solutions. I solved the problem with the JS
solution from clemos. It works like I want and I will dare that some
users of my applikation don't like JS.

draikin


On 25 Aug., 14:54, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
> The Formhelper does NOT need JS :)
>
> As fot the OP problem - you can save the actual page to the the session.
> If there is a page in session - get the url, if its different then the
> actual - save the actual (you have the one for  back in the var).
> It has drawbacks but its closest you can get.
>
> --
> Marcin Domanskihttp://kabturek.info
>
> On Mon, Aug 25, 2008 at 12:07 PM, clemos <[EMAIL PROTECTED]> wrote:
> > Hidraikin
>
> > I think we can consider CakePHP actually "needs" Javascript.
> > Of course you can use Cake to develop javascript-free apps, but lots
> > of Cake features, for example some of the FormHelper functionnalities,
> > actually require javascript...
>
> > You could use a code that use both, like:
> > controller: $this->set("referer",$this->referer());
> > view: $html->link("go
> > back",$referer,array('onclick'=>'window.history.back(); return
> > false'));
> > Like so, Javascript enabled browser will use the Javascript function,
> > while Javascript disabled browser will use the $referer href.
> > Of course, if the browser supports neither js nor referer, the link
> > will likely fail; but it's still the most widely compatible way I can
> > imagine...
> > Note that the JS function and the referer link may not lead to the
> > exact same page; this needs to be well tested to see if there are
> > differences...
> > Well, you may also force the referer to be passed through named
> > variables (something like : $html->link("go
> > there","/controller/action/whatever/referer:".urlencode($this->here));
> > ), but you'll need to do it for each link, and it'll mess up your
> > "nice urls" a little bit...
>
> > ++
> > Clément
>
> > On Fri, Aug 22, 2008 at 4:02 PM,draikin<[EMAIL PROTECTED]> wrote:
>
> >> Hi clemos,
>
> >> thank you for your solution that I read also. But just like $this-
> >>>referer() doesn't work for all browsers javascript doesn't work for
> >> all users, as there are some users who don't like javascript. But if
> >> there is a need for javascript in cakephp apps anyway (i don't know if
> >> this is so), your solution is the easiest.
>
> >>draikin
>
> >> clemos schrieb:
> >>> Maybe I didn't understand your problem, but ...
> >>> Why don't you give a try to my good old plain javascript solution ?
>
> >>> go back
>
> >>> The link above will get you back just like your "back" browser button 
> >>> would...
> >>> You can even go back further with "window.history.go(-10)" (ten pages 
> >>> back)
> >>> No Cake, No PHP, just simple javascript...
>
> >>> $this->referer() doesn't work for all browsers, cause the referer must
> >>> actually be sent by the client (IE doesn't seem to send it all the
> >>> time).
> >>> +++
> >>> Clément
>
> >>> On Thu, Aug 21, 2008 at 7:35 PM,draikin<[EMAIL PROTECTED]> wrote:
>
> >>> > Thank you for your response. Yes, thats what I'm looking for. But the
> >>> > problem is that $this->referer() seems not to work. So I will test the
> >>> > bread crumb feature from the HTML helper.
>
> >>> >draikin
>
> >>> > teknoid schrieb:
> >>> >> You are probably looking for something like $this->referer()
>
> >>> >> Also there is a bread crumbs feature in the HTML helper, for something
> >>> >> more robust.
>
> >>> >> On Aug 21, 10:35 am,draikin<[EMAIL PROTECTED]> wrote:
> >>> >> > Hi,
>
> >>> >> > i'am searching for a solution for the following problem. I want to
> >>> >> > have a link on the pages of my little cakePHP app to allow to go back
> >>> >> > to the page where i come from. So as the back-button of the browser.
> >>> >> > For example: I search for a subset of my database entries and get a
> >>> >> > page with a table containing the results. Now i want to edit one 
> >>> >> > entry
> >>> >> > and so i klick on the 'edit' link in the first column of the table. I
> >>> >> > edit the entry, save it and want to go back to the result page. If i
> >>> >> > dont want to edit, i will have a link on the edit page to go back to
> >>> >> > the result page.
> >>> >> > Did i describe the problem properly?
> >>> >> > Can anyone give me a hint? I tried to find a solution, but i can't
> >>> >> > find what i need.
>
> >>> >> > Many thanks,
> >>> >> >draikin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Handling HTML special chars from user generated content ( e.g. forms)

2008-08-28 Thread worthy

Hi bakers,
as by the last week i am really getting into CakePHP and enjoy the
easeness of the creation process.

But i have one simple problem.
In every form of the project where users can input data, they can for
example input ( ä,ö,ü, é... and special chars like %§"%/ or whatever)

So i want to write a system function that converts all these chars to
their html form. That is for example a "ä" becomes "ä" etc.

To approach this i already wrote a function that does this exactly:

function htmlizeArray(&$txtArray) {
if (is_array($txtArray)) {
foreach ($txtArray as $key => &$val) {
htmlizeArray($val);
}
}
else {
$txtArray = htmlentities($txtArray);
}
}

So now i have to know where to put this function in the source to
access it from every controller that i have made.
Because in the controllers where i anyhow deal with posted form data i
want to htmlize the data.

All the form data from a specific view is in the controller accessed
by $this->data.

So what i want to do now is to htmlize it with

htmlizeArray($this->data);

So maybe you can help me out with it.

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



Re: Display Images off document root

2008-08-28 Thread Andrewk


Hello,
I encounter the same problem, when I trying to retrieve images via
Media view, not all images displayed, for example I have 20 thumbnails
images on the page an only 8~12 first displayed, and on others
displayed alt text.
In my application I am using cakephp Authentication component and when
I trying to display not loaded  thumbnails images, by pressing web
browser refresh button I redirected to login page  to perform
Authentication.
Moreover number of displayed images on page varies from browser to
browser ;
I checked in Opera , Firefox and IE6.

Anyone have the solution?

On Aug 3, 10:16 am, gapiangco <[EMAIL PROTECTED]> wrote:
> Got it to work now! Hurray!
>
> What I did:
> 1. Created a layout for items/view (controller/action) which contains
> nothing but:
>         
>
> 2. In my items/view action I have:
>         function view($file = null) {
>                 // check if user/member is logged her
>                 // ...
>                 if ($file) {
>                         $this->layout = 'view_image';
>                         $this->view = 'Media';
>                         $params = array(
>                                 'id' => "{$file}.jpg",
>                                 'name' => $file,
>                                 'download' => false,
>                                 'extension' => 'jpeg',
>                                 'path' => 'items' . DS
>                         );
>                         $this->set($params);
>                 }
>         }
>
> And yeah it now displays the images. But I did encounter some problem.
> Not all images are displayed. Like out of 18 images per page, 8 of
> them doesn't show up.
>
> Trying the right-click>properties on Firefox shows:
> Location:http://localhost/projects/tattoo/items/view/z0g7KSoXbu1217687984
> Width: 100px
> Height: 100px
> Size of file: Unknown (not cached)
> Alternate text: blank
>
> Anyone can help?
>
> On Aug 3, 1:52 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Sun, Aug 3, 2008 at 10:28 AM, gapiangco <[EMAIL PROTECTED]> wrote:
>
> > > Took a second look and yeah JPEG and JPG are there. My bad. The
> > > example from the book was intended for downloading. What if from the
> > > example URL
>
> > > mysite.com/designs/view/$slug
>
> > > where:
> > > designs: controller
> > > view: action
> > > $slug: slug name of the design category
>
> > > And from that URL, a list of images available under that specified
> > > category will be displayed. Something like a gallery of images. How to
> > > use MediaView on such? Would be nice to have more examples on the
> > > cookbook :-(
>
> > Well - step back for a while or step out, take a deep breath and think!
>
> > Do you know how to accomplish the above without Media View? If yes then all
> > you need to do is replace the links to images with the new controller call
> > it say protectedimages and action called show
>
> > You will have to do a certain amount of programming in the show action which
> > will ensure that the person currently logged can see unwatermarked image or
> > not
>
> > I presume you are missing the trick that the img src will contain a URL to a
> > controller action and some param rather than the URL to the image itself.
>
> > If you want to create conditional links to image itself then you will have
> > to write your own helper.
>
> > HTH
>
> > Tarique
>
> > --
> > =
> > Cheesecake-Photoblog:http://cheesecake-photoblog.org
> > PHP for E-Biz:http://sanisoft.com
> > =- Hide quoted 
> > text -
>
> - Show quoted text -

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



Re: Migration from CakePHP 1.1.x to CakePHP 1.2.x - how to acces controller component from view?

2008-08-28 Thread Bernhard J . M . Grün

Hi!

This is quite easy. It is just
$account = $this->Session->read('Account');


On 28 Aug., 07:35, Pizgin <[EMAIL PROTECTED]> wrote:
> Hi! Before was
>
> $account = $this->controller->Session->read('Account');
>
> On CakePHP 1.2.x this not work. Have error:
>
> Undefined property:  View::$controller [APP/views/elements/cart.thtml,
> line 3]
>
> Tell me please how i can acces to controller component from the view?

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



How do you specify custom properties in a CakePHP model?

2008-08-28 Thread trustfundbaby

How do you specify custom properties in a CakePHP model?
I'm trying to do this, but there is no sample code any where that
shows how its done, can someone point me in the right direction?

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



Re: textbook find() query just doesn't work

2008-08-28 Thread Christian

Thanks for the help so far, Martin.

Sadly.. it just won't go!
I've cleaned the cache, reinstalled a fresh/latest version of cake
1.2, made every little naming convention/association explicitly.. but
no avail.. same problem. It just puts the Game.status=1 into the WHERE
clause with no join.

in a mysql terminal, i can say "select * from game_players join games
where game_players.id=1 AND games.status=1;" and it will return me
what i want with no error

Would it trouble you, or anyone, to give me a chunk of sample code, or
their own stripped down code of model/controllers that are 'belongsTo'
associated that result in a working join?
There has to be something ridiculous or stupid that I'm not doing.

I refuse to resort to a custom query for such simple functionality!
Christian

On Aug 25, 4:40 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I set my Debug to 2 to have a look at when Cake does joins in my app.
> hasOne does a JOIN
> belongsTo does a JOIN
> hasMany just selects on the related table with a WHERE clause
> HABTM does a few queries and things.
>
> So, like you say, your find should work from $this->GamePlayer->find()
> since it belongs to a Game.
>
> This is all I can think of (all extreme longshots):
> Trash all cache files. (in case Cake reads the schema form cache and
> it is not up to date)
> Download Cake again (just to make sure you are not running a nightly
> with a bug in it of some really rare problem with the files)
> Change the name of the "missing" field in MySQL. (No rational reason
> for doing this really)
> Make the association very explicit and define all the parameters you
> can for Game (in case something does not match Cakes conventions)
>
> good luck to you
> /Martin
>
> On Aug 21, 11:54 pm, Christian <[EMAIL PROTECTED]> wrote:
>
> > Sorry, my mistake. A lot of tinkering and testing i copied the wrong
> > things
> > Game->find() says it can't find GamePlayer.user_id column which makes
> > sense now because it doesn't do a join.
>
> > however still having the problem where GamePlayer->find() says it
> > can't find Game.status column, so still no join.
>
> > my setup is as follows (i just verified to make sure i didn't slip up
> > on simple naming):
>
> > class GamePlayer extends AppModel {
> >         var $name = 'GamePlayer';
> >         var $belongsTo = array (
> >                         'User',
> >                         'Game'
> >                                         );
>
> > }
>
> > database_name  (columns):
> > games (id int(10) unsigned, status int(1),...)
> > game_players (id int(10) unsigned, game_id int(11),...)
>
> > another point, I'm doing this find() from within the games_controller.
> > However i do have       var $uses = array('Game','User','GamePlayer',
> > 'Rule', 'Weapon'); in the controller...

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



Re: Acl and Auth at record level with crud mode

2008-08-28 Thread aranworld

You can add this to your UsersController:

function __checkUsersOwnRecord($recordId = null) {
if( $this->Auth->user('id') == $recordId ){
return TRUE;
} else {
return FALSE;
}
}

Give all users access to users/edit ... however, before you do any
edit functionality first check that the logged in user is the same
user as the record being edited.

The basic answer is that since the Auth Component does not look at the
record ID when it verifies access, then you cannot rely on it to
automatically handle record level access, and you therefore have to
create such logic on your own.

On Aug 12, 5:02 am, [EMAIL PROTECTED] wrote:
> I have the same problem, but let us take a look to the debug messages:
> (we say that user model must behave as "requester", and in the model
> it's written
> var $actsAs = array('Acl' => array('type'=>'requester'));
> )
> So the debug is
>
> SELECT `Aro`.`id`, `Aro`.`parent_id`, `Aro`.`model`,
> `Aro`.`foreign_key`, `Aro`.`alias` FROM `aros` AS `Aro` LEFT JOIN
> `aros` AS `Aro0` ON (`Aro`.`lft` <= `Aro0`.`lft` AND `Aro`.`rght` >=
> `Aro0`.`rght`) WHERE `Aro0`.`model` = 'User' AND `Aro0`.`foreign_key`
> = 29 ORDER BY `Aro`.`lft` DESC
>
> here 29 is id of the user requesting some permissions
> ok, works perfectly
>
> then
>
> SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`,
> `Aco`.`foreign_key`, `Aco`.`alias` FROM `acos` AS `Aco` LEFT JOIN
> `acos` AS `Aco0` ON (`Aco0`.`alias` = 'Users') WHERE `Aco`.`lft` <=
> `Aco0`.`lft` AND `Aco`.`rght` >= `Aco0`.`rght` ORDER BY `Aco`.`lft`
> DESC
>
> Here you see `Aco0`.`alias` = 'Users'!!! but it's not true, i do not
> want to request permissions on the whole users group, i'm interested
> only in
> aco with alias, say, User::29, or, i would say it must be better, in
> aco with foreign_key=29
>
> so then as a consequence we have
>
> SELECT `Permission`.`id`, `Permission`.`aro_id`,
> `Permission`.`aco_id`, `Permission`.`_create`, `Permission`.`_read`,
> `Permission`.`_update`, `Permission`.`_delete`, `Aro`.`id`,
> `Aro`.`parent_id`, `Aro`.`model`, `Aro`.`foreign_key`, `Aro`.`alias`,
> `Aro`.`lft`, `Aro`.`rght`, `Aco`.`id`, `Aco`.`parent_id`,
> `Aco`.`model`, `Aco`.`foreign_key`, `Aco`.`alias`, `Aco`.`lft`,
> `Aco`.`rght` FROM `aros_acos` AS `Permission` LEFT JOIN `aros` AS
> `Aro` ON (`Permission`.`aro_id` = `Aro`.`id`) LEFT JOIN `acos` AS
> `Aco` ON (`Permission`.`aco_id` = `Aco`.`id`) WHERE
> `Permission`.`aro_id` = 5 AND `Permission`.`aco_id` = (1) ORDER BY
> `Aco`.`lft` desc
>
> where we have correct aro_id and incorrect aco_id
>
> so it seems User model must behave as a "requester" and as a
> "controlled", but you cannot define such a behaviour (at least i don't
> know how)
>
> reasonable solutions are to check permissions in such a situations
> yourself (but i cannot switch off auto check!), to define additional
> model like profile or to make some correction in some cake files
> (still don't know where)
>
> any suggestions?
>
> On Aug 8, 6:31 am, KoPanda <[EMAIL PROTECTED]> wrote:
>
> > Yes, I'm using "crud" mode in Auth. The Aro and Aco trees are like
> > this.
>
> > Aro
>
> > users
> >   |- user1
> >   |- user2
> >   |- administrators
> >   |- admin
>
> > Aco
>
> > Site
> >   |- Users
> >   |-user1
> >   |-user2
>
> > The permissions were setup like this,
>
> > cakeaclgrant administrator Site *
> > cakeaclgrant users Site read
>
> > And then in the register() action after saving the user data,
>
> > // User model is define with $actAs = array('Acl' => 'requester') so
> > the Aro is automatically handled
> > // some code to create the aco and set the $alias to the username
> > $this->Acl->allow($alias, $alias, array('read','update'));
>
> > For example, ARO user1 would have "read" and "update" permission to
> > ACO user1. I suppose Auth would check through the tree and see if ARO
> > user1 can update ACO user1 and then allow edit() action when I do /
> > users/edit/5 (suppose user1 has id:5). But that's not the case. It
> > kicks me back to /users/view/5, as ARO user1 has "read" permission to
> > ACO Users. If I want to make /users/edit/5 runs as I wish, I have to
> > grant "update" permission to Users controller, which eventually let
> > all users to edit any records of other users.
>
> > Well, I know I can do an extra check() in edit() action and see if the
> > current user has update permission to the record but I don't
> > understand why the Auth component acts like this. Is my approach
> > wrong? OrAcland Auth are not supposed to do the work like this?
>
> > On Aug 8, 2:29 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > You have to set (or use) the right mode to Auth, in this case "model"
> > > or "crud".
>
> > > On Aug 7, 12:02 pm, KoPanda <[EMAIL PROTECTED]> wrote:
>
> > > > I'm trying to develop a community website usingcrudmode on Auth
> > > > component. User profiles can be viewed by all users while only be
> > > > edited by the profile owner and administrator. I followed anAcl
> > > > tu