Re: Auth components

2009-04-11 Thread gimmebucks

I want the system to display :
"You are not authorized to access that location."

But not
"You are not authorized to access that location.
1"

Please help.

On Apr 11, 12:25 am, brian  wrote:
> Remove the echo. flash() does that itself.
>
> On Fri, Apr 10, 2009 at 11:01 AM, gimmebucks  wrote:
>
> > I'm usingauthcomponent and it's working like charm.
> > on layout file(default.ctp), i use:
>
> > echo $session->flash('auth');
>
> > and the result is:
>
> > You are not authorized to access that location.
> > 1
>
> > How to get rid of '1' character?
> > Please help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Offline version of the CakePHP manual.

2009-04-11 Thread Sergei

Can you upload generated PDF to some file-sharing hosting server?

Not all have unix to use this script.



On Apr 11, 8:47 pm, AD7six  wrote:
> On Apr 7, 1:42 pm, Dardo Sordi Bogado  wrote:
>
> > > George if Dardo doesnt get back to you let me know and I can forward
> > > the script to you, I just hope he's ok with me forwarding his work to
> > > others.
>
> > I've sent the code to Mike in a private email, but I'm ok with
> > whatever you do to that code.
>
> > Regards,
> > - Dardo.
>
> Dardo,
>
> Your bash script generates a nice looking pdf - why not wrap/adapt the
> code in a console task, fork the cookbook and add it as a plugin? I
> didn't do anything regarding pdfs since complete -> print -> save as
> pdf works pretty fine.
>
> Indeed you can't distribute any copies of the book's contents
> (regarding other comments in this thread) which prevents (~immediately
> outdated) copies of the book springing up and being found by the
> nubies.
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



RE: Containable

2009-04-11 Thread Dave Maharaj :: WidePixels.com

 Perfect!

Thanks, just what I needed! Works perfect now.

Dave
-Original Message-
From: Miles J [mailto:mileswjohn...@gmail.com] 
Sent: April-11-09 11:13 PM
To: CakePHP
Subject: Re: Containable


Remove the conditions, fields, and order. You only need to put those if you
are modifying/filtering the data in some way.

No data is being returned to the user, because you set fields to empty.


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



Re: Containable

2009-04-11 Thread Miles J

Remove the conditions, fields, and order. You only need to put those
if you are modifying/filtering the data in some way.

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



RE: Containable

2009-04-11 Thread Dave Maharaj :: WidePixels.com

Bookmark Model:

var $belongsTo = array(
 'User' =>
array('className' => 'User', 

'foreignKey' => 'user_id', 

'conditions' => '', 

'fields' => '', 

'order' => ''), 
 
 
 'Post' =>
array('className' => 'Post', 

'foreignKey' => 'post_id', 

'conditions' => '', 

'fields' => '', 

'order' => ''));

The table is id, user_id and post_id

-Original Message-
From: Miles J [mailto:mileswjohn...@gmail.com] 
Sent: April-11-09 9:01 PM
To: CakePHP
Subject: Re: Containable


So a bookmark has many posts correct? What does that association look like
in your model.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: authorize.net redirect

2009-04-11 Thread Sam DeVore

I don't think you will see the data from Authorize in this->data I  
think you will have to look at the raw data.  I can look at it on  
Monday but my wife has named my laptop for Easter weekend.

Sam d

===
Sent from my AT&T Rotary Phone
http://blog.samdevore.com


On Apr 11, 2009, at 10:34 AM, "SergioTorresC."  
 wrote:

>
> Samuel,
>
> Sorry to bother you again. Now I am having problems with authorize.net
> "relay response":
>
> I am using a testing account, so all my transactions go to
> https://test.authorize.net...
>
> I had my form posted to authorize.net
>
> I am shown their hosted payment form.
>
> My payment is processed right (the test credit card gets charged).
>
> But, there is an error when authorize.net tries to send the
> transaction report to my web site.
>
> I am receiving the following error message "An error occurred while
> trying to report this transaction to the merchant."
>
> My x_relay_URL value is 'http://[myserver]/invoicepayments/receipt'
>
> I am sure authorize.net tries to post to my x_relay_URL (I receive an
> error message when the receipt action is not allowed by the auth
> component).
>
> I tried to see authorize.net's answer using:
>
> In the controller receipt action: pr($this->data);
> In the receipt action view:  
> I tried leaving empty the controller action and view and then
> examining firebug/firephp console.
>
> Nothing worked.
>
> Can you help me with this?
>
> Thank you,
>
>
>
> On Mar 13, 1:43 pm, Samuel DeVore  wrote:
>> I had a similar problem and I created a page in between them filling
>> out 'my form' and sending them toAuthorize.net(it is a confirmation
>> looking page and explains why they are going to a new site)  this  
>> page
>> is a form of just hidden fields and a 'Continue' (the submit button)
>> and a 'Cancel' button that takes them back to the previous page.
>>
>> Sam D
>>
>> On Fri, Mar 13, 2009 at 11:34 AM, SergioTorresC.
>>
>>  wrote:
>>
>>> Thank you for your help Samuel,
>>
>>> I am not sure I understand what you say.
>>
>>> Do you mean you pass the client all theauthorize.nethidden fields
>>> and set the form action to be processed byauthorize.netinstead of
>>> your app?
>>
>>> In this case I would have problems with this solution, since I  
>>> need to
>>> do some tasks before callingauthorize.netsecure payment form.
>>
>>> Any ideas?
>>
>>> Thank you again,
>>
>>> On Mar 12, 9:57 am, Samuel DeVore  wrote:
 I have found that I have to make my forms actually point to Auth  
 dot
 net's servers  not make the post request in php.
>>
 Sam D
>>
 On Thu, Mar 12, 2009 at 8:47 AM, SergioTorresC.  
  wrote:
>>
> Hi there,
>>
> I am trying to hook up my cake application  
> withauthorize.netservice,
> to use their secure payment form and Relay Response, but just  
> can't
> get it to work.
>>
> I have a form where my customer reports the payment amount. The  
> form
> is processed in the back end class controller like this:
>>
> 1. I update all needed tables.
> 2. I instantiate cake HttpSocket class into $MyHS.
> 3. I build all required fields forauthorize.netand put them into a
> $post array
> 4. I call $response = $MyHS->post('authorize.neturl', $post)
>>
> According toauthorize.netdocs my customer should be presented  
> their
> secure payment form, but that does not happens. I even can't be  
> sure
> the post was made.
>>
> Can anybody help?
>>
> Thanks in advance,
>>
> Sergio Torres
> >

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



Re: Containable

2009-04-11 Thread Miles J

So a bookmark has many posts correct? What does that association look
like in your model.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: findBy and Contain

2009-04-11 Thread Miles J

Im pretty sure the magic findBy methods do not do contains or
recursions. You will have to do it manually.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake conventions and controllers with no model

2009-04-11 Thread Martin

Thanks!

On 11 tra, 21:59, Miles J  wrote:
> Honestly, its all up to you. But personally I prefer doing stand alone
> controllers then using pages. Pages is only useful for like an about
> us, bio, etc, type page.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



findBy and Contain

2009-04-11 Thread Dave Maharaj :: WidePixels.com

Can you use findBy with contain? I keep getting an error saying: 
Model "User" is not associated with model "User"

I am trying to clean up my queries and I have:
$user = $this->User->findBySlug($slug); 

which returns a lot of info from a lot of tables which is certainly not
needed since all I need to get is in the same table as the slug, the User
table so basically I want to findBy and contain to user table? Is that
possible?

MODEL:
function slugToId($slug)
{
 $cntn = $this->User->contain('User');
 $q = $this->User->findBySlug($slug, $cntn);
 
 return $q;
}

AGENT CONTROLLER:
$test = $this->Agent->slugToId($slug);
  debug($test);


TEST DEBUG:
Warning (512): Model "User" is not associated with model "User"
[CORE/cake/libs/model/behaviors/containable.php, line 340]

app/controllers/agents_controller.php (line 131)

Array
(
[User] => Array
(
[id] => 3
[group_id] => 3
[username] => dave
[password] => -
[email] => -
[slug] => mickeymouse
[confirmed] => 1
[confirm_code] => 49cc5013-0380-4086-bd30-448c4adcd75b
[created] => 2009-03-26 22:03:31
[modified] => 2009-03-26 22:03:31
)

)

 
Dave


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



Take away console header

2009-04-11 Thread mattalexx

Is there anyway to not display the header?:

Welcome to CakePHP v1.2.2.8120 Console
---
App : app
Path: /path/to/app
---

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Real time output from shell

2009-04-11 Thread mattalexx

Thank you!

On Apr 10, 8:42 pm, brian  wrote:
> $this->out(
>         sprintf(
>                 'foo is %s',
>                 $bar
>         )
> );
>
> On Fri, Apr 10, 2009 at 10:27 PM, mattalexx  wrote:
>
> > Sometimes my shell method will run for a long time. I'd like to be
> > able to output something as it runs instead of after it ends.
>
> > Is this possible with CakePHP?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Help determining Users/Groups and ACL Permissions

2009-04-11 Thread fly2279

I have the tables: Users, Groups, and GroupsUsers. Users belongToMany
Groups. I'm using ACL to manage Users (aros) having crud access to
Groups (acos) and individual Users (acos).

For example User.1 belongs to Group.A and Group.B and has create/read/
update to Group.A. User.2 belongs to Group.A.

When User.1 is logged in and tries to access app/users/view/2 I need
to check if User.1 has read access to one or more groups that User.2
belongs to or if User.1 has specific acl permissions to access User.2.
What is the most logical way to go about this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Containable

2009-04-11 Thread Dave Maharaj :: WidePixels.com

I am trying to figure my way thru the contain behaviour with limited
success.
 
I have a Bookmark which belongs to a User and also the Post. Bookmark table
is id, user_id, post_id
 
I want to get these from a query  - the bookmarks based on the user_id and
the title and description of the Post from the based on the bookmark_id.
 
I have:
 
$bookmarks = $this->Bookmark->find('all', 
 array(
'conditions' => array(
'Bookmark.user_id' => $id),
'contain' => 'Post',

//'recursive' => 2, //int
'fields' => array(
  'Bookmark.id', 'Bookmark.user_id', 'Bookmark.post_id'
 
  ));
 
which gets me 
Array
(
[0] => Array
(
[Bookmark] => Array
(
[id] => 1
[user_id] => 1
[post_id] => 10
)

[Post] => Array
(
[id] => 10
)

)

[1] => Array
(
[Bookmark] => Array
(
[id] => 2
[user_id] => 1
[post_id] => 12
)

[Post] => Array
(
[id] => 12
)

)
)
Getting all the bookmarks for the user and the posts related to each
bookmark, just not the specific fields I need. Post.title and
Post.description.

How can I get those into the query?

Thanks for all your help everyone, I know I ask a lot of questions.

Dave 


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



Re: Automatic fill in form field from controller

2009-04-11 Thread Miles J

Yeah this one took me a while to figure out also:
http://www.milesj.me/blog/read/24/pre_populating-form-values
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Running a cron/shell

2009-04-11 Thread Miles J

Aite ill try that and see if it works.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: uploading problem.working in localhost but when uploaded...error

2009-04-11 Thread Miles J

Your cake installation is not where it should be, or you changed the
CAKE_CORE_INCLUDE_PATH constant.

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



Re: Cake conventions and controllers with no model

2009-04-11 Thread Miles J

Honestly, its all up to you. But personally I prefer doing stand alone
controllers then using pages. Pages is only useful for like an about
us, bio, etc, type page.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: DRY function SOLVED

2009-04-11 Thread Walther

I would just change what you have to be a little bit less confusing.
Change from
$thisModel = $modelName;
$modelName = $this->User->$model_name->find('list', array('fields' =>
'name', 'order' => 'name ASC'));
$this->set($thisModel, $modelName);

To something like
$result= $this->User->$model_name->find('list', array('fields' =>
'name', 'order' => 'name ASC'));
$this->set($modelName , $result);

It just makes more sense then reusing the $modelName variable to store
your results in.

On Apr 11, 12:54 am, "Dave Maharaj :: WidePixels.com"
 wrote:
> Solved it
>
> $thisModel = $modelName;
> $modelName = $this->User->$model_name->find('list', array('fields' =>
> 'name', 'order' => 'name ASC'));
> $this->set($thisModel, $modelName);
>
> Now I can edit all my forms with 1 function from different models :)
>
> -Original Message-
> From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com]
> Sent: April-10-09 8:18 PM
> To: cake-php@googlegroups.com
> Subject: RE: DRY function
>
> OK I managed to get the form working but now it looks like 1 final issue.
>
> The:
>
> $skills = $this->User->$model_name->find('list', array('fields' => 'name',
> 'order' => 'name ASC'));
>               $this->set(compact('skills'));
>
> I need to make the $skills dynamic based on the $modelName, I tried using:
>
> $modelName = $this->User->$model_name->find('list', array('fields' =>
> 'name', 'order' => 'name ASC'));
>
> But nothing shows up because $this->set(compact('skills')); is empty, tried
> using $this->set(compact('$modelName')); and nothing.
>
> Any ideas?
>
> function update($slug, $modelName)
>       {
>           $this->User->recursive = 1;
>           $user = $this->User->findBySlug($slug);
>           $id = $user['User']['id'];
>           $model_name = Inflector::classify($modelName);
>           $this->set('model_used', $model_name);
>           if ($this->RequestHandler->isAjax()) {
>               $this->set('user', $this->User->read(null, $id));
>               if (!empty($this->data)) {
>                   if ($this->User->save($this->data)) {
>                   }
>               }
>               $skills = $this->User->$model_name->find('list',
> array('fields' => 'name', 'order' => 'name ASC'));
>               $this->set(compact('skills'));
>           }
>           if (empty($this->data)) {
>               $this->data = $this->User->read(null, $id);
>           }
>           $user = $this->User->read(null, $id);
>       }
>
> -Original Message-
> From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com]
> Sent: April-10-09 5:26 PM
> To: cake-php@googlegroups.com
> Subject: RE: DRY function
>
> OK I went with my original idea, changed the url and created 1 function to
> update everything individually. The problem I am running into now is when
> the form is displayed the options are no longer selected for each section.
>
> function update($slug, $modelName)
>       {
>           $user = $this->User->findBySlug($slug);
>           if ($this->RequestHandler->isAjax()) {
>
>               $this->set('user', $this->User->read(null, $id));
>               if (!empty($this->data)) {
>                   if ($this->User->save($this->data)) {
>                       //$this->view_$modelName($slug);
>                   }
>               }
>               $model_name = Inflector::classify($modelName);
>               $options = $this->User->$model_name->find('list',
> array('fields' => 'name', 'order' => 'name ASC'));
>               $this->set(compact('options'));
>                           debug(array($slug, $modelName, $id, $model_name));
>           }
>           if (empty($this->data)) {
>               $this->data = $this->User->read(null, $id);
>           }
>       }
>
> When I debug I get the correct info.
>
> $modelName = educations
> $model_name - Education
> $slug = the name on the account
> $id = the user id
>
> Just not sure why no info is being displayed on the form. (I have options
> selected in the original rendered view, when I click edit the form appears
> with all the options to choose from but the ones that were selected are now
> blank)
>
> Ideas?
>
> Thanks,
>
> Dave
> -Original Message-
> From: Walther [mailto:waltherl...@gmail.com]
> Sent: April-10-09 1:49 PM
> To: CakePHP
> Subject: Re: DRY function
>
> Your idea is the what I believe is the correct solution.
>
> Instead of calling $this->User->Skills->find... You'd call $this->User-
> >$modelName->find
>
> You'd need to do something with the view_skills and view_educations type
> functions. Assuming they are similar you could do $this->view ($slug,
> $modelName), otherwise perhaps move them into the model and call
> $this->User->$modelName->view($slug);
>
> Walther.
>
> On Apr 10, 5:34 pm, "Dave Maharaj :: WidePixels.com"
>  wrote:
> > I was hoping for some info on how to take 4 functions and make the
> > into 1.They all do the same thing except its a different model that they
> use.
> > They simply update

Cake conventions and controllers with no model

2009-04-11 Thread Martin

Hello!

I'm starting out with Cake and I just ran into a problem, or better
say a dilemma.

I have several pages on my website that work like static pages, but
some of the content is stored in a database because it has to change
depending on the language the user chooses (and the content is too big
for .po files), and it has to be editable by privileged users (new
content cannot be added and old content cannot be deleted, only
edited). Some of those pages also have side content which is generated
from data retireved from different models (latest news on homepage,
for an example).

Is the right way to handle this to write dedicated controllers (such
as a HomepageController) or a controller that works similar to Pages
controller? Or is there some other way?

Thanks.


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



Re: Getting "5 Related" Books via multiple Genres (HABTM ) from within Book view() and without requestAction

2009-04-11 Thread Mike Cook

Hi Joe,

During my experimentations I did come up with something similar, but
one of the problems is how to set the conditions to work on the Genre
ID.

So, I have a book that has two genre, "Mystery" (id=5) and "Short
Story" (id=20) and if I only try to search with say, "Mystery";

$id = 5;
$this->Genre->Book->similar($id);

The problem is that I don't know how to set the 'conditions' in the
find() so that it only brings up Books that have a Genre ID of 5.

I can't get 'conditions to work and I thought maybe I could use;

'contain => array('Genre.id' => $id),

but I get the error; Model "Genre" is not associated with model "5" --
obviously I don't know what I'm doing. :-|

How would I go about setting the conditions to grab books that only
have that Genre ID?

Mike

On Apr 11, 7:31 pm, Joe Critchley  wrote:
> You've currently got your similar() function in your
> genres_controller, whereas the primary model for the query is the Book
> model (as it's finding related *books*, not genres).
>
> I believe the following would be a more scalable approach.
>
> Place your similar() function into your Book model. (So it would
> be ... $similarBooks = $this->find('all') and just
> return your results).
>
> Then call this model's function from wherever you need it, whether it
> be the genres_controller:
>
> $this->Genre->Book->similar($id);
>
> ... or your books_controller
>
> $this->Book->similar($id);
>
>  or even from a completely unrelated model (use sparingly)
>
> $Book = ClassRegistry::init('Book');
> $similar = $Book->similar();
>
> It's possible that I'm missing the actual issue, but two important
> points: 1) never use requestAction (as you probably know), and 2)
> there should never be any variables in your views that aren't
> available in your controllers, because there shouldn't be any new
> variables assigned. If this is ever required, you're likely in need of
> a Helper class. And yes, it would be worth looking at creating
> elements for anything like "Similar books", or "5 Related Authors".
> You can pass variables into elements.
>
> I hope this helps.
>
> On Apr 11, 5:00 pm, Mike Cook  wrote:
>
> > In my books view.ctp, I want to have a list of 5 books that are
> > related via the genres data, which has a HABTM relationship. Although
> > I can do this by placing a function similar() in the
> > genres_controller, I have to call it from the view with requestAction.
>
> > // genres_controller.php
> >   function similar($id = null) {
> >     $similarbooks = $this->Genre->Book->find('all', array(
> >       'contain' => array(
> >         'Author' => array('fields' => array('id', 'slug')),
> >       ),
> >       'fields' => array('id', 'slug', 'title'),
> >       'limit' => 5,
> >       'order' => 'RAND()',
> >     ));
> >     $this->set(compact('similarbooks'));
> >   }
>
> > // Book view.ctp
> >   $results = $this->requestAction('/genres/similar/' . $id);
>
> > Of course I don't want to really use requestAction (the only place so
> > far I have used it!) but I would also like to be able to bring up 5
> > random books from ALL the genres the book is assigned to - at the
> > moment I am just searching on one genre id.
>
> > I also know that this approach is not very good if I wish to include 5
> > books which are related to say, both Genre and Author.
>
> > At some point down the line I would also like to include a "5 Related
> > Authors" list, so I guess I need a more modular approach (would
> > elements be it?) - the problem is that I am completely stumped, even
> > after a week looking at this!
>
> > The solution I currently have is better than nothing, but I would be
> > very grateful if anyone has an idea on how I could achieve a proper
> > solution.
>
> > Many thanks, Mike.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 with selecting fields in find on associated models

2009-04-11 Thread wilfredo

I have a problem when I try to select distinct fields in an associated
model with find. The models "Address" und "Expertise" have a HABTM
relation.

I have the following code in my controller. (There is no table named
mitglieder).

Expertise->find('list');
$this->set('fachgebiete',$fachgebiete);
$berufe = $this->Presentation->query('SELECT DISTINCT
beruf FROM `addresses` WHERE `mitglied` = "J" ORDER BY beruf ASC');
$this->set('berufe',$berufe);
$mitglieder = $this->Address->find('all',array
('fields'=>array
('Address.name','Expertise.fachgebiet'),'conditions'=>'`Address.mitglied`
= "J"','order'=>'`created` ASC','recursive'=>'1'));
 $this->set('mitglieder',$mitglieder);
   }

}
?>

I get the following error for the last find: "SQL Error: 1054: Unknown
column 'Expertise.fachgebiet' in 'field list'"

Query: SELECT `Address`.`name`, `Expertise`.`fachgebiet` FROM
`addresses` AS `Address`   WHERE `Address`.`mitglied` = "J"   ORDER BY
`created` ASC

What am I missing? I found examples like this in the web for cakephp.
Thanks!

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



Cake 1.2 Start Session Errors after install

2009-04-11 Thread P. Phunky

Hey all,

installed Cake on an ipower.com server. File Structure is

/
public_html/
_Dev
_Cake_1_2
___app
___cake
___ ...
___vendors

I get the following error when loading the default start page.

session_start() [function.session-start]: open(/var/php_sessions/
sess_55725da39073051a9529a124c99b54df, O_RDWR) failed: No such file or
directory (2) [CORE/cake/libs/session.php, line 539]

I've tried moving the tmp folder to the root level but still got error

any help would be greatly apperciated

thanks in advance

s

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Unique query

2009-04-11 Thread Dave Maharaj :: WidePixels.com

My User model has $hasMany = array(
'Bookmark' 

And my Post model has $hasMany = array(
'Bookmark'

I have a side module on the page where users view posts tht lists all the
users bookmarks for easy access and "save this post" link which saves the
post_id and the user_id to the bookmark table. I am just trying to write a
function that checks if it exists already then "You have bokmarked this post
already" or if not "Bookmark has been saved" type of idea.

Thanks,

Dave  

-Original Message-
From: Joe Critchley [mailto:joecri...@gmail.com] 
Sent: April-11-09 3:06 PM
To: CakePHP
Subject: Re: Unique query


Hi Dave.

If your Post and User models both have a HABTM relationship to Bookmark,
then you can use the ** "unique" => true ** parameter in the association.

This means that if it does find a duplicate record, it will override it.

I hope this helps.

On Apr 11, 6:11 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> I am trying to query a table to determine if the record exists as I do 
> not want duplicates but not sure if this is correct.
>
> $results = $this->find('first', array('conditions' => 
> array('Bookmark.user_id' => $user_id, 'Bookmark.post_id' => 
> $post_id))); debug($results);
>
> so if the user_id and the post_id are in the same row then do not save 
> the bookmark because it already exists.
>
> Is this right?
>
> Dave


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



CakePHP and SugarCRM

2009-04-11 Thread Jerry

Has anyone seen any work on using CakePHP to generate applications to
interact with SugarCRM via Soap calls?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Unique query

2009-04-11 Thread Joe Critchley

Hi Dave.

If your Post and User models both have a HABTM relationship to
Bookmark, then you can use the ** "unique" => true ** parameter in the
association.

This means that if it does find a duplicate record, it will override
it.

I hope this helps.

On Apr 11, 6:11 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> I am trying to query a table to determine if the record exists as I do not
> want duplicates but not sure if this is correct.
>
> $results = $this->find('first', array('conditions' =>
> array('Bookmark.user_id' => $user_id, 'Bookmark.post_id' => $post_id)));
> debug($results);
>
> so if the user_id and the post_id are in the same row then do not save the
> bookmark because it already exists.
>
> Is this right?
>
> Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: authorize.net redirect

2009-04-11 Thread SergioTorresC.

Samuel,

Sorry to bother you again. Now I am having problems with authorize.net
"relay response":

I am using a testing account, so all my transactions go to
https://test.authorize.net...

I had my form posted to authorize.net

I am shown their hosted payment form.

My payment is processed right (the test credit card gets charged).

But, there is an error when authorize.net tries to send the
transaction report to my web site.

I am receiving the following error message "An error occurred while
trying to report this transaction to the merchant."

My x_relay_URL value is 'http://[myserver]/invoicepayments/receipt'

I am sure authorize.net tries to post to my x_relay_URL (I receive an
error message when the receipt action is not allowed by the auth
component).

I tried to see authorize.net's answer using:

In the controller receipt action: pr($this->data);
In the receipt action view:   wrote:
> I had a similar problem and I created a page in between them filling
> out 'my form' and sending them toAuthorize.net(it is a confirmation
> looking page and explains why they are going to a new site)  this page
> is a form of just hidden fields and a 'Continue' (the submit button)
> and a 'Cancel' button that takes them back to the previous page.
>
> Sam D
>
> On Fri, Mar 13, 2009 at 11:34 AM, SergioTorresC.
>
>  wrote:
>
> > Thank you for your help Samuel,
>
> > I am not sure I understand what you say.
>
> > Do you mean you pass the client all theauthorize.nethidden fields
> > and set the form action to be processed byauthorize.netinstead of
> > your app?
>
> > In this case I would have problems with this solution, since I need to
> > do some tasks before callingauthorize.netsecure payment form.
>
> > Any ideas?
>
> > Thank you again,
>
> > On Mar 12, 9:57 am, Samuel DeVore  wrote:
> >> I have found that I have to make my forms actually point to Auth dot
> >> net's servers  not make the post request in php.
>
> >> Sam D
>
> >> On Thu, Mar 12, 2009 at 8:47 AM, SergioTorresC.  
> >> wrote:
>
> >> > Hi there,
>
> >> > I am trying to hook up my cake application withauthorize.netservice,
> >> > to use their secure payment form and Relay Response, but just can't
> >> > get it to work.
>
> >> > I have a form where my customer reports the payment amount. The form
> >> > is processed in the back end class controller like this:
>
> >> > 1. I update all needed tables.
> >> > 2. I instantiate cake HttpSocket class into $MyHS.
> >> > 3. I build all required fields forauthorize.netand put them into a
> >> > $post array
> >> > 4. I call $response = $MyHS->post('authorize.neturl', $post)
>
> >> > According toauthorize.netdocs my customer should be presented their
> >> > secure payment form, but that does not happens. I even can't be sure
> >> > the post was made.
>
> >> > Can anybody help?
>
> >> > Thanks in advance,
>
> >> > Sergio Torres
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Getting "5 Related" Books via multiple Genres (HABTM ) from within Book view() and without requestAction

2009-04-11 Thread Joe Critchley

You've currently got your similar() function in your
genres_controller, whereas the primary model for the query is the Book
model (as it's finding related *books*, not genres).

I believe the following would be a more scalable approach.

Place your similar() function into your Book model. (So it would
be ... $similarBooks = $this->find('all') and just
return your results).

Then call this model's function from wherever you need it, whether it
be the genres_controller:

$this->Genre->Book->similar($id);

... or your books_controller

$this->Book->similar($id);

 or even from a completely unrelated model (use sparingly)

$Book = ClassRegistry::init('Book');
$similar = $Book->similar();

It's possible that I'm missing the actual issue, but two important
points: 1) never use requestAction (as you probably know), and 2)
there should never be any variables in your views that aren't
available in your controllers, because there shouldn't be any new
variables assigned. If this is ever required, you're likely in need of
a Helper class. And yes, it would be worth looking at creating
elements for anything like "Similar books", or "5 Related Authors".
You can pass variables into elements.

I hope this helps.

On Apr 11, 5:00 pm, Mike Cook  wrote:
> In my books view.ctp, I want to have a list of 5 books that are
> related via the genres data, which has a HABTM relationship. Although
> I can do this by placing a function similar() in the
> genres_controller, I have to call it from the view with requestAction.
>
> // genres_controller.php
>   function similar($id = null) {
>     $similarbooks = $this->Genre->Book->find('all', array(
>       'contain' => array(
>         'Author' => array('fields' => array('id', 'slug')),
>       ),
>       'fields' => array('id', 'slug', 'title'),
>       'limit' => 5,
>       'order' => 'RAND()',
>     ));
>     $this->set(compact('similarbooks'));
>   }
>
> // Book view.ctp
>   $results = $this->requestAction('/genres/similar/' . $id);
>
> Of course I don't want to really use requestAction (the only place so
> far I have used it!) but I would also like to be able to bring up 5
> random books from ALL the genres the book is assigned to - at the
> moment I am just searching on one genre id.
>
> I also know that this approach is not very good if I wish to include 5
> books which are related to say, both Genre and Author.
>
> At some point down the line I would also like to include a "5 Related
> Authors" list, so I guess I need a more modular approach (would
> elements be it?) - the problem is that I am completely stumped, even
> after a week looking at this!
>
> The solution I currently have is better than nothing, but I would be
> very grateful if anyone has an idea on how I could achieve a proper
> solution.
>
> Many thanks, Mike.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Unique query

2009-04-11 Thread Dave Maharaj :: WidePixels.com
I am trying to query a table to determine if the record exists as I do not
want duplicates but not sure if this is correct.
 
$results = $this->find('first', array('conditions' =>
array('Bookmark.user_id' => $user_id, 'Bookmark.post_id' => $post_id)));
debug($results);
 
so if the user_id and the post_id are in the same row then do not save the
bookmark because it already exists.
 
Is this right?
 
Dave 

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



Getting "5 Related" Books via multiple Genres (HABTM ) from within Book view() and without requestAction

2009-04-11 Thread Mike Cook

In my books view.ctp, I want to have a list of 5 books that are
related via the genres data, which has a HABTM relationship. Although
I can do this by placing a function similar() in the
genres_controller, I have to call it from the view with requestAction.

// genres_controller.php
  function similar($id = null) {
$similarbooks = $this->Genre->Book->find('all', array(
  'contain' => array(
'Author' => array('fields' => array('id', 'slug')),
  ),
  'fields' => array('id', 'slug', 'title'),
  'limit' => 5,
  'order' => 'RAND()',
));
$this->set(compact('similarbooks'));
  }

// Book view.ctp
  $results = $this->requestAction('/genres/similar/' . $id);

Of course I don't want to really use requestAction (the only place so
far I have used it!) but I would also like to be able to bring up 5
random books from ALL the genres the book is assigned to - at the
moment I am just searching on one genre id.

I also know that this approach is not very good if I wish to include 5
books which are related to say, both Genre and Author.

At some point down the line I would also like to include a "5 Related
Authors" list, so I guess I need a more modular approach (would
elements be it?) - the problem is that I am completely stumped, even
after a week looking at this!

The solution I currently have is better than nothing, but I would be
very grateful if anyone has an idea on how I could achieve a proper
solution.

Many thanks, Mike.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: ACL - How to handle multiple nested levels of accounts

2009-04-11 Thread jmcneese

i guess the theoretical limit on a 32bit system is 4,294,967,296
(2^32), but my first question would be do you need unlimited groups,
or unlimited roles?  roles being the classification of user where
actual ACL permissions are attached (role "a" can access the
users::add method, but role "b" is not, etc)...  a user could have an
unlimited amount of roles.

On Apr 10, 12:49 pm, zonium  wrote:
> Thank you jmcneese for showing me an alternative to the cake's ACL.
> Your articles help me understand weaknesses of ACL when used to
> safeguard records. It's was interesting to see immediate attentions/
> reactions from the core developers on those articles as well.
>
> One problem (in my case) with the solution you presented is that
> groups are powers of two.This limits the number of groups to the
> number of bits in an integer. I have unlimited numbers of "groups".
>
> Besides, in my case, "groups" are not in one table where I can use
> parent_id linking entries for tree behavior to work.
>
> I am still looking for advice. Would like to hear from any one who has
> dealt with a similar situation as mine.
>
> On Apr 7, 7:09 am, jmcneese  wrote:
>
> > would this help?
>
> >http://jmcneese.wordpress.com/2009/04/05/row-level-model-access-contr...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Change App Base URL

2009-04-11 Thread rich...@home

I'm guessing you still have all the old directory information cached.

go to app/tmp/ and remove all the files in all the subfolders but
leave the subfolders intact.

On Apr 11, 12:58 pm, AD7six  wrote:
> On Apr 11, 12:36 pm, CapeTownGuy  wrote:
>
> > Hi,
>
> > I installed an application in the root webfolder and then decided to
> > move it to a subfolder from the root, however the application broke
> > thereafter.  
>
> Define broke
>
> > Can somebody explain to me how to change the settings in
> > the core.php or where applicable to get the app to work again.
>
> THere's nothing to change, move your cake application (all of it,
> assuming you have a dev style - the default - install) to wherever you
> want and point your browser at it.
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Offline version of the CakePHP manual.

2009-04-11 Thread Mike Cook

> Indeed you can't distribute any copies of the book's contents
> (regarding other comments in this thread) which prevents (~immediately
> outdated) copies of the book springing up and being found by the
> nubies.

...as the file on my is already outdated I should take your comments
as an indication that it should be removed.

no problem.

Mike


On Apr 11, 1:47 pm, AD7six  wrote:
> On Apr 7, 1:42 pm, Dardo Sordi Bogado  wrote:
>
> > > George if Dardo doesnt get back to you let me know and I can forward
> > > the script to you, I just hope he's ok with me forwarding his work to
> > > others.
>
> > I've sent the code to Mike in a private email, but I'm ok with
> > whatever you do to that code.
>
> > Regards,
> > - Dardo.
>
> Dardo,
>
> Your bash script generates a nice looking pdf - why not wrap/adapt the
> code in a console task, fork the cookbook and add it as a plugin? I
> didn't do anything regarding pdfs since complete -> print -> save as
> pdf works pretty fine.
>
> Indeed you can't distribute any copies of the book's contents
> (regarding other comments in this thread) which prevents (~immediately
> outdated) copies of the book springing up and being found by the
> nubies.
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



uploading problem.working in localhost but when uploaded...error

2009-04-11 Thread jahid


Warning: include(cake/bootstrap.php) [function.include]: failed to
open stream: No such file or directory in /home2/qbanglac/public_html/
girls/index.php on line 80

Warning: include() [function.include]: Failed opening 'cake/
bootstrap.php' for inclusion (include_path='/home2/qbanglac/
public_html/girls/application:/home2/qbanglac/public_html/girls/
application/app//:.:/usr/lib/php:/usr/local/lib/php') in /home2/
qbanglac/public_html/girls/index.php on line 80

Fatal error: Can't find CakePHP core. Check the value of
CAKE_CORE_INCLUDE_PATH in app/webroot/index.php. It should point to
the directory containing your /cake core directory and your /vendors
root directory. in /home2/qbanglac/public_html/girls/index.php on line
81

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



Re: Session Cookie hep

2009-04-11 Thread brian

On Sat, Apr 11, 2009 at 9:54 AM, Dave Maharaj :: WidePixels.com
 wrote:
>
> Reading thru the cookbook on cookies and sessions but I cannot get it to
> work. I have the toolbar installed so I can see the data easier. I have this
> in my app_controller:
>
> var $components = array('Auth', 'Acl', 'RequestHandler', 'Cookie',
> 'DebugKit.Toolbar');
>      var $helpers = array('Html', 'Form', 'Javascript', 'Mailto', 'Time',
> 'Ajax');
>      var $cookieName = 'mysite';
>      var $cookieKey = '^SIp3';
>      var $cookieTime = 7200;


function beforeFilter()
{
$this->Cookie->name = 'mysite';
$this->Cookie->key = '^SIp3';
$this->Cookie->time = 7200;
}


>
> in my User login ()
> i have this just to test it out
>
> // Grab some data from the User table and set them to the cookie array
>                  $cookie = array();
>                  $cookie['user_id'] = $this->Auth->user('id');
>                  $cookie['firstname'] = $this->Auth->user('firstname');
>                $cookie['slug'] = $this->Auth->user('slug');
>
>                  $this->Session->write('Auth.User', $cookie);
>

$this->Cookie->write('user_id', $this->Auth->user('id'));
$this->Cookie->write('firstname', $this->Auth->user('firstname'));
$this->Cookie->write('slug', $this->Auth->user('slug'));

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Running a cron/shell

2009-04-11 Thread brian

I think that should be:

0 0 * * * php -q /path/to/...

On Sat, Apr 11, 2009 at 5:44 AM, Miles J  wrote:
>
> So I have written a shell script (named Cron) that works perfectly in
> console. When I set it as a cron tab, it continually shows the content
> below and doesnt run, any ideas why?
>
> This is my cron: 0 0 * * * php /path/to/my/cake/console/cake cron
>
> Error:
>
> 
> #
> # Bake is a shell script for running CakePHP bake script
> # PHP versions 4 and 5
> #
> # CakePHP(tm) :  Rapid Development Framework (http://www.cakephp.org)
> # Copyright 2005-2007, Cake Software Foundation, Inc.
> #
> # Licensed under The MIT License
> # Redistributions of files must retain the above copyright notice.
> #
> # @filesource
> # @copyright            Copyright 2005-2007, Cake Software Foundation, Inc.
> # @link                         
> http://www.cakefoundation.org/projects/info/cakephp CakePHP
> (tm) Project
> # @package                      cake
> # @subpackage           cake.cake.console
> # @since                                CakePHP(tm) v 1.2.0.5012
> # @version                      $Revision: 7945 $
> # @modifiedby           $LastChangedBy: gwoo $
> # @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
> # @license                      
> http://www.opensource.org/licenses/mit-license.php The
> MIT License
> #
> 
> clear
>
> LIB=${0/%cake/}
> APP=`pwd`
>
> exec php -q ${LIB}cake.php -working "${APP}" "$@"
>
> exit;
> >
>

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



Re: Pagination in Search Forms

2009-04-11 Thread Sourav

Thanks a lot, it works perfect !

On Apr 11, 12:39 pm, Miles J  wrote:
> You would have to remove the array_map, and do your own loop.
>
> $clean = array();
> foreach ($this->data[Inflector::camelize($model)] as $data) {
>         $clean[] = (is_array($data)) ? implode(',', $data) : urlencode
> ($data);
>
> }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Session Cookie hep

2009-04-11 Thread Dave Maharaj :: WidePixels.com

Reading thru the cookbook on cookies and sessions but I cannot get it to
work. I have the toolbar installed so I can see the data easier. I have this
in my app_controller:
 
var $components = array('Auth', 'Acl', 'RequestHandler', 'Cookie',
'DebugKit.Toolbar');
  var $helpers = array('Html', 'Form', 'Javascript', 'Mailto', 'Time',
'Ajax');
  var $cookieName = 'mysite';
  var $cookieKey = '^SIp3';
  var $cookieTime = 7200;
 
in my User login () 
i have this just to test it out
 
// Grab some data from the User table and set them to the cookie array
  $cookie = array();
  $cookie['user_id'] = $this->Auth->user('id');
  $cookie['firstname'] = $this->Auth->user('firstname');
$cookie['slug'] = $this->Auth->user('slug');
  
  $this->Session->write('Auth.User', $cookie);
 
but it apears nothing is being written anywhere. Can someone point out what
I am missing or doing wrong?
 
 
Dave


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



Re: Offline version of the CakePHP manual.

2009-04-11 Thread psykro

AD, thats a cool idea.

Dardo, if you decide not to do it, let me know, as I'd like to give it
a bash (with your permission, as I'd be using your script as a
starting point)

I'd still like to get to a point where one could setup an offline web
version of the manual as it appears online, I just love the search
functionality and the ability to have the section links on one side
while reading, but as gwoo mentioned to me the db changes too much for
it to be feasible. maybe one day

On Apr 11, 1:47 pm, AD7six  wrote:
> On Apr 7, 1:42 pm, Dardo Sordi Bogado  wrote:
>
> > > George if Dardo doesnt get back to you let me know and I can forward
> > > the script to you, I just hope he's ok with me forwarding his work to
> > > others.
>
> > I've sent the code to Mike in a private email, but I'm ok with
> > whatever you do to that code.
>
> > Regards,
> > - Dardo.
>
> Dardo,
>
> Your bash script generates a nice looking pdf - why not wrap/adapt the
> code in a console task, fork the cookbook and add it as a plugin? I
> didn't do anything regarding pdfs since complete -> print -> save as
> pdf works pretty fine.
>
> Indeed you can't distribute any copies of the book's contents
> (regarding other comments in this thread) which prevents (~immediately
> outdated) copies of the book springing up and being found by the
> nubies.
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Automatic fill in form field from controller

2009-04-11 Thread AD7six



On Apr 11, 11:37 am, Paco Gomez  wrote:
> Hello,
>
> I'd like automatic filling in a form field, for example a textbox with
> the data from the database. Is that possible?
>
> For example, how I have to name my form field and name my varabel? :

Revisit your question after doing the blog tutorial (see the edit
function)

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Change App Base URL

2009-04-11 Thread AD7six



On Apr 11, 12:36 pm, CapeTownGuy  wrote:
> Hi,
>
> I installed an application in the root webfolder and then decided to
> move it to a subfolder from the root, however the application broke
> thereafter.  

Define broke

> Can somebody explain to me how to change the settings in
> the core.php or where applicable to get the app to work again.

THere's nothing to change, move your cake application (all of it,
assuming you have a dev style - the default - install) to wherever you
want and point your browser at it.

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Limiting select to certain values

2009-04-11 Thread AD7six



On Apr 9, 5:13 pm, Toby  wrote:
> Hi there,
>
> I have 4 table that relate to this problem...
> - Products
> - Types
> - Sizes
> - StockItems
>
> I have set CakePHP so that each product has a Type.
> I am now sorting out the StockItems controller/views.  Each StockItem
> will relate to a single Product and will specify the Size of the
> StockItem.
>
> My question is... On the StockItem Edit page, how do I limit the Size
> drop-down to only display the Sizes that relate to the Type of the
> Product?

you use a condition, like you would for any find. i.e.

$this->set('sizes', $this->StockItem->Size->find('list', array
('conditions' => edit here));

hth,

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



Re: Pagination problem in search functionality

2009-04-11 Thread AD7six



On Apr 10, 2:03 pm, kaushik  wrote:
> I have a search form for Blog with pagination. The form is like below.
>
>  id="BlogSearchForm" method="post" action="/blogs/search">
> 
> 
> 
>  id="keywords" />
>  id="category" />
>  value="Search" />
> 
>
> I want to set so that the url after hitting search button, it should
> come with all the params. I mean it should: "http://
> videon.smallbizmavericks.com/blogs/search/keywords:test1/
> category:test2", so that in pagination I can use the in pagination
> link like below:
>
> $paginator->options(array('url' => $this->passedArgs));
>
> If it is not possible, how to pass this arguments to paginator for
> first time?

it's simpler to just handle the post rather than p about with js to do
it.

function index () {
 if ($this->data) {
 return $this->redirect($this->data['Blog']);
}
$this->set('posts', $this->paginate($this->params['named']));
}

styley.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Offline version of the CakePHP manual.

2009-04-11 Thread AD7six



On Apr 7, 1:42 pm, Dardo Sordi Bogado  wrote:
> > George if Dardo doesnt get back to you let me know and I can forward
> > the script to you, I just hope he's ok with me forwarding his work to
> > others.
>
> I've sent the code to Mike in a private email, but I'm ok with
> whatever you do to that code.
>
> Regards,
> - Dardo.

Dardo,

Your bash script generates a nice looking pdf - why not wrap/adapt the
code in a console task, fork the cookbook and add it as a plugin? I
didn't do anything regarding pdfs since complete -> print -> save as
pdf works pretty fine.

Indeed you can't distribute any copies of the book's contents
(regarding other comments in this thread) which prevents (~immediately
outdated) copies of the book springing up and being found by the
nubies.

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Looking for a HABTM solution

2009-04-11 Thread AD7six



On Apr 10, 4:41 pm, jsundquist  wrote:
> What I am looking to do is kind of complex and I'm not sure the best
> way to go about doing it. I have two tables that get joined twice two
> each other. Going the same way each time.
>
> table_1 --> table_1_table_2 --> table_2
>
> and
>
> table_1 --> table_1_table_3 --> table 2
>
> They both techically have the same information however the second join
> table actually has a few extra columns in it that are needed but use
> the primary keys from table 1 and table 2. Is this possible using the
> cake framework?

Yes.

>  If I was to just write the statement myself I know I
> could do it but don't know how CakePHP handles things like that.

see http://book.cakephp.org/search/associations . Note that a join
table with more than 2 fields is usually best treated as a 'real'
model. (e.g. User hasMany Friend, Friend belongs to FromUser, ToUser)

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: ACL denied access to logout()

2009-04-11 Thread AD7six



On Apr 10, 8:50 pm, djXternal  wrote:
> I have finally managed to get my ACL working, realized I was having
> issues using UUID's, now the super user can access everything fine
> when logged in and logout.  But users with privledges lesser than that
> user, who do now have access to the 'Users' controller cannot logout.
> When I go to /Users/logout I get a 'You are not authorized to access
> that location.' error.  I tried adding permissions to that lesser user
> to ba able to access only the logout action of the Users controller by
> doing 'cake acl grant Users Users logout', Users being the low-level
> group, and I still cannot access it.

you just need to $this->Auth->allow('logout'); i.e. make it publicly
accessible.

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 of dynamic fields

2009-04-11 Thread GetIT

Thanks Paco!

This would help, but unfortunately  I use another javascript-library
which won´t work together with prototype.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Anyone has used a cakePHP paginator class that can paginate for non database records

2009-04-11 Thread AD7six



On Apr 10, 5:26 pm, Anibigi  wrote:
> Hi,
>
> I'm a newbie to cakePHP.
> I want a paginator class that would work well with both database and
> non database record set.

The core pagination functionality does that - since it only defines
the parameters you'd pass to your model and doesn't care how the model
is storing/retrieving its data.

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



Re: Yet another Pagination Question (custom query but don't have a model to overwrite paginator)

2009-04-11 Thread AD7six



On Apr 11, 8:28 am, nc  wrote:
> Anyone?
>
> On Apr 9, 8:51 pm, nc  wrote:
>
> > I have a Search controller that handles search-related tasks in my
> > project and one of the requirements is that given a query (let's say
> > $query) it should search for $query in table a (model A), table b
> > (model B), table c (model C), and table d (model D). This Search
> > controller  DOES NOT have a Search model associated with it

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



Change App Base URL

2009-04-11 Thread CapeTownGuy

Hi,

I installed an application in the root webfolder and then decided to
move it to a subfolder from the root, however the application broke
thereafter.  Can somebody explain to me how to change the settings in
the core.php or where applicable to get the app to work again.

Thanks.

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



Automatic fill in form field from controller

2009-04-11 Thread Paco Gomez

Hello,

I'd like automatic filling in a form field, for example a textbox with
the data from the database. Is that possible?

For example, how I have to name my form field and name my varabel? :

/view/example.ctp
form->input('data');

/controller/some_example.php
function example()
{
  this->set('data',this->model->find());
}

Thank you in advantage

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 of dynamic fields

2009-04-11 Thread Paco Gomez

I don't know if I response your question, but I use this:

http://tetlaw.id.au/view/javascript/really-easy-field-validation

On 11 abr, 00:25, GetIT  wrote:
> Hello,
>
> I want to validate dynamic fields.
>
> Normally validation is done by defining rules for a table field.
> For example:
>
> var $validate = array('Fieldname'  =>  some rules)
>
> But I have defined my fields in this table:
> Table: fields
> id:int(6)
> tab_id:int(4)
> attribute:varchar(60)
> type:varchar(10)
> options:varchar(20)
> selected:varchar(2)
> position:smallint(4)
> value:varchar(2)
> checked:tinyint(1)
> optional:tinyint(1)
>
> And a few example inputs:
> INSERT INTO `fields` VALUES (1, 1,'Name',NULL,NULL,NULL,1,NULL,NULL,
> 0);
> INSERT INTO `fields` VALUES (12,3,'mit Aphasie','radio','ja, nein','2',
> 3,NULL,NULL,0);
> INSERT INTO `fields` VALUES (42,3,'CheckboxTest','check','',NULL,4,'4',
> 1,1);
>
> So I need to define a validation like that:
>
> foreach (values_in_table as $value) {
>   if ($value['optional'] == 0) {
>     var $validate = array(
>       $value['attribute']  =>  array(
>          'rule'        =>  'alphaNumeric',
>          'required'  =>  'true'
>       )
>     );
>   }
>
> }
>
> I hope its clear what i mean.
>
> Can I do this?

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



Running a cron/shell

2009-04-11 Thread Miles J

So I have written a shell script (named Cron) that works perfectly in
console. When I set it as a cron tab, it continually shows the content
below and doesnt run, any ideas why?

This is my cron: 0 0 * * * php /path/to/my/cake/console/cake cron

Error:


#
# Bake is a shell script for running CakePHP bake script
# PHP versions 4 and 5
#
# CakePHP(tm) :  Rapid Development Framework (http://www.cakephp.org)
# Copyright 2005-2007, Cake Software Foundation, Inc.
#
# Licensed under The MIT License
# Redistributions of files must retain the above copyright notice.
#
# @filesource
# @copyrightCopyright 2005-2007, Cake Software Foundation, Inc.
# @link 
http://www.cakefoundation.org/projects/info/cakephp CakePHP
(tm) Project
# @package  cake
# @subpackage   cake.cake.console
# @sinceCakePHP(tm) v 1.2.0.5012
# @version  $Revision: 7945 $
# @modifiedby   $LastChangedBy: gwoo $
# @lastmodified $Date: 2008-12-18 18:16:01 -0800 (Thu, 18 Dec 2008) $
# @license  
http://www.opensource.org/licenses/mit-license.php The
MIT License
#

clear

LIB=${0/%cake/}
APP=`pwd`

exec php -q ${LIB}cake.php -working "${APP}" "$@"

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



Re: Pagination in Search Forms

2009-04-11 Thread Miles J

You would have to remove the array_map, and do your own loop.

$clean = array();
foreach ($this->data[Inflector::camelize($model)] as $data) {
$clean[] = (is_array($data)) ? implode(',', $data) : urlencode
($data);
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---