Re: help me about association query

2010-03-17 Thread vcrack
I did try your code but it's return all data business and related data
business..
I want to find all category and in array category contain all related
business but have X city..

my model..
models/business.php
class Business extends AppModel{
  var $name  = 'Business';

  var $belongsTo = array('Category','BusinessContact','Mall');

  var $hasAndBelongsToMany = array(
'User' =>
array(
'className' => 'User',
'joinTable' =>
'favorites',
'foreignKey' =>
'business_id',
'associationForeignKey' =>
'user_id'
)
);
}

models/category.php
class Category extends AppModel{
  var $name = 'Category';

  var $hasMany = array('Business');
  }

i still need your help.. thanks, :)

On Mar 18, 1:14 pm, "Alan Asher"  wrote:
> I might need to see your models but you probably need to do something like
> this.
>
> $this->Business->find('all,array('conditions'=>array('Business.city'=>$city)
> ,'contain'=>array('Category')));
>
> The contain clause will make sure to limit your search results to have only
> categories (as well as the businesses) in the results.
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
>
> Of vcrack
> Sent: Wednesday, March 17, 2010 10:23 PM
> To: CakePHP
> Subject: help me about association query
>
> my code
> I have model Business and model category. i want to find business for
> all category but from X city..
>
> $this->Business->Category->find('all', array('conditions' =>
> array('Business.city' => $city)));
>
> error message : SQL Error: 1054: Unknown column 'Business.city' in
> 'where clause'
>
> I'm sure in column city in table model business is exist.. anyone can
> help mer?
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to theGoogleGroups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

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

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


RE: help me about association query

2010-03-17 Thread Alan Asher
I might need to see your models but you probably need to do something like
this.

$this->Business->find('all,array('conditions'=>array('Business.city'=>$city)
,'contain'=>array('Category')));

The contain clause will make sure to limit your search results to have only
categories (as well as the businesses) in the results.



-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of vcrack
Sent: Wednesday, March 17, 2010 10:23 PM
To: CakePHP
Subject: help me about association query

my code
I have model Business and model category. i want to find business for
all category but from X city..

$this->Business->Category->find('all', array('conditions' =>
array('Business.city' => $city)));

error message : SQL Error: 1054: Unknown column 'Business.city' in
'where clause'

I'm sure in column city in table model business is exist.. anyone can
help mer?

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

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

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

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


help me about association query

2010-03-17 Thread vcrack
my code
I have model Business and model category. i want to find business for
all category but from X city..

$this->Business->Category->find('all', array('conditions' =>
array('Business.city' => $city)));

error message : SQL Error: 1054: Unknown column 'Business.city' in
'where clause'

I'm sure in column city in table model business is exist.. anyone can
help mer?

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

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


Re: Model association through user_id

2010-03-17 Thread abocanegra
Thank you for the response. I was able to get it working finally by
the following code int he postscontroller under the add function.

$users = $this->Post->User->find('list', array('fields' =>
array('User.username')));
$this->set(compact('users'));

Thanks

On Mar 17, 7:27 pm, cricket  wrote:
> In User model:
>
> var $displayField = 'username';
>
> Then find('list') will return an array as id => username
>
> On Mar 17, 8:50 pm,abocanegra wrote:
>
> > I am trying to learn more about associating through models. My current
> > issue is that I am attempting to design the post add function that I
> > created following the tutorial so that I can select the user by
> > username rather than user_id. I want to have the value of the drop
> > down be user_id and the option be username. I have changed the add
> > function in controller to find('all') but that only gives me
> > everything in the users database. I have repeatedly failed to be able
> > to isolate the username from this.  Below is some of the code I have
> > been playing with.
>
> > add view
> >  >                 echo $this->Form->input('user_id');
> >                 echo $this->Form->input('title');
> >                 echo $this->Form->input('body');
> >         ?>
>
> > add function from controller
>
> >  function add() {
> >                 if (!empty($this->data)) {
> >                         $this->Post->create();
> >                         if ($this->Post->save($this->data)) {
> >                                 $this->Session->setFlash(sprintf(__('The %s 
> > has been saved', true), 'post'));
>
> >                                 $this->redirect(array('action' =>
> > 'index'));
> >                         } else {
> >                                 $this->Session->setFlash(sprintf(__('The %s 
> > could not be saved. Please, try again.',
>
> > true), 'post'));
> >                         }
> >                 }
> >                 $users = $this->Post->User->find('list');
> >                 $this->set(compact('users'));
> >         }
>
> > Belongsto from Model
>
> >         var $belongsTo = array(
> >                 'User' => array(
> >                         'className' => 'User',
> >                         'foreignKey' => 'user_id',
> >                         'conditions' => '',
> >                         'fields' => '',
> >                         'order' => ''
> >                 )
> >         );
>
> > Any advice for a clean way to pull data from the Users table from
> > within the Posts add view would be appreciated.

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

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


Re: Model help

2010-03-17 Thread Jeremy Burns
The secret lies in setting up your models correctly. You also will find life 
easier if you use the field name 'name' instead of 'label'. Doing this means 
that you can easily create drop downs populated with 'id' and 'name' where 
'name' is the displayed value. This is the default Cake convention.

I'd say your models ought to look something like this:

Item:
var $belongsTo = array(
'City' => array(
'className' => 'City',
'foreignKey' => 'city_id'
),
'Category' => array(
'className' => 'Category',
'foreignKey' => 'category_id'
)
);

City:
var $hasMany = array(
'Item' => array(
'className' => 'Item',
'foreignKey' => 'city_id'
)
);

Category:
var $hasMany = array(
'Item' => array(
'className' => 'Item',
'foreignKey' => 'category_id'
)
);

This set ups the joins between your tables.

I'd also strongly recommend using recursion and the containable behaviour as it 
gives you tremendous control over exactly what gets returned. I wouldn't leave 
home without it now, and place it in my AppModel:

var $actsAs = array('Containable');
var $recursive = -1;

Then your SQL statement (when called from within the items controller) becomes 
a find:

$variable = $this->Item->find(
'all',
array(
'fields' => array(
'City.id', 'City.name'
),
'contain' => array(
'Category' => array(
'Category.label' => 'Doctors' // mostly going 
to be a variable, e.g. $categoryLabel
),
'City' => array(
'City.label' => 'Boston' // mostly going to be 
a variable, e.g. $cityLabel
)
)
)
);


I haven't tested that - just typed it here - but it ought to work.


Jeremy Burns
jeremybu...@me.com


On 18 Mar 2010, at 01:27, Andrew wrote:

> Hello,
> 
> Thank you for your time, I am a new user of CakePHP. I recently found
> CakePHP and am still trying to get used to the MVC architecture. (By
> the way, it's brilliant). However I'm still getting used to
> reformatting my SQL into cakephp.
> 
> My question is as follows. I have an SQL statement that (simplified)
> is like the following:
> 
> select i.name
> from item i, city c, category ca
> where ca.id = i.category_id
> and c.id = i.city_id
> and ca.label = "Doctors"
> and c.label = "Boston"
> 
> 
> I have been able to create step one --
> 
> $this->set('items', $this->Item->findAllByCategoryId('1'));
> 
> And now I'm totally stuck, as this is the first model I've created. I
> had a look through the model documentation but couldn't see anywhere
> that dealt with SQL from two tables :-(
> 
> Thanks
> Andrew
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

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

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


Re: PHP 5.3 open short tag does't working on cakePHP 1.2.6

2010-03-17 Thread LunarDraco
Not sure what editors your using but as soon as I type  leaving my cursor ready to enter php
commands.
I can't remember the last time I worried about typing to many chars.
Other than posts and email! ;)
I'm sure that some may complain that eclipse is a bloated IDE for
simple php editing, and they may be right. But I spend most of my day
in code (php, java, html, css, javascript, etc) and only launch the
app once a day at most, if for some reason I shut my machine down.


On Mar 16, 11:31 am, cricket  wrote:
> On Mar 16, 11:55 am, Marcelo Andrade  wrote:
>
>
>
> > The problem is not only the 6 more chars, but as open short tags are
> > deprecated (and AFAIK will be removed in php 6), if you insist using
> > it, you'll face this kind of problem when deploying you application in
> > other servers.
>
> This is the first I've heard that they are deprecated. That bites! I
> rather prefer them than the alternative. But I agree that they're a
> Bad Idea for any code that will not be under one's control.
>
> I don't use " use the former, actually.
>
> As for complaints about them making it more difficult to see, the
> problem would be fixed with better syntax highlighting. They appear
> just fine for me.
>
> For anyone who needs to convert to the ugly, full syntax, do not reach
> for regular expressions. That'll be a pain for anything other than the
> simplest files. A colleague once did this successfully using the
> methods described in the comments here:
>
> http://stackoverflow.com/questions/684587/batch-script-to-replace-php...

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

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


Re: Ideas to manage open voting

2010-03-17 Thread LunarDraco
I'd say without a login that is verified against a real email with a
postback token verification there is no real way to do this.
You could store a cookie in the browser, which could be cleared by the
user and re-vote.
You could tie it to the IP like you suggest, but the IP your server
see's is only the ip of the publicly visible router. There may be many
machines behind this one IP, And besides that its not the computer
thats voting its a person.
You could ask for personal information which everyone will just lie
about.

I've seen many voting designs. I've never heard of anyone trying to do
it open successfully. Every valid voting system has some way to
validate the user is real before they allow the vote.

I'd say if your really going to go down this path, associate the vote
with the IP address and a time duration say 1 day or 12 hours. That
would at least take care of someone scripting the vote. But you may
miss out on some votes and hopefully most people would not be
interested enough in sabotaging your results to put the effort into
visiting the vote every day.


On Mar 17, 2:04 pm, Amit  wrote:
> I'm working on a site that's going to let people vote on submissions.
> To encourage interaction I want to let anonymous users vote, but I
> still want to limit unique visitors to one vote. I know I won't be
> able ensure 100% adherence unless I require some sort of login, but
> allowing for this what should I check to see if a person has already
> voted?
>
> Is 1 vote/ip address good enough? Is there anything else should I log/
> track to prevent 1 person from voting multiple times (knowing full
> well that since it's open voting I can't stop every scenario)?

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

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


Model Associations - just feels wrong

2010-03-17 Thread TheHerk
Here is a link to a screenshot of a class diagram I am working on,
with noted model associations. There are several relationships in the
diagram that feel wrong to me. The one in the diagram that illustrates
this is between ZipLocation and State. In this case, state is
enumerated in its own table. For some reason, to me, it seems strange
that  ZipLocation, the parent, is belongsTo. I keep thinking in my
head, “Each ZipLocation has one associated State,” but it doesn't seem
to work that way. There are several more instances of this dilemma,
but they are just the same.

http://i8.photobucket.com/albums/a24/atomickeg/public/classes.png

Does this look remotely correct?

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

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


Model help

2010-03-17 Thread Andrew
Hello,

Thank you for your time, I am a new user of CakePHP. I recently found
CakePHP and am still trying to get used to the MVC architecture. (By
the way, it's brilliant). However I'm still getting used to
reformatting my SQL into cakephp.

My question is as follows. I have an SQL statement that (simplified)
is like the following:

select i.name
from item i, city c, category ca
where ca.id = i.category_id
and c.id = i.city_id
and ca.label = "Doctors"
and c.label = "Boston"


I have been able to create step one --

$this->set('items', $this->Item->findAllByCategoryId('1'));

And now I'm totally stuck, as this is the first model I've created. I
had a look through the model documentation but couldn't see anywhere
that dealt with SQL from two tables :-(

Thanks
Andrew

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

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


Re: Model association through user_id

2010-03-17 Thread cricket
In User model:

var $displayField = 'username';

Then find('list') will return an array as id => username

On Mar 17, 8:50 pm, abocanegra  wrote:
> I am trying to learn more about associating through models. My current
> issue is that I am attempting to design the post add function that I
> created following the tutorial so that I can select the user by
> username rather than user_id. I want to have the value of the drop
> down be user_id and the option be username. I have changed the add
> function in controller to find('all') but that only gives me
> everything in the users database. I have repeatedly failed to be able
> to isolate the username from this.  Below is some of the code I have
> been playing with.
>
> add view
>                  echo $this->Form->input('user_id');
>                 echo $this->Form->input('title');
>                 echo $this->Form->input('body');
>         ?>
>
> add function from controller
>
>  function add() {
>                 if (!empty($this->data)) {
>                         $this->Post->create();
>                         if ($this->Post->save($this->data)) {
>                                 $this->Session->setFlash(sprintf(__('The %s 
> has been saved', true), 'post'));
>
>                                 $this->redirect(array('action' =>
> 'index'));
>                         } else {
>                                 $this->Session->setFlash(sprintf(__('The %s 
> could not be saved. Please, try again.',
>
> true), 'post'));
>                         }
>                 }
>                 $users = $this->Post->User->find('list');
>                 $this->set(compact('users'));
>         }
>
> Belongsto from Model
>
>         var $belongsTo = array(
>                 'User' => array(
>                         'className' => 'User',
>                         'foreignKey' => 'user_id',
>                         'conditions' => '',
>                         'fields' => '',
>                         'order' => ''
>                 )
>         );
>
> Any advice for a clean way to pull data from the Users table from
> within the Posts add view would be appreciated.

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

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


Model association through user_id

2010-03-17 Thread abocanegra
I am trying to learn more about associating through models. My current
issue is that I am attempting to design the post add function that I
created following the tutorial so that I can select the user by
username rather than user_id. I want to have the value of the drop
down be user_id and the option be username. I have changed the add
function in controller to find('all') but that only gives me
everything in the users database. I have repeatedly failed to be able
to isolate the username from this.  Below is some of the code I have
been playing with.

add view
Form->input('user_id');
echo $this->Form->input('title');
echo $this->Form->input('body');
?>

add function from controller

 function add() {
if (!empty($this->data)) {
$this->Post->create();
if ($this->Post->save($this->data)) {
$this->Session-
>setFlash(sprintf(__('The %s has been saved', true), 'post'));
$this->redirect(array('action' =>
'index'));
} else {
$this->Session-
>setFlash(sprintf(__('The %s could not be saved. Please, try again.',
true), 'post'));
}
}
$users = $this->Post->User->find('list');
$this->set(compact('users'));
}

Belongsto from Model

var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);

Any advice for a clean way to pull data from the Users table from
within the Posts add view would be appreciated.

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

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


Re: different types of Users

2010-03-17 Thread nurvzy
You might find prefixes useful for your solution.  You can set
prefixes for actions and then only allow users of that group to access
those actions.  That wouldn't require the ACL and might be what you're
after (separation of group logic).

In 1.3 you'd set different prefixes in your core.php file (admin,
affiliate, member) then you'd define your actions so that only those
with that access level could view them:

admin_edit()  ... affiliate_edit() ... member_edit()

In your beforeFilter() you'd just check what action the user is
attempting to use and check if they are in the right group. Something
like:

function beforeFilter(){
  if(strpos($this->action,"admin") !== false){
return ($this->Auth->user('group') == 'admin');
  }
  if(strpos($this->action,"affiliate") !== false){
return ($this->Auth->user('group') == 'affiliate');
  }
  if(strpos($this->action,"member") !== false){
return ($this->Auth->user('group') == 'member');
  }
  return false;
}

Just an idea.  However, I would still suggest going with ACL in your
case.  I'm with WebbedIT --  ACL is too complex for my needs most of
the time, but from your description it sounds like your system could
become unwieldy without it.   I'd give ACL a look-see if I were you.

Hope that helps,
Nick
On Mar 17, 4:57 pm, cricket  wrote:
> Thanks, all, for the responses. I guess I should have mentioned that
> I've used ACL before, for an intranet to allow a company's affiliates
> log in and access many types of files. The requirement was that each
> group be shown (and be able to download) only certain folders/files. I
> used ACL and a tree structure (it was, essentially, a directory
> structure) and a record-level protection model. After *a lot* of
> frustration (my first stab at ACL), it worked very well. I should
> really get around to writing an article for the Bakery, as I don't
> think anyone else has published anything on doing this with Cake.
>
> That said, I'm leaning away from ACL for this project. The issue for
> me is not so much access control but modeling different user types.
> I've decided to store the model name & association_key in the users
> table, which is an approach that's worked well for me in similar (non-
> user) situations. Then I'll have separate Member, Affiliate, and
> Administrator models. Auth will keep that info in the session, so I
> can use that for access control after authentication has proceeded.
>
> On Mar 17, 3:33 pm, Martin Duris  wrote:
>
>
>
> > one of the key to understand is to know how ACL works - tree structure
> > - than its just question of time, to get everything work
>
> > 2010/3/17 Alejandro Gomez Fernandez :
>
> > > I'm new usign cake, but not designing information systems in different
> > > platforms, even web.
> > > I think the solution to your dilemma is using ACL. Yes, I know is at the
> > > beginning difficult to understood and implement, but it was designed
> > > speciffically to solve this problem. It permits you to assign differents
> > > roles to any person and to change this persons' role in any moment without
> > > any aditional work (more than select the roles in the ACL admin).
> > > Obviously there are many other workarounds to solve your specific problem,
> > > but the idea behind cake is re-usability. When you adjust an ACL (maybe at
> > > the beginning almost copy and paste from any book or tutorial) you can
> > > re-use it in any other project. When many more times you practice to
> > > develop/implement any technic, more close you are of master it.
> > > I hope this comment serves you to decide how to approach this problem.
>
> > > Regards,
>
> > > Alejandro Gomez Fernandez.
>
> > > El 16/03/2010 15:44, cricket escribió:
>
> > > I'm just starting on a site that will have several types of users and
> > > am uncertain of the best approach to take. I'd like to hear from
> > > others who have done something similar.
>
> > > The site will have the following user types:
>
> > > Administrators
> > > Members
> > > Affiliates
>
> > > Admins may or not be Members. Affiliates will not be Admins nor
> > > Members, but the fields for Affiliates and Members are quite similar.
> > > However, they may diverge further down the road.
>
> > > All should be able to log in, so I plan to, at least, have a users
> > > table with the passwords. But I'd prefer not to have every possible
> > > field stuffed in there and instead use separate models for each type.
> > > This seems like a good fit for role-based authentication, using
> > > Groups, but I think it would make more sense to have separate Member,
> > > Affiliate, and Administrator models.
>
> > > But, in that case, how should I go about registering what a newly-
> > > logged-in User is? One idea I had was to include "model" &
> > > "association_key" fields in the users table, then loading the info as
> > > needed (because it will be stored Auth's session array).
>
> > > So, how have others approached this? ExtendableBehavior?
> > > InheritableBehavior

Re: Complex form with fields belonging to fields that belong to the top table

2010-03-17 Thread Gillian
Me going at it from completely the wrong direction from the start
makes it make so much more sense.  Thank you!

On Mar 17, 4:18 pm, cricket  wrote:
> Grab a list of the types in the CompaniesController:
>
> $this->set('types', $this->Company->CompanyType->find('list'));
>
> That produces an array with the PK as key and the name as value. If
> your table column is not 'name' you should specify it in the
> CompanyType model:
>
> var $displayField = 'your_column_name';
>
> echo $form->input(
>         'CompanyType',
>         array(
>                 'type' => 'select',
>                 'multiple' => 'checkbox',
>                 'label' => 'whatever'
>         ),
>         $types
> );
>
> On Mar 17, 5:02 pm, Gillian  wrote:
>
> > I'm pretty new to Cakephp, so this could be rather simple and I'm just
> > missing it.
>
> > I'm attempting to set up a form that deals with a lot of tables and
> > models.  At the moment, I've set up the company model so that is
> > hasmany company types, and the company_types table so it belongsto
> > company.  And in the view I set it up as:
>
> > echo $form->input('CompanyType.0.type', array(
> >                         'type' => 'select',
> >                         'multiple' => 'checkbox',
> >                         'options' => array(
> >                                 'Paving' => 'Paving',
> >                                 'Rock Crushing And Screening' => 'Rock 
> > Crushing And Screening',
> >                                 'Sweeping' => 'Sweeping',
> >                                 'Grinding' => 'Grinding',
> >                                 'Cranes' => 'Cranes'
> >                         ));
>
> > Obviously, this alone isn't enough because I'm getting the error: SQL
> > Error: 1054: Unknown column 'Array' in 'field list' [CORE\cake\libs
> > \model\datasources\dbo_source.php, line 527]
>
> > What I'd prefer to do is explode the array in such a way so as to have
> > each option selected be separately entered into the company_type table
> > linked to the current company_id, rather than imploding it into a
> > single string.  Can anyone give me any pointers?

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

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


Re: Problem creating elements with "BAKE"

2010-03-17 Thread cricket
My guess is this is due to CLI version of PHP not having mysql
compiled in, or something like that.

On Mar 17, 7:03 pm, marcoR-IT  wrote:
> Hi,
> When I try to create some element with the "BAKE" command (Model, View
> or Controller), the following message is displayed:
> "Fatal error: Call to undefined function mysql_query() in /var/www/
> html/webroot/cake/libs/model/datasources/dbo/dbo_mysql.php on line
> 588"
>
> info:
> database controller: "mysql"
> CakePHP version: "CakePHP v1.3.0-RC1"
> (The same occurs with version 1.2.6.)
>
> I have another application created "manually" with code, into CakePHP
> that's working without problems, so I think the problem may not be
> associated with MySQL controller or the MySQL connection.
>
> Thanks in advance for your help
>
> Best regards,
> Marco

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

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


Re: htaccess issue

2010-03-17 Thread cricket
Assuming that your DocumentRoot is above /app, in the *top-
level* .htaccess (ie. outside the app dir), add a condition to not
rewrite the URL if the request is for the /dev dir:


   RewriteEngine on
   RewriteCond%{REQUEST_URI}!^/dev/
   RewriteRule^$ app/webroot/[L]
   RewriteRule(.*) app/webroot/$1 [L]


On Mar 17, 5:10 pm, "Dave"  wrote:
> I have my app in the folder root.
>
> Now i need to make a dev folder in the root also so it i type in site/dev i
> go to my dev folder not the cake
>
> /root
>     /app
>     /cake
>
> and
>     /dev
>
> How can i do this?
>
> Thanks
>
> Dave

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

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


Re: Complex form with fields belonging to fields that belong to the top table

2010-03-17 Thread cricket
Grab a list of the types in the CompaniesController:

$this->set('types', $this->Company->CompanyType->find('list'));

That produces an array with the PK as key and the name as value. If
your table column is not 'name' you should specify it in the
CompanyType model:

var $displayField = 'your_column_name';

echo $form->input(
'CompanyType',
array(
'type' => 'select',
'multiple' => 'checkbox',
'label' => 'whatever'
),
$types
);

On Mar 17, 5:02 pm, Gillian  wrote:
> I'm pretty new to Cakephp, so this could be rather simple and I'm just
> missing it.
>
> I'm attempting to set up a form that deals with a lot of tables and
> models.  At the moment, I've set up the company model so that is
> hasmany company types, and the company_types table so it belongsto
> company.  And in the view I set it up as:
>
> echo $form->input('CompanyType.0.type', array(
>                         'type' => 'select',
>                         'multiple' => 'checkbox',
>                         'options' => array(
>                                 'Paving' => 'Paving',
>                                 'Rock Crushing And Screening' => 'Rock 
> Crushing And Screening',
>                                 'Sweeping' => 'Sweeping',
>                                 'Grinding' => 'Grinding',
>                                 'Cranes' => 'Cranes'
>                         ));
>
> Obviously, this alone isn't enough because I'm getting the error: SQL
> Error: 1054: Unknown column 'Array' in 'field list' [CORE\cake\libs
> \model\datasources\dbo_source.php, line 527]
>
> What I'd prefer to do is explode the array in such a way so as to have
> each option selected be separately entered into the company_type table
> linked to the current company_id, rather than imploding it into a
> single string.  Can anyone give me any pointers?

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

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


Re: Mod rewrite to root

2010-03-17 Thread cricket
Use a route:

Router::connect(
'/:number_code',
array(
'controller' => 'numbers',
'action' => 'view'
),
array(
'number_code' => '[0-9]{3}-[0-9]{3}-[0-9]{4}',
'pass' => array('number_code')
)
);

function view($number_code = null)
{
...
}

What that does is specify that any URL consisting of exactly 3 digits,
a dash, 3 digits, another dash, followed by 4 digits should be
directed to NumbersController:view(). If the code does not always
follow that same scheme you'll need to describe a regexp that will
always match.

You can name number_code whatever you like. The 'pass' part of the
route says that the matching number should be passed as a parameter to
the controller method. If not, you'll have to look for it in $this-
>params.

When creating links using HtmlHelper, do it like:

$html->link(
'whatever',
array(
'controller' => 'numbers',
'action' => 'view',
'number_code' => $your_number_code
),
array('title' => 'my fancy link')
);

On Mar 17, 3:51 pm, thankyou  wrote:
> Hi ,
> I have a cakephp application where there's a 
> link:http://www.mywebsite.com/numbers/view/112-332-3322-- BTW...there are
> a variety of numbers after view/ not just 112-332-3322
>
> I would like to make that viewable to the users 
> as:http://www.mywebsite.com/112-332-3322
>
> Is there a way to use mod-rewrite to make this happen?

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

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


Problem creating elements with "BAKE"

2010-03-17 Thread marcoR-IT
Hi,
When I try to create some element with the "BAKE" command (Model, View
or Controller), the following message is displayed:
"Fatal error: Call to undefined function mysql_query() in /var/www/
html/webroot/cake/libs/model/datasources/dbo/dbo_mysql.php on line
588"

info:
database controller: "mysql"
CakePHP version: "CakePHP v1.3.0-RC1"
(The same occurs with version 1.2.6.)

I have another application created "manually" with code, into CakePHP
that's working without problems, so I think the problem may not be
associated with MySQL controller or the MySQL connection.

Thanks in advance for your help

Best regards,
Marco

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

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


Re: I have exactly the same error at the same step of the blog tutorial

2010-03-17 Thread cricket
http://catb.org/~esr/faqs/smart-questions.html

On Mar 17, 2:36 am, 1001net  wrote:
> I am using ubuntu 9.04
>
> Does anyone has any answer?

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

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


Re: different types of Users

2010-03-17 Thread cricket
Thanks, all, for the responses. I guess I should have mentioned that
I've used ACL before, for an intranet to allow a company's affiliates
log in and access many types of files. The requirement was that each
group be shown (and be able to download) only certain folders/files. I
used ACL and a tree structure (it was, essentially, a directory
structure) and a record-level protection model. After *a lot* of
frustration (my first stab at ACL), it worked very well. I should
really get around to writing an article for the Bakery, as I don't
think anyone else has published anything on doing this with Cake.

That said, I'm leaning away from ACL for this project. The issue for
me is not so much access control but modeling different user types.
I've decided to store the model name & association_key in the users
table, which is an approach that's worked well for me in similar (non-
user) situations. Then I'll have separate Member, Affiliate, and
Administrator models. Auth will keep that info in the session, so I
can use that for access control after authentication has proceeded.


On Mar 17, 3:33 pm, Martin Duris  wrote:
> one of the key to understand is to know how ACL works - tree structure
> - than its just question of time, to get everything work
>
> 2010/3/17 Alejandro Gomez Fernandez :
>
> > I'm new usign cake, but not designing information systems in different
> > platforms, even web.
> > I think the solution to your dilemma is using ACL. Yes, I know is at the
> > beginning difficult to understood and implement, but it was designed
> > speciffically to solve this problem. It permits you to assign differents
> > roles to any person and to change this persons' role in any moment without
> > any aditional work (more than select the roles in the ACL admin).
> > Obviously there are many other workarounds to solve your specific problem,
> > but the idea behind cake is re-usability. When you adjust an ACL (maybe at
> > the beginning almost copy and paste from any book or tutorial) you can
> > re-use it in any other project. When many more times you practice to
> > develop/implement any technic, more close you are of master it.
> > I hope this comment serves you to decide how to approach this problem.
>
> > Regards,
>
> > Alejandro Gomez Fernandez.
>
> > El 16/03/2010 15:44, cricket escribió:
>
> > I'm just starting on a site that will have several types of users and
> > am uncertain of the best approach to take. I'd like to hear from
> > others who have done something similar.
>
> > The site will have the following user types:
>
> > Administrators
> > Members
> > Affiliates
>
> > Admins may or not be Members. Affiliates will not be Admins nor
> > Members, but the fields for Affiliates and Members are quite similar.
> > However, they may diverge further down the road.
>
> > All should be able to log in, so I plan to, at least, have a users
> > table with the passwords. But I'd prefer not to have every possible
> > field stuffed in there and instead use separate models for each type.
> > This seems like a good fit for role-based authentication, using
> > Groups, but I think it would make more sense to have separate Member,
> > Affiliate, and Administrator models.
>
> > But, in that case, how should I go about registering what a newly-
> > logged-in User is? One idea I had was to include "model" &
> > "association_key" fields in the users table, then loading the info as
> > needed (because it will be stored Auth's session array).
>
> > So, how have others approached this? ExtendableBehavior?
> > InheritableBehavior? PolymorphicBehavior? Something else?
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en
>
>

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

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


Re: Ideas for architecting a generic "Payment Gateway" in cake

2010-03-17 Thread Jon Bennett
> 4. different component per gateway

I've gone this route, but it's quite hard coded into the all, and
certainly the database. if you find a nicer way, I'd be interested.

J


-- 
jon bennett - www.jben.net - blog.jben.net

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

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


htaccess issue

2010-03-17 Thread Dave
I have my app in the folder root.
 
Now i need to make a dev folder in the root also so it i type in site/dev i
go to my dev folder not the cake
 
/root
/app
/cake
 
and 
/dev
 
How can i do this?
 
Thanks
 
Dave

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

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


Complex form with fields belonging to fields that belong to the top table

2010-03-17 Thread Gillian
I'm pretty new to Cakephp, so this could be rather simple and I'm just
missing it.

I'm attempting to set up a form that deals with a lot of tables and
models.  At the moment, I've set up the company model so that is
hasmany company types, and the company_types table so it belongsto
company.  And in the view I set it up as:

echo $form->input('CompanyType.0.type', array(
'type' => 'select',
'multiple' => 'checkbox',
'options' => array(
'Paving' => 'Paving',
'Rock Crushing And Screening' => 'Rock Crushing 
And Screening',
'Sweeping' => 'Sweeping',
'Grinding' => 'Grinding',
'Cranes' => 'Cranes'
));

Obviously, this alone isn't enough because I'm getting the error: SQL
Error: 1054: Unknown column 'Array' in 'field list' [CORE\cake\libs
\model\datasources\dbo_source.php, line 527]

What I'd prefer to do is explode the array in such a way so as to have
each option selected be separately entered into the company_type table
linked to the current company_id, rather than imploding it into a
single string.  Can anyone give me any pointers?

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

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


Ideas to manage open voting

2010-03-17 Thread Amit
I'm working on a site that's going to let people vote on submissions.
To encourage interaction I want to let anonymous users vote, but I
still want to limit unique visitors to one vote. I know I won't be
able ensure 100% adherence unless I require some sort of login, but
allowing for this what should I check to see if a person has already
voted?

Is 1 vote/ip address good enough? Is there anything else should I log/
track to prevent 1 person from voting multiple times (knowing full
well that since it's open voting I can't stop every scenario)?

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

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


Re: Tips on performance monitoring / profiling

2010-03-17 Thread Jon Bennett
> Whilst there is the core cache library which is great, do you use any
> kind of component in front of this to abstract it?  Or is it a case of
> manually checking whether the cached element exists in your controller
> action and then if not fetching from the DB?

check out Andy Dawson's MiCache as well
http://www.assembla.com/code/mi/subversion/nodes/branches/mi_plugin/vendors/mi_cache.php

J

-- 
jon bennett - www.jben.net - blog.jben.net

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

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


Mod rewrite to root

2010-03-17 Thread thankyou
Hi ,
I have a cakephp application where there's a link:
http://www.mywebsite.com/numbers/view/112-332-3322 -- BTW...there are
a variety of numbers after view/ not just 112-332-3322

I would like to make that viewable to the users as:
http://www.mywebsite.com/112-332-3322

Is there a way to use mod-rewrite to make this happen?

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

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


Intergrating PHPCake into CMS

2010-03-17 Thread Ben
Hello

Has everyone had any experience using PHPCake with an Open Source CMS
such as silverstripe? Any recommendations you have would be
appreciated.

Regards

Ben

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

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


Re: Tips on performance monitoring / profiling

2010-03-17 Thread Jon Bennett
hi Alex,

>> In terms of profiling - it sounds like its the DB that's being
>> sluggish, how many hits are you getting? on what spec server? if you
>> have access you could run
>> http://www.webdevelopmentstuff.com/123/optimizing-mysql-performance-tuning-script.html
>> to try and optimise your mysql server.
>
> Yeah I think I'm just too lazy when it comes to indexes.  Definitely
> using Containable, but should probably be making better use of
> caching.

Indexes make a huge difference, as does using the right column types.
Containable is great, but you still need to analyse what's being
retrieved and adjust. As little as possible generally!

> Whilst there is the core cache library which is great, do you use any
> kind of component in front of this to abstract it?  Or is it a case of
> manually checking whether the cached element exists in your controller
> action and then if not fetching from the DB?

I have a custom solution based around Mile J's
http://www.milesj.me/blog/read/34/Cacheing-Each-Query-Individually.
It's pretty easy to cache stuff though, it's knowing when to clear
them out that's the tricky bit.

Cheers,

J

-- 
jon bennett - www.jben.net - blog.jben.net

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

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


Re: different types of Users

2010-03-17 Thread Martin Duris
one of the key to understand is to know how ACL works - tree structure
- than its just question of time, to get everything work

2010/3/17 Alejandro Gomez Fernandez :
> I'm new usign cake, but not designing information systems in different
> platforms, even web.
> I think the solution to your dilemma is using ACL. Yes, I know is at the
> beginning difficult to understood and implement, but it was designed
> speciffically to solve this problem. It permits you to assign differents
> roles to any person and to change this persons' role in any moment without
> any aditional work (more than select the roles in the ACL admin).
> Obviously there are many other workarounds to solve your specific problem,
> but the idea behind cake is re-usability. When you adjust an ACL (maybe at
> the beginning almost copy and paste from any book or tutorial) you can
> re-use it in any other project. When many more times you practice to
> develop/implement any technic, more close you are of master it.
> I hope this comment serves you to decide how to approach this problem.
>
> Regards,
>
>
>
> Alejandro Gomez Fernandez.
>
>
>
>
> El 16/03/2010 15:44, cricket escribió:
>
> I'm just starting on a site that will have several types of users and
> am uncertain of the best approach to take. I'd like to hear from
> others who have done something similar.
>
> The site will have the following user types:
>
> Administrators
> Members
> Affiliates
>
> Admins may or not be Members. Affiliates will not be Admins nor
> Members, but the fields for Affiliates and Members are quite similar.
> However, they may diverge further down the road.
>
> All should be able to log in, so I plan to, at least, have a users
> table with the passwords. But I'd prefer not to have every possible
> field stuffed in there and instead use separate models for each type.
> This seems like a good fit for role-based authentication, using
> Groups, but I think it would make more sense to have separate Member,
> Affiliate, and Administrator models.
>
> But, in that case, how should I go about registering what a newly-
> logged-in User is? One idea I had was to include "model" &
> "association_key" fields in the users table, then loading the info as
> needed (because it will be stored Auth's session array).
>
> So, how have others approached this? ExtendableBehavior?
> InheritableBehavior? PolymorphicBehavior? Something else?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en

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

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


Re: Tips on performance monitoring / profiling

2010-03-17 Thread Christian Leskowsky
You might want to give YSlow / Page Speed a try too. They often turn up an
area or 2 worth looking into.

On Wed, Mar 17, 2010 at 2:04 PM, Alex Bovey  wrote:

> On Wed, Mar 17, 2010 at 5:23 PM, Jon Bennett  wrote:
> >> Has anyone got any tips on performance monitoring and profiling a cake
> app?
> >
> > In terms of profiling - it sounds like its the DB that's being
> > sluggish, how many hits are you getting? on what spec server? if you
> > have access you could run
> >
> http://www.webdevelopmentstuff.com/123/optimizing-mysql-performance-tuning-script.html
> > to try and optimise your mysql server.
>
> Always there with solid advice JB - ta!
>
> Yeah I think I'm just too lazy when it comes to indexes.  Definitely
> using Containable, but should probably be making better use of
> caching.
>
> Whilst there is the core cache library which is great, do you use any
> kind of component in front of this to abstract it?  Or is it a case of
> manually checking whether the cached element exists in your controller
> action and then if not fetching from the DB?
>
> --
> Alex Bovey
> Web Developer | Alex Bovey Consultancy Ltd
> Registered in England & Wales no. 6471391 | VAT no. 934 8959 65
> a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533
> PHP | MySQL | AJAX | XHTML | CSS | Javascript | XML | W3C Accessibility
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
-

"You can't reason people out of a position they didn't use reason to get
into."

Christian Leskowsky

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

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

Re: Tips on performance monitoring / profiling

2010-03-17 Thread Alex Bovey
On Wed, Mar 17, 2010 at 5:23 PM, Jon Bennett  wrote:
>> Has anyone got any tips on performance monitoring and profiling a cake app?
>
> In terms of profiling - it sounds like its the DB that's being
> sluggish, how many hits are you getting? on what spec server? if you
> have access you could run
> http://www.webdevelopmentstuff.com/123/optimizing-mysql-performance-tuning-script.html
> to try and optimise your mysql server.

Always there with solid advice JB - ta!

Yeah I think I'm just too lazy when it comes to indexes.  Definitely
using Containable, but should probably be making better use of
caching.

Whilst there is the core cache library which is great, do you use any
kind of component in front of this to abstract it?  Or is it a case of
manually checking whether the cached element exists in your controller
action and then if not fetching from the DB?

-- 
Alex Bovey
Web Developer | Alex Bovey Consultancy Ltd
Registered in England & Wales no. 6471391 | VAT no. 934 8959 65
a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533
PHP | MySQL | AJAX | XHTML | CSS | Javascript | XML | W3C Accessibility

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

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


Re: Tips on performance monitoring / profiling

2010-03-17 Thread Jon Bennett
> Has anyone got any tips on performance monitoring and profiling a cake app?

In terms of profiling - it sounds like its the DB that's being
sluggish, how many hits are you getting? on what spec server? if you
have access you could run
http://www.webdevelopmentstuff.com/123/optimizing-mysql-performance-tuning-script.html
to try and optimise your mysql server.

You can use xdebug to profile the app, but I don't think that'll shed
any light on the database.

Cheers,

J

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

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


Re: Tips on performance monitoring / profiling

2010-03-17 Thread Jon Bennett
hi Alex,

> Has anyone got any tips on performance monitoring and profiling a cake app?
>
> I'm using containable and number of queries doesn't look too bad but
> it's all running pretty slowly at the moment.

Use containable, explicitly set the fields you need in every model,
tune your database
http://www.jeremy-burns.co.uk/2010/02/cakephp-basic-database-table-tuning-tips/
and CACHE CACHE CACHE CACHE CACHE!

J


-- 
jon bennett - www.jben.net - blog.jben.net

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

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


Re: different types of Users

2010-03-17 Thread Alejandro Gomez Fernandez
I'm new usign cake, but not designing information systems in different
platforms, even web.
I think the solution to your dilemma is using ACL. Yes, I know is at the
beginning difficult to understood and implement, but it was designed
speciffically to solve this problem. It permits you to assign differents
roles to any person and to change this persons' role in any moment
without any aditional work (more than select the roles in the ACL admin).
Obviously there are many other workarounds to solve your specific
problem, but the idea behind cake is re-usability. When you adjust an
ACL (maybe at the beginning almost copy and paste from any book or
tutorial) you can re-use it in any other project. When many more times
you practice to develop/implement any technic, more close you are of
master it.
I hope this comment serves you to decide how to approach this problem.

Regards,



Alejandro Gomez Fernandez.
 



El 16/03/2010 15:44, cricket escribió:
> I'm just starting on a site that will have several types of users and
> am uncertain of the best approach to take. I'd like to hear from
> others who have done something similar.
>
> The site will have the following user types:
>
> Administrators
> Members
> Affiliates
>
> Admins may or not be Members. Affiliates will not be Admins nor
> Members, but the fields for Affiliates and Members are quite similar.
> However, they may diverge further down the road.
>
> All should be able to log in, so I plan to, at least, have a users
> table with the passwords. But I'd prefer not to have every possible
> field stuffed in there and instead use separate models for each type.
> This seems like a good fit for role-based authentication, using
> Groups, but I think it would make more sense to have separate Member,
> Affiliate, and Administrator models.
>
> But, in that case, how should I go about registering what a newly-
> logged-in User is? One idea I had was to include "model" &
> "association_key" fields in the users table, then loading the info as
> needed (because it will be stored Auth's session array).
>
> So, how have others approached this? ExtendableBehavior?
> InheritableBehavior? PolymorphicBehavior? Something else?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en
>   

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

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

Re: Subdomain Auth Problem

2010-03-17 Thread Sergey Yalansky
1. Open file cake/libs/session.php
2. Find method __initSession()
3. Comment two lines with ini_set('session.referer_check', $this-
>host);
4. Add
 ini_set('session.cookie_domain', '.yourdomain.com');
before switch (Configure::read('Session.save')) {
5. Clear all cookies in browser for your domain and subdomains and
test it


On Mar 9, 1:25 pm, Kyle Decot  wrote:
> Since I've done all of your suggestions an I'm still having no success
> perhaps it's the way that I'm doing my subdomains. Here's how I'm
> doing it. Let me know what you think. In my routes.php I have:
>
> $subdomain= substr(env("HTTP_HOST"), 0, strpos(env("HTTP_HOST"),
> "."));
>
> if ($subdomain== 'api') {
>
> }
>
> else if(
>
> Then in my hosting cpanel, I go to the subdomains tab and add a newsubdomain, 
> and set my cake app directory as the path for thesubdomain. Is this an 
> acceptable way of doing this or could this be
> the cause of myproblems.
>
> On Mar 8, 5:28 pm, Kyle Decot  wrote:
>
> > I inserted that but still when I go to blog.mysite.com and do 
> > $this->Session->read(); in my app_controller.php's beforeRender() It doesn't
>
> > contain my user information. Any other ideas or suggestions?
>
> > On Mar 8, 3:05 pm, Bernardo Vieira  wrote:
>
> > > I have it in my beforeFilter callback in app_controller:
> > > $this->Cookie->domain = '.mydomain.tld';
>
> > > Note that the '.' before your domain name is what tells the browser that 
> > > the
> > > cookie is valid for *.mydomain.tld.
>
> > > On Mon, Mar 8, 2010 at 4:50 PM, Kyle Decot  wrote:
> > > > Where do I set the realm for the session cookie? The security level in
> > > > my core.php file is set to low.
>
> > > > On Mar 8, 6:47 am, Bernardo Vieira  wrote:
> > > > > You also need to set the realm of the session cookie to your domain
> > > > > (it defaults to the hostname) and set the security level of the
> > > > > security component below 2
>
> > > > > On 3/8/10, Kyle Decot  wrote:
>
> > > > > > Well my sessions.save is set to database in my core.php file. Also, 
> > > > > > I
> > > > > > did $session->read() on my www page and I get all of myauthinfo,
> > > > > > however if I do the same thing on, blog.mysite.com thenauthis now
> > > > > > empty. Any ideas on next steps to take towards solving this? Thanks
> > > > > > guy.
>
> > > > > > On Mar 7, 8:36 pm, Nabil Alsharif  wrote:
> > > > > >> My first guess would be that you lost session data when you went to
> > > > the
> > > > > >>subdomain. Maybe because the session cookies weren't sent with the
> > > > > >> requests going to thesubdomainor maybe something else, I'm can't 
> > > > > >> see
> > > > > >> whats happening on your servers The point is it's easy to 
> > > > > >> check if
> > > > > >> the session was lost, that wold be the first thing I'd look at. 
> > > > > >> Good
> > > > > >> luck.
>
> > > > > >> On Sun, 2010-03-07 at 15:25 -0800, Kyle Decot wrote:
> > > > > >> > Yep. It's all one Cake App. Any ideas?
>
> > > > > >> > On Mar 7, 11:43 am, cricket  wrote:
> > > > > >> > > Asubdomainis usually a completely separate site. Do you already
> > > > > >> > > have
> > > > > >> > > the same Cake app serving all of your subdomains?
>
> > > > > >> > > On Mar 6, 5:34 pm, Kyle Decot  wrote:
>
> > > > > >> > > > I have a couple different subdomains on my site but I am 
> > > > > >> > > > having
> > > > > >> > > > some
> > > > > >> > > >problemsw/ theAuthComponent. I login fine under the standard
> > > > www
> > > > > >> > > >subdomainbut then if I go to a differentsubdomain, then I am
> > > > no
> > > > > >> > > > longer logged in. How do I make sure that myAuthlogin 
> > > > > >> > > > persists
> > > > > >> > > > across all of my subdomains?
>
> > > > > >> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > > others
> > > > > >> > with their CakePHP related questions.
>
> > > > > >> > You received this message because you are subscribed to the 
> > > > > >> > Google
> > > > > >> > Groups "CakePHP" group.
> > > > > >> > To post to this group, send email to cake-php@googlegroups.com
> > > > > >> > To unsubscribe from this group, send email to
> > > > > >> > cake-php+unsubscr...@googlegroups.com > > > > >> >  om>For more options, visit this group
> > > > > >> > athttp://groups.google.com/group/cake-php?hl=en
>
> > > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > > others
> > > > > > with their CakePHP related questions.
>
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups
> > > > > > "CakePHP" group.
> > > > > > To post to this group, send email to cake-php@googlegroups.com
> > > > > > To unsubscribe from this group, send email to
> > > > > > cake-php+unsubscr...@googlegroups.com > > > > >  om>For more options, visit this group at
> > > > > >http://groups.google.com/group/cake-php?hl=en
>
> > > > > --
> > > > > Sent from my mobile device
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > > wi

I have exactly the same error at the same step of the blog tutorial

2010-03-17 Thread 1001net
I am using ubuntu 9.04

Does anyone has any answer?

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

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


Re: .htaccess, possible helpful info for mac users

2010-03-17 Thread dreamingmind
Here's a bit more detail that has turned up:

Things are only working at this point from the VirtualHost I set up
for the Cake Blog tutorial. My directory /Users/username/Sites/
cakeblog can be accessed simply as "http://cakeblog";. The VirtualHost
is set up like this:

In httpd.conf add this -

NameVirtualHost 127.0.0.1


ServerName cakeblog
DocumentRoot /Users/username/Sites/cakeblog


Then in /etc/hosts add this -

127.0.0.1 cakeblog

Of course if your localhost ip address is different I used this
article as a basis for setting this up: 
http://articles.sitepoint.com/article/os-x-web-development

There are clues as to why the site is not working when addressed
directly "http://localhost/~username/cakeblog";. The 404 error says:

Not Found
The requested URL /Users/username/Sites/cakeblog/app/webroot/ was not
found on this server.

This seems completely strange since that is PRECISELY the correct
path. But looking at the apache error logs reveals a surprise:

[Tue Mar 16 17:11:09 2010] [error] [client ::1] File does not exist: /
Library/WebServer/Documents/Users

Well, /Library/WebServer/Documents is the path to the plain localhost
site. There is no Users directory there. Users is the start of the
path to localhost/~username site. Something about turning mod_rewrite
on for the directory, or about the a the specific rewrites in
the .htaccess files, or some other unknown factor is trashing the way
apache is mapping localhost url's into my directory structure.

Possibly someone who is actually FAMILIAR with these issues has a
solution.

The problem seems to be related to the actual rewrites and
the .htaccess files. I say this because typing in a bogus user site
url like "http://localhost/~username/junk"; provide the properly mapped
404 error "The requested URL /~dondrake/junk was not found on this
server."

Further GOOD news though:

Placing the cakeblog directory in /Library/WebServer/Documents/ and
turning on the AllowOverride for that directory in httpd.conf ALSO
works.

So, all these hours were lost because I picked 'heads' instead of
'tails' on the where-to-install coin toss.

Happy Baking (I guess)
Don Drake

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

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


Re: different types of Users

2010-03-17 Thread piousbox
First, take a look at ACL component. If you can make it work, that's
what you need. (Although it's really confusing, and I don't use it for
my needs).

If you decide to not use ACL, you'll use Auth component (that's just
being able to login; you'd use it with ACL, too), then store your
user.id in a session, and do authorization based on privileges of each
user (and user type).

Use only one User model. In it, have several boolean columns that
distinguish between user types (example below). Then, in your model do
validation s.t. an admin cannot possibly be a member, when they
register. Have several registration forms that only make some columns
available, but use the same model.

Your authorization (not to confuse with authentication) will go in
beforeFilter() of AppController.

example user table:

create table users(
`id` int(12) not null auto_increment primary key,
`username` varchar(200) null,
`password` varchar(60) null,
`first_name` varchar(200) null,
`last_name` varchar(200) null,
`created` timestamp default now(),
`is_admin` boolean default false,
`is_member` boolean default false,
`is_affiliate` boolean default false
);

But, you know, as soon as you feel that the thing is getting too
complex (which is likely), just go with ACL.

_V



On Mar 16, 1:44 pm, cricket  wrote:
> I'm just starting on a site that will have several types of users and
> am uncertain of the best approach to take. I'd like to hear from
> others who have done something similar.
>
> The site will have the following user types:
>
> Administrators
> Members
> Affiliates
>
> Admins may or not be Members. Affiliates will not be Admins nor
> Members, but the fields for Affiliates and Members are quite similar.
> However, they may diverge further down the road.
>
> All should be able to log in, so I plan to, at least, have a users
> table with the passwords. But I'd prefer not to have every possible
> field stuffed in there and instead use separate models for each type.
> This seems like a good fit for role-based authentication, using
> Groups, but I think it would make more sense to have separate Member,
> Affiliate, and Administrator models.
>
> But, in that case, how should I go about registering what a newly-
> logged-in User is? One idea I had was to include "model" &
> "association_key" fields in the users table, then loading the info as
> needed (because it will be stored Auth's session array).
>
> So, how have others approached this? ExtendableBehavior?
> InheritableBehavior? PolymorphicBehavior? Something else?

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

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


Ideas for architecting a generic "Payment Gateway" in cake

2010-03-17 Thread keymaster
I'd like to build a generic payment interface in cake with the ability
to easily plug-in several different gateway implementations.

The stubs would be things like: Authorize.Net, LinkPoint, Verisign,
paypal, GoogleCO, 2CO, etc.

I'm not sure which of several architectural approaches to choose
within cake.

Possibilities:

1. single generic Payment model,  different behavior per gateway.
2. single generic Payment model, different datasource per gateway.
3. different model per gateway
4. different component per gateway
5. other ...

Any tips ?

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

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


Re: Data Validation not working

2010-03-17 Thread logout
I also vote for problems in the path/filename.

Be sure exactly what file you edit (the model) - I had exactly the
same problem - it turned out that i was editing a wrong file.
When I opened the correct one, all worked fine.

Your file for the model is inventory.php in the app/models, right?

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

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


Tips on performance monitoring / profiling

2010-03-17 Thread Alex Bovey
Hi all,

Has anyone got any tips on performance monitoring and profiling a cake app?

I'm using containable and number of queries doesn't look too bad but
it's all running pretty slowly at the moment.

Thanks,

Alex

-- 
Alex Bovey
Web Developer | Alex Bovey Consultancy Ltd
Registered in England & Wales no. 6471391 | VAT no. 934 8959 65
a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533
PHP | MySQL | AJAX | XHTML | CSS | Javascript | XML | W3C Accessibility

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

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


Re: A question about updateAll()

2010-03-17 Thread logout
Well, I figured it out...

The key is in the getAffectedRows() function.
So, the function now is

reduceCredits($id, $amount) {
if($this->updateAll(
array(
'Manager.credit' => 
"Manager.credit-{$amount}"
 ),
array(
'Manager.id' => $id,
'Manager.credit >= ' => $amount
)
)
)  {
return $this->getAffectedRows();
}
return false;
   }

I hope this helps someone :)

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

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


A question about updateAll()

2010-03-17 Thread logout
Hi everyone,

I have a question regarding the updateAll() function.

I use it to reduce or increase credits (not surprisingly) but I have
an issue: how can I be sure that all went well. What I mean:

I have a method reduceCredits($id, $amount), which is like that:

return $this->updateAll(
array(
 
'Manager.credit' => "Manager.credit-{$amount}"
),
array(
 'Manager.id' => $id,
 'Manager.credit >= ' => $amount
)
   );
So, if the operation is OK, I want to proceed as normal. But before I
call reduceCredits(), I validate the operation, checking if there are
enough credits, i.e. I read the record of the Manager and check the
Manager.credit field. Now, if the validation passes, but someone else
gets some of the credits before the calling of the reduceCredits()
function, it might not reduce credits because of the 'Manager.credit
>= ' => $amount condition (i.e. the credits are now below the
$amount). So a statement like:
 if($this->Manager->reduceCredits($id, $amount))
 always returns TRUE no matter if the record gets updated or not. So
the question here is: how can I know for sure if the update actually
took place or not.

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

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


Re: different types of Users

2010-03-17 Thread Martin Duris
Using ACL can be very confusing, but it also can be usied to create
simple accesing rules - you have 3 groups (maybe 4 when couting even
visitors - ACL should work fine with that - its just point of view)

but i didnt understand completly your problem - you vae problem with
that, you dont know what newly registered user should be ??? or you
have complet user managment dilema ?

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

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


Re: PHP 5.3 open short tag does't working on cakePHP 1.2.6

2010-03-17 Thread anak newbie
Why i am not thinking to replace short tags using bash script before,
damn!
Thanks to cricket and piousbox, it's cut my headache :D 
Surely, i will email if can't find how to replacing with closing tag.

Ok, right now there are some people have same thought with me.
So i will share my opinion :

IMHO, some people said using short tags syntax is because it's a
familiar syntax.
Basically, it helps developers focus more on what data should not be
escaped vs. what data needs to be escaped.

Because short tags will deprecated and remove, it's doesn't meaning we
can't use it!
Have heard about stream (http://www.php.net/streams) ?

Yes! it can replace  to be   
The stream wrapper reads the file and searches for anything that looks
like  and replaces it with .

I have looked on another framework and it's working!
 
I don't it's polite or not to share another framework ability in here?

If permitted, i can give a link to show detail what i mean.


Personally, i love short tags, still for me, it's make my templates much
cleaner


Thanks 


On Tue, 2010-03-16 at 07:59 -0700, piousbox wrote:

> Well first off, the grammar of PHP is unambiguous so you should be
> able to use a regular expression to convert all the short tags. Here's
> a linux command to replace one string with another in all text files
> in a folder
> 
> grep -rl ‘OLD’ . | xargs sed -i -e ’s/OLD/NEW/’
> 
> But you need to modify this to look not only for the opening tag, but
> for the matching closing tag to make two replacements:
>  replace with 
> 
> So email me if you chose this route, get stuck but really really need
> this pattern (because it'll take me some time to write and I don't
> want to do it if it won't be used).
> 
> Regarding some other people's suggestions, why wouldn't you use short
> tags?! Those are awesome, make my views so much cleaner and more
> readable, and save me finger pain. I believe cakePHP even has a
> shorthand for echo(), which is e(), because  much to write. So, I'll stick with my short tags thank you. Besides, I
> control my server and my php.ini.
> 
> _V
> 
> P.S. Closing tags in PHP files other than views are unnecessary,
> either.
> 
> 
> 
> On Mar 16, 3:25 am, anak newbie  wrote:
> > Thanks Jacob!
> >
> > I see it
> >
> > then i should change all short_open_tags in my many apps and it's
> > meaning pain :)
> >
> > cheers
> >
> > On Mon, 2010-03-15 at 05:05 -0700, jacmoe wrote:
> > > I strongly advise not using them!
> > > They doesn't make the template more clean - it makes it much harder to
> > > spot the PHP code.
> >
> > > Allow me to quote from debuggable.com:
> > > > The first thing I recommend is using the fully qualified syntax ( > > > ?>) for php tags instead of the short one (). Why?
> > > > Well that's what the CakePHP coding standards recommend you to use, and 
> > > > it makes those statments stand out a little more in
> > > > your html code. But the main reason still is that the short tags syntax 
> > > > can be turned off via php.ini, so using them makes
> > > > your app less portable and could cause raw code output incidents.
> >
> > > I am not a CakePHP expert, but it sounds right. :)
> >
> > > Jacob
> >
> > > On Mar 14, 10:26 pm, Miles J  wrote:
> > > > This isn't a problem with CakePHP.
> >
> > > > Short tags are an INI setting within your PHP installation.
> > > > Furthermore short tags are being completely removed or deprecated in
> > > > future PHP versions, so its just best practice to stop using them.
> >
> > > > On Mar 14, 4:38 pm, anak newbie  wrote:
> >
> > > > > Yeap, you're right!
> >
> > > > > but somehow open_short_tag affect in making template more clean
> >
> > > > > i see it's support on another framework and i don't talk about 
> > > > > comparing
> > > > > something :D
> >
> > > > > Just an idea
> >
> > > > > On Sun, 2010-03-14 at 03:36 -0700, Miles J wrote:
> > > > > > Its only 6 more characters to write  >
> > > > > > :P
> >
> > > > > > On Mar 14, 1:47 pm, anak newbie  wrote:
> > > > > > > Perhaps someday it's can be fixed without open_short_tags enable.
> >
> > > > > > > IMHO, using open_short_tags giving clear templates code as well .
> >
> > > > > > > On Sat, 2010-03-13 at 14:36 -0800, Miles J wrote:
> > > > > > > > That's the only way to fix it. Its an ini setting.
> >
> > > > > > > > On Mar 13, 11:07 am, John Andersen  
> > > > > > > > wrote:
> > > > > > > > > Please apply the solution you already know about, enable the 
> > > > > > > > > short
> > > > > > > > > tags in the php.ini file!
> > > > > > > > > There is as far as I know, no other solution ... except for 
> > > > > > > > > you to go
> > > > > > > > > through all your source code and change from the short tag to 
> > > > > > > > > the  > > > > > > > > php tag :)
> > > > > > > > > Enjoy,
> > > > > > > > >John
> >
> > > > > > > > > On Mar 14, 6:36 am, anak newbie  wrote:
> >
> > > > > > > > > > Hello all,
> >
> > > > > > > > > > Today i am upgrading my server to PHP 5.3 and see something 
> > > > > > > > > > trou

Re: multiple many to many tables between the same tables cakePHP

2010-03-17 Thread John Tadros
Hello All,

Thanks for your replies.
But to make sure that I get things right, you mean that I should create a
table called "Ratings" and a table called "Privacies" and link "users" and
"musics" each with a Many to many relations to each of Ratings and privacies
?

Actually in my case, the table musics_users_privacy does not contain an
attribute for privacy, so i can just ignore it in the naming, but in Ratings
I should have three tables "Ratings", "Musics" and "Users" and then have
"Musics_Ratings" and "Users_Ratings" tables along with their models

Is that correct ?

Best Regards
John

On Wed, Mar 17, 2010 at 10:22 AM, WebbedIT  wrote:

> They are two relations so you have two join tables, you just need to
> define different join tables in each association, plus you need to
> create a model for the ratings join model as Mateo states above to
> allow for the rating attribute.
>
> HTH
>
> Paul
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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

Re: simple image gallery

2010-03-17 Thread WebbedIT
$200 for a simple (your choice of name) module/plugin built on an open-
source framework, doubt you'll get many takers within this community.
Especially when there is no way to preview/demo it without first
sending you contact details!

The idea of an open-source community built on an open-source framework
is that we share information/code freely for the advancement of the
community, where would you be if the core developers started charging
for every new feature they added to Cake?

Take a look at Kaching (shopping cart) and WildFlower (CMS) or any of
MilesJ's freely available scripts (http://www.milesj.me/resources/
scripts) and you will see that your image gallery is unlikely to
become a good income generator.

Paul.

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

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


Re: Help a noob with a session(?) issue

2010-03-17 Thread jorgt...@gmail.com
For anyone who comes across this later, the errors went away when I
switched the cache engine in core.php to memcached :)



On 16 Mar, 09:07, "jorgt...@gmail.com"  wrote:
> The tmp directories aren't affected, I only upload the controllers/
> views/layouts that I've modified. The tmp dirs are still chmoded 777.
>
> On 15 Mar, 14:25, Julian 86  wrote:
>
> > How are you working on the server?? Did you push the new code with a
> > ftp programm? Then you override the permissions of the tmp
> > directory...
>
> > On 15 Mrz., 14:19, "jorgt...@gmail.com"  wrote:
>
> > > I keep getting these error messages, they don't show up every time I
> > > view a page, but every 20th pageview or so. My tmp and session
> > > directory are set chmod 777. I've tried switching the session engine
> > > from php to cake's own, but that didn't make a difference. Has anyone
> > > come across this before, or has an idea of what I can try to fix it?
>
> > > Here's the error:
>
> > > Warning (2): fopen(/tmp/sess_4bbc6925e4dc2234b2253a5a6d370c27)
> > > [function.fopen]: failed to open stream: Permission denied [CORE/cake/
> > > libs/file.php, line 156]
>
> > > $mode   =       "rb"
> > > $force  =       false
>
> > > fopen - [internal], line ??
> > > File::open() - CORE/cake/libs/file.php, line 156
> > > File::read() - CORE/cake/libs/file.php, line 175
> > > FileEngine::clear() - CORE/cake/libs/cache/file.php, line 225
> > > FileEngine::gc() - CORE/cake/libs/cache/file.php, line 109
> > > Cache::engine() - CORE/cake/libs/cache.php, line 160
> > > Cache::config() - CORE/cake/libs/cache.php, line 126
> > > include - APP/config/core.php, line 238
> > > Configure::__loadBootstrap() - CORE/cake/libs/configure.php, line 648
> > > Configure::getInstance() - CORE/cake/libs/configure.php, line 137
> > > include - CORE/cake/bootstrap.php, line 43
> > > [main] - APP/webroot/index.php, line 77
>
> > > Warning (2): fopen(/tmp/sess_60bc2ba565993335f0ad0be8d63af1eb)
> > > [function.fopen]: failed to open stream: Permission denied [CORE/cake/
> > > libs/file.php, line 156]
>
> > > Warning (2): fopen(/tmp/sess_ac46f56f90566da28651803e9d8f8997)
> > > [function.fopen]: failed to open stream: Permission denied [CORE/cake/
> > > libs/file.php, line 156]
>
> > > Warning (2): fopen(/tmp/sess_da8afc546b848ea90fd55b7f117c0ab6)
> > > [function.fopen]: failed to open stream: Permission denied [CORE/cake/
> > > libs/file.php, line 156]
>
> > > Warning (2): fopen(/tmp/sess_fc0fe5113eb55f71fc9b1eb20de04999)
> > > [function.fopen]: failed to open stream: Permission denied [CORE/cake/
> > > libs/file.php, line 156]
>
> > > ..and so on, this list continues endlessly (until I press stop in the
> > > browser)

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

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


Re: not working contact grabber in cake

2010-03-17 Thread WebbedIT
That looks like a non cake path to the files generating the errors.
What is this contact grabber?  Is it a cake plugin or vendor app?

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

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


Re: Data Validation not working

2010-03-17 Thread WebbedIT
@sooraj: If using the form helper it automatically includes validation
errors unless your suppress it by setting error=>false

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

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


Re: multiple many to many tables between the same tables cakePHP

2010-03-17 Thread WebbedIT
They are two relations so you have two join tables, you just need to
define different join tables in each association, plus you need to
create a model for the ratings join model as Mateo states above to
allow for the rating attribute.

HTH

Paul

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

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


Re: different types of Users

2010-03-17 Thread WebbedIT
My site has Site Manager, Site Admin, Organisation Manager,
Organisation Admin, Member and I manage them using a UserGroup model.
I then use Auth and set IsAuthorize methods in my controllers to
determine who can and can't do what.

I found ACL to complex for my needs.

HTH

Paul

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

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


Re: Problema con safe_mode y creacion directorio/subdirectorios

2010-03-17 Thread josu jauregui
Gracias por las respuestas. La posibilidad de tener los directorios creados
previamente no es posible dado que parte de estructura de directorios se
tiene que generar dinámicamente. 8-(
He estado mirando y el entorno en el que se implantará la app no tiene
safe_mode activado así que en principio no habrá problema. De todas formas,
quería mirar una alternativa para evitar el problema en el futuro (subida de
archivos con comandos ftp desde php me parece la mejor alternativa...)

Salu2!

Un saludo!

El 17 de marzo de 2010 05:42, Mateo San Román escribió:

> Hola,
>
> La solución que creo más adecuada para estos casos es gestionar a los
> archivos mediante una aplicación, es decir, "simulando" virtualmente
> los directorios y almacenar estos datos  ya sea en un único directorio
> previamente definido o en la base de datos como BLOBs... de esta
> manera tu aplicación no tendrá problemas de incompatibilidad,
> problemas de seguridad o permisos.
>
> On 16 mar, 08:10, josulin  wrote:
> > Buenas tardes. Tengo un problema de incompatibilidad entre safe_mode y
> > la creacion de directorios y subdirectorios. Sé que es un problema
> > propio de php, pero no sé si alguien habrá solucionado el problema en
> > alguna aplicación cake.
> >
> > El tema es que tengo que crear una estructura similar a app/tmp/
> > uploads/directoriogenerico/ dónde los '' serían cada uno de
> > los directorios que voy a ir creando en tiempo de ejecución (con más
> > subdirectorios). El directorio "" me lo deja crear correctamente,
> > pero como lo crea con usuario apache, posteriormente no me deja crear
> > mas subdirectorios por debajo y por ende, no puedo subir los archivos
> > para almacenarlos en dicho subdirectorio. Creo los directorios/
> > subdirectorios en una función upload, en la que posteriormente se
> > suben (se deberían subir) los archivos seleccionados.
> >
> > ¿Alguien ha conseguido solucionar un problema similar en una
> > aplicación cake? Otra posibilidad que contemplo es tener que cambiar
> > la programación para utilizar las funciones para ejecutar comandos ftp
> > desde php, pero antes de hacer el cambio en la programación, me
> > gustaría plantear la duda.
> >
> > Muchas gracias y un saludo!
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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

Re: Validation issues for Contact form (doesn't use database)

2010-03-17 Thread WebbedIT
Haven't read the post in full but think I have something that will
help.  I have a recurring comments form at the bottom of various
modules across my portal site and I created it with the following:

$form->create(null, array('url'=>array('action'=>'comment',
'#commentForm'), 'id'=>'commentForm'));

Similarly after a successful submission you can use redirect with a
bookmark included to jump to a success message or the new content
that's been added to the page.

HTH

Paul

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

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


Re: Adding a new counter cache

2010-03-17 Thread WebbedIT
Nice idea, thanks for that :)

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

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


yui help?

2010-03-17 Thread sooraj francis

I am using cake php and yui. i have a json format data displayed in my
view file.
now i have to acess those json data using yui datasource

My link to page is http://localhost/SPCake/listings/serverpagination/

but this code doesnot seeems to work.

var myDataSource = new YAHOO.util.DataSource("url('/
listings/serverpagination/');?>");

nor do this

var myDataSource = new YAHOO.util.DataSource("http://localhost/SPCake/
listings/serverpagination/");

plz help me out with this.

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

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