Re: textmate snippets not working

2009-09-02 Thread mikeottinger

Hi All,

   So I ditched the bundle and went searching for another source. Lo
and behold I found this:

   http://www.etoxified.com/cakephp-bundle-for-textmate

   It requires git, but I downloaded it refreshed my bundles and
voila, it worked. I'm running textmate 1.5.8, I'm wondering if there
are compatibility issues with this and version of the CakePHP bundle
available through the svn url above. Sort of a shot in the dark in
terms of explanation, but I'm at a loss as to why I couldn't get it
working before. Hopefully this is helpful to others.

Thanks.

On Sep 2, 7:47 am, mikeottinger  wrote:
> Thanks for the help. Yes, there's one bundle, it was a typo. And I
> removed it and reinstalled it within /Library/Application Support/
> TextMate/Bundles like this:
>
> svn cohttp://svn.textmate.org/trunk/Review/Bundles/PHP%20Cake.tmbundle/
>
> I then fired up TextMate, but alas, still no luck. I went into the
> bundle's Snippet directory and listed the permissions there:
>
> -rw-r--r--
>
> Don't these need to be executable?
>
> Thanks again.
>
> On Sep 2, 3:36 am, Martin Westin  wrote:
>
> > Bundles? Unless that's a typo, you might need to stick with one bundle
> > for CakePHP or you might get some conflict.
>
> > I have this 
> > onehttp://svn.textmate.org/trunk/Review/Bundles/PHP%20Cake.tmbundle
> > installed in ~/Library/Application Support/TextMate/Bundles/
>
> > It works as it should for me. "dat" will expand to "$this->data['…']"
> > for example.
>
> > I have a vague memory of some bundle causing me problems because of
> > file permissions. Try chmodding your bundle (which is one of these
> > Apple faux-directories) to make sure Textmate can do it's thing. If
> > you check it out using subversion they should be ok but you never
> > know.
>
> > On Sep 2, 8:15 am, mikeottinger  wrote:
>
> > > Hi All, I've scoured the web and had no luck, I've installed the
> > > bundles for cakephp, I've set the file type for my php file to HTML
> > > (PHP Cake), yet none of the snippets work for me. For instance, I try
> > > typing dat then hitting tab and nothing happens. Is there something
> > > else I'm missing perhaps? Is this not a fully supported bundle
> > > anymore?
>
> > > Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Anyone get the Email Component to work with gmail smtp.gmail.com?

2009-09-02 Thread bunwich

Hi,

I changed the port to 465 and tried 'smtp.gmail.com' for the host.

Also used the host 'ssl://smtp.gmail.com'

The email works fine with sendmail.

Anyone know if tsl/ssl is supported?

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



Re: How to not escape Javascript in html helper link

2009-09-02 Thread Dr. Loboto

But your example was about double quotes that is wrong INITIALLY.

Btw, on my cakes there are no problems with single quotes in tags
attributes at all. What exact cake version do you have?

On Sep 2, 3:48 pm, Kana  wrote:
> Quoting myself:
> "I already mentioned trying both SINGLE quotes and DOUBLE quotes. Both
> result in escaped quotes, hence this post. "
>
> I could have been more clear on where exactly I tried both double and
> single quotes :)
>
> On Sep 2, 9:44 am, Kana  wrote:
>
>
>
> > Hi there, thanks for your quick reply.
>
> > I already mentioned trying both SINGLE quotes and DOUBLE quotes. Both
> > result in escaped quotes, hence this post.
>
> > The example you gave results in:
>
> >  > onClick="pageTracker._trackEvent('category',
> > 'action', 'label');">
> > >
>
> > Is there something I am overlooking here? Is it justnotpossible to
> > haveJavascriptin $html->link() ?
>
> > :)
>
> > Kana
>
> > On Sep 2, 4:03 am, "Dr. Loboto"  wrote:
>
> > > Use SINGLE QUOTES when need quotes in tag attributes. It is the basics
> > > ofHTML.
>
> > >  > >     echo $html->link(
> > >         $html->image('an_image.jpg'),
> > >         '/image/a_link.php?test',
> > >         array(
> > >             'class' => 'image',
> > >             'escape' => false,
> > >             'onClick' => "pageTracker._trackEvent('category',
> > > 'action', 'label');"
> > >         ),
> > >         false,
> > >         false
> > > );
> > > ?>
>
> > > On Sep 2, 12:15 am, Kana  wrote:
>
> > > > How tonotescapeJavascriptinhtmlhelperlinkwithout having to use
> > > >Javascriptoutside $html->link?
>
> > > > I try to achieve:
> > > > - the quotes in the onClick event, either single or double quotes
>
> > > >  > > > onClick="pageTracker._trackEvent("category", "action", "label");">
> > > >         
> > > > 
>
> > > > But the result I get when viewing pagesource is:
> > > > - note the escaped quotes
> > > > - I tried single and double quotes
>
> > > >  > > > onClick="pageTracker._trackEvent("category",
> > > > "action", "label");">
> > > >         
> > > > 
>
> > > > I use the following code:
>
> > > >  > > > echo $html->link(
> > > >         $html->image('an_image.jpg'),
> > > >         '/image/a_link.php?test',
> > > >         array('class' => 'image', 'escape' => false, 'onClick' =>
> > > > 'pageTracker._trackEvent("category", "action", "label");'),
> > > >         false,
> > > >         false
> > > > );
> > > > ?>
>
> > > > There must be a way to onClickJavascriptworking inlink? I Googled
> > > > but couldn't find any topic on 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
-~--~~~~--~~--~--~---



Re: Auth/ACL -> using auth->Authorize='crud' and non-standard actions

2009-09-02 Thread mig_akira


OOOPS!!! 
where I said 
$this->Auth->actionPath = 'controllers/'

I really meant 
auth->Authorize='crud'

sorry for the confusion!!!


mig_akira wrote:
> 
> Hello everyone.
> 
> I'm using auth and acl in my website, and I'm using the 'crud' way to
> grant or deny access. Everything is fine, except that I don't know how to
> grant or deny access to a non-standard action in a controller. 
> 
> For example, in my postsController, I have the actions add, read, index,
> view, etc. All of those are standard, so I just type in the command line:
> 
> cake acl grant Admin Posts '*'  
> 
> And I have access for all those actions, because aros_acos table will be
> changed accordingly.
> 
> But what if I have an action there called "moveUp", for example? How can I
> grant or deny access to this action?
> 
> FOr now I'm using 
> 
> Function beforeFilter {
>$this->Auth->allowedActions = array('moveUp');
> }
> 
> But this isn't safe, as you can imagine =P
> 
> Thanks guys! I hope I made myself clear, this ACL/Auth stuff is still a
> bit confusing to me!
> 

-- 
View this message in context: 
http://www.nabble.com/Auth-ACL--%3E-using-actionPath-%3E%27controllers%27-and-non-standard-actions-tp25269069p25269129.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Auth/ACL -> using actionPath->'controllers' and non-standard actions

2009-09-02 Thread mig_akira


Hello everyone.

I'm using auth and acl in my website, and I'm using the 'controllers' way to
grant or deny access. Everything is fine, except that I don't know how to
grant or deny access to a non-standard action in a controller. 

For example, in my postsController, I have the actions add, read, index,
view, etc. All of those are standard, so I just type in the command line:

cake acl grant Admin Posts '*'  

And I have access for all those actions, because aros_acos table will be
changed accordingly.

But what if I have an action there called "moveUp", for example? How can I
grant or deny access to this action?

FOr now I'm using 

Function beforeFilter {
   $this->Auth->allowedActions = array('moveUp');
}

But this isn't safe, as you can imagine =P

Thanks guys! I hope I made myself clear, this ACL/Auth stuff is still a bit
confusing to me!
-- 
View this message in context: 
http://www.nabble.com/Auth-ACL--%3E-using-actionPath-%3E%27controllers%27-and-non-standard-actions-tp25269069p25269069.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: Can select forms not return an array?

2009-09-02 Thread Miles J

A few things your doing wrong and should change immediately.

Do not call error(), text() (or the other variants, select(), radio
()).

The following code:

label('Devotion.name', 'Name of Devotion'); ?
>
error('Devotion.name'); ?>
text('Devotion.name', array('size' =>
'80') ); ?>

Can be changed to:

input('name', array('size' => 80, 'label' => 'Name
of Devotion')); ?>

Also this is not needed either:

'selected'=>$html->value('Disciplines.2.discipline_id'),

All you would need to do is set $this->data in the controller.

$this->data['Disciplines'][2]['discipline_id'] = 'value';

And finally to fix your array, remove the "multiple" index from all
your selects and see if that 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: Question about $this->data

2009-09-02 Thread Kyle Decot

Here is a little clearer explanation of what I'm doing and what's
going wrong:

function beforeValidate() {

$this->data['Model']['new_var'] = "my new variable";

}

then in my view I do:

pr($this->data);

My new_var variable is not present. Anyone know what's going on?

On Sep 2, 3:15 pm, Kyle Decot  wrote:
> I am having a little bit of trouble w/ my $this->data. When someone
> submits the form, in my beforeValidate() method, I create two new
> variables inside of $this->data ($this->data['Model']['lat'] && 
> $this->data['Model']['lng'])...I I then want to pass those back to the view
>
> if the validation of the rest of the form fails but when I pr($this->data) in 
> my view, lat and lng are not there. How do I make sure those
>
> values are passed back? Thank you for any 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: Question about $this->data

2009-09-02 Thread Kyle Decot

My reasoning behind me wanting to do it this way is because I have an
address,city, region, and country fields on my form, and then in my
beforeValidate(), I am taking those values and using the Google Map
API and if it's a real address w/ a accuracy level of 8, then I add in
the lat, lng, and accuracy level variables to my $this->data. So there
no way to pass those values back to the view?

On Sep 2, 8:50 pm, brian  wrote:
> beforeValidate() is a model method. Model has it's own $data. But the
> $this->data you're thinking of (I think) is handed from the controller
> to the view. You would have to modify the controller's array, IOW.
> Perhaps you'd be better off adding those 2 values in
> Model::beforeSave().
>
>
>
> On Wed, Sep 2, 2009 at 3:15 PM, Kyle Decot wrote:
>
> > I am having a little bit of trouble w/ my $this->data. When someone
> > submits the form, in my beforeValidate() method, I create two new
> > variables inside of $this->data ($this->data['Model']['lat'] && $this-
> >>data['Model']['lng'])...I I then want to pass those back to the view
> > if the validation of the rest of the form fails but when I pr($this-
> >>data) in my view, lat and lng are not there. How do I make sure those
> > values are passed back? Thank you for any 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: Welcome Page not finding CSS/Images

2009-09-02 Thread brian

So I wasn't mis-remembering (?) when I said that at least one other
person ran into this problem due to some whitespace after the "?>" in
that file. Different issue but same outcome, based on a problem with
that file.

On Wed, Sep 2, 2009 at 6:20 PM, ajoberstar wrote:
>
> So I finally gave up trying to find the error and re-extracted the
> files from the tar.bz2 I downloaded from Cakeforge.  I saw that that
> worked before changing anything, but the only thing different between
> my broken install and this was the database.php config file.  So I
> added that again to see what happened and voila it broke again.  Turns
> out I had the driver set to mysql instead of mysqli and my PHP install
> only has the mysqli extension installed it crapped out, but wouldn't
> tell anything was wrong.  So magic fix.
>
> Thanks to everyone for their suggestions.
>
> On Sep 2, 12:44 pm, Vijay Kumbhar  wrote:
>> Hello ajoberstar,
>>
>> Please add Document_root before webroot/ in the .htaccess in the
>> application folder, app folder.
>>
>> It will help you, coz i was facing same problem on my server.
>> When i added the DOCUMENT_ROOT path in the .htaccess befor /webroot it
>> worked fine for me.
>> please do check this.
>>
>>
>>
>>
>>
>> On Tue, Sep 1, 2009 at 6:34 AM, ajoberstar  wrote:
>>
>> > I did an install of CakePHP on my local device (Windows XP) with an
>> > Apache server.  I did the install to the letter as far as I can tell
>> > (removed comment in front of mod_rewrite's load module statement), but
>> > I'm getting a welcome page with no layout. And it seems like the whole
>> > page isn't even showing up.
>>
>> > The thing that bugs me the most is that I uploaded the same exact
>> > files up to my bluehost account and got the right welcome page.  So
>> > it's got to be something with my server setup but I can't figure it
>> > out.  Any help would be much appreciated.
>>
>> > This is all that showed up in the page source:
>>
>> > Release Notes for CakePHP 1.2.4.8284.
>> > https://trac.cakephp.org/wiki/changelog/1.2.x.x";>Read the
>> > changelog 
>> > 
>> >        Your tmp directory is
>> > writable.> > p>
>> > 
>> >        The FileEngine is being used
>> > for caching. To change the config edit APP/config/core.php > > p>
>> > 
>> >        Your database configuration file is
>> > present.
>>
>> --
>> Thanks & Regards,
>> Vijayk.
>> Co-founder (www.weboniselab.com)
>>
>> "You Bring the Dreams, We'll Bring the Means"
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Limit question

2009-09-02 Thread brian

You'd have to do a find('count') with a condition on
$this->Auth->user('id') (or however they're associated) at the top of
the action.

On Wed, Sep 2, 2009 at 6:08 PM, Dave Maharaj ::
WidePixels.com wrote:
> This might be something simple that has an easy solution.
>
> I want to limit the number of images a User can have (create) for a specific
> gallery. Top 10 images can only have 10 images obviously...
> I figured a simple query to count images that are uploaded in the action and
> if less than 10 allow to proceed else error message to delete 1 or more
> images first.
>
> Any other suggestions that would make more sense or easier?
>
> Thanks
>
> Dave
> >
>

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



Re: Question about $this->data

2009-09-02 Thread brian

beforeValidate() is a model method. Model has it's own $data. But the
$this->data you're thinking of (I think) is handed from the controller
to the view. You would have to modify the controller's array, IOW.
Perhaps you'd be better off adding those 2 values in
Model::beforeSave().

On Wed, Sep 2, 2009 at 3:15 PM, Kyle Decot wrote:
>
> I am having a little bit of trouble w/ my $this->data. When someone
> submits the form, in my beforeValidate() method, I create two new
> variables inside of $this->data ($this->data['Model']['lat'] && $this-
>>data['Model']['lng'])...I I then want to pass those back to the view
> if the validation of the rest of the form fails but when I pr($this-
>>data) in my view, lat and lng are not there. How do I make sure those
> values are passed back? Thank you for any 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: Can select forms not return an array?

2009-09-02 Thread Michael Gaiser

$form->input('Disciplines.0.discipline_id', array('label'=>'Discipline
1', 'type'=>'select',
'selected'=>$html->value('Disciplines.0.discipline_id'),
'options'=>$disciplines, 'multiple'=>'false',  'empty'=>'Choose One'))

There are multiple selection boxes in the view so thats why I needed
to add an index to the name. With or without that index, I am still
getting the returned value in an array.












If you want to see the whole view, it is a bit messing in this email, but here.

Add Devotion

create('Devotion', array('url'=>array('action'=>'add')));?>   
label('Devotion.name', 'Name of Devotion'); ?>
error('Devotion.name'); ?>
text('Devotion.name', array('size' => '80') ); ?>

label('Devotion.description', 'Description'); ?>
error('Devotion.description'); ?>
text('Devotion.description', array('size' => '80') ); 
?>

error('Disciplines.0.discipline_id'); ?>
input('Disciplines.0.discipline_id',
array('label'=>'Discipline 1', 'type'=>'select',
'selected'=>$html->value('Disciplines.0.discipline_id'),
'options'=>$disciplines, 'multiple'=>'false',  'empty'=>'Choose
One'));?>
input('Disciplines.0.discipline_level',
array('label'=>'Discipline Level 1', 'type'=>'select',
'selected'=>$html->value('Disciplines.0.discipline_level'),
'options'=>$levels, 'multiple'=>'false'));?>

error('Disciplines.1.discipline_id'); ?>
input('Disciplines.1.discipline_id',
array('label'=>'Discipline 2', 'type'=>'select',
'selected'=>$html->value('Disciplines.1.discipline_id'),
'options'=>$disciplines, 'multiple'=>'false',  'empty'=>'Choose
One'));?>
input('Disciplines.1.discipline_level',
array('label'=>' Discipline Level 2', 'type'=>'select',
'selected'=>$html->value('Disciplines.1.discipline_level'),
'options'=>$levels, 'multiple'=>'false'));?>

error('Disciplines.2.discipline_id'); ?>
input('Disciplines.2.discipline_id',
array('label'=>'Discipline 3', 'type'=>'select',
'selected'=>$html->value('Disciplines.2.discipline_id'),
'options'=>$disciplines, 'multiple'=>'false',  'empty'=>'Choose
One'));?>
input('Disciplines.2.discipline_level',
array('label'=>'Discipline Level 3', 'type'=>'select',
'selected'=>$html->value('Disciplines.2.discipline_level'),
'options'=>$levels, 'multiple'=>'false'));?>
end('Add Devotion');?>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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
-~--~~~~--~~--~--~---



Routing Help

2009-09-02 Thread Dave Maharaj :: WidePixels.com
I am having some problem with adding additional administrative routing to my
app.
 
I have 
Configure::write('Routing.admin', 'admin');
 
Log in as admin and all the urls have /admin/ in front of the controller and
action and works perfect (did not have to add any Router::connect custom
routing)

I added
Configure::write('Routing.manage', 'manage'); to core.php, added the correct
manage_actions to the controllers with the corresponding  manage_action
views but all the link point to controller/action. 
Logged in as a normal user and there is no manage prefix added like the
admin did automatically. 
 
I manually type in manage/gallery/index and hover over "add" and it points
to gallery/add not manage/gallery/add which it should
 
Does the admin work automatically because its built into Cake and I have to
manually create routing for my manage_ functions? If not why is it working
for admin and not manage?
 
I have read thru the cookbook
http://book.cakephp.org/view/544/Prefix-Routing and can get the manage to
work by adding my own Router::connect  but seems like overkill to go thru
link by link and adding prefix => manage to every link in the app when admin
needed no changes to the code.
 
Can someone point out what I may be missing or did wrong?
 
In my app_controller I have
 
function beforeFilter()
  {
   
 
  $admin = Configure::read('Routing.admin');
  if (isset($this->params[$admin]) && $this->params[$admin]) {
  $this->__checkAdminSession();
  $this->layout = 'admin';
  }
$manage = Configure::read('Routing.manage');
  if (isset($this->params[$manage]) && $this->params[$manage]) {
  $this->__checkUserSession();
  $this->layout = 'manage';
  }

  $this->Auth->actionPath = 'controllers/';
  $this->Auth->authorize = 'actions';
  //$this->Auth->loginAction = array('controller' => 'users',
'action' => 'login');
  //$this->Auth->logoutRedirect = array('controller' => 'users',
'action' => 'login');
  //$this->Auth->loginRedirect = array('controller' => 'users',
'action' => 'index');
  $this->Auth->userScope = array('User.confirmed' => '1');
  $this->Auth->autoRedirect = false;


  }
 
 
Thanks
 
Dave

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



Re: Welcome Page not finding CSS/Images

2009-09-02 Thread ajoberstar

So I finally gave up trying to find the error and re-extracted the
files from the tar.bz2 I downloaded from Cakeforge.  I saw that that
worked before changing anything, but the only thing different between
my broken install and this was the database.php config file.  So I
added that again to see what happened and voila it broke again.  Turns
out I had the driver set to mysql instead of mysqli and my PHP install
only has the mysqli extension installed it crapped out, but wouldn't
tell anything was wrong.  So magic fix.

Thanks to everyone for their suggestions.

On Sep 2, 12:44 pm, Vijay Kumbhar  wrote:
> Hello ajoberstar,
>
> Please add Document_root before webroot/ in the .htaccess in the
> application folder, app folder.
>
> It will help you, coz i was facing same problem on my server.
> When i added the DOCUMENT_ROOT path in the .htaccess befor /webroot it
> worked fine for me.
> please do check this.
>
>
>
>
>
> On Tue, Sep 1, 2009 at 6:34 AM, ajoberstar  wrote:
>
> > I did an install of CakePHP on my local device (Windows XP) with an
> > Apache server.  I did the install to the letter as far as I can tell
> > (removed comment in front of mod_rewrite's load module statement), but
> > I'm getting a welcome page with no layout. And it seems like the whole
> > page isn't even showing up.
>
> > The thing that bugs me the most is that I uploaded the same exact
> > files up to my bluehost account and got the right welcome page.  So
> > it's got to be something with my server setup but I can't figure it
> > out.  Any help would be much appreciated.
>
> > This is all that showed up in the page source:
>
> > Release Notes for CakePHP 1.2.4.8284.
> > https://trac.cakephp.org/wiki/changelog/1.2.x.x";>Read the
> > changelog 
> > 
> >        Your tmp directory is
> > writable. > p>
> > 
> >        The FileEngine is being used
> > for caching. To change the config edit APP/config/core.php  > p>
> > 
> >        Your database configuration file is
> > present.
>
> --
> Thanks & Regards,
> Vijayk.
> Co-founder (www.weboniselab.com)
>
> "You Bring the Dreams, We'll Bring the Means"
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Can select forms not return an array?

2009-09-02 Thread Michael Gaiser
I am using a select field and even though I have it set to single selection
only, it still saves its post data as an array.

I want : $this->data['User']['setting'] = 3

instead of : $this->data['User']['setting'][0] = 3

Is there something I need to do for this to be formatted correctly, or do I
just need to loop though the post data and fix it? Thanks

~Michael

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



Re: Can select forms not return an array?

2009-09-02 Thread Miles J

Thats not what im asking for. Im asking for the $form->input() code
that generates the select in the view.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Anyone used ezComponents successfully as a Vendor class with CakePHP?

2009-09-02 Thread Brendon Kozlowski (Realm)

Random thought - I'll be trying this tomorrow or sometime next week,
but...  Would the autoload file be able to be called as a vendor
include as well?  So long as I call it first, I'm wondering if that
would possibly solve the issue.  An autoloader would still have to be
customized for all ez Component "parts" that were necessary for a
project, but...this is PHP, we could probably create a dynamic script
that could decipher that stuff automatically at runtime.

I guess I'm spouting this off randomly in the middle of a "possible"
eureka moment that I won't know until I actually try to implement it
(and a place to keep this information for historical purposes, even
the short term in case I forgot).  Thanks for giving me a sounding
board.  ;)  File access might be an efficiency issue, so caching would
probably be the way to go.  To the drawing board (when I get time to
work on it!)!

Thanks again.  ;)

On Sep 2, 11:41 am, "Brendon Kozlowski (Realm)"
 wrote:
> Thanks, Rick.  I was trying to determine if there was an easier way to
> add it, but after talking with some of the developers in their IRC
> chat, I couldn't think of any as the call to the autoload is
> required.  I was trying to think of a way to package it all up, such
> as in a plugin or something similar.
>
> By the way, I think I'll add the autoload in the boostrap file instead
> of config, but I suppose that's personal preference.  ;)  Thanks for
> replying!
>
> On Aug 29, 9:43 am, Rick  wrote:
>
> > You should be able to do this quite easily.  Put the ezcomponents dir
> > into the Vendor then add the ezc autoload require in the config
> > core.php.
>
> > Rick
>
> > On Aug 28, 1:27 pm, BrendonKoz  wrote:
>
> > > I'm currently looking to use ezComponent's ezcGraph library within a
> > > CakePHP project, but I've noticed ezComponents specify a requirement
> > > to have their base library loaded.  (Is this similar to Zend now? Last
> > > I knew Zend didn't require a loader to use it as a Vendor.)
>
> > > Rather than rushing in head first into docs, hurdles, and heartache, I
> > > was curious if anyone has tried integrating any of the ezComponents'
> > > "framework" in to CakePHP as a vendor - successfully; and that may
> > > have some tips?
>
> > > ezComponent's Graphing Class (gallery of 
> > > examples):http://www.ezcomponents.org/docs/api/trunk/Graph_gallery.html-Hide
> > >  quoted text -
>
> > - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can select forms not return an array?

2009-09-02 Thread Michael Gaiser

This is what is being generated:

Array
(
[Devotion] => Array
(
[name] => testcase
[description] => A cool Test case
)

[Disciplines] => Array
(
[0] => Array
(
[discipline_id] => Array
(
[0] => 4
)

[discipline_level] => Array
(
[0] => 2
)

)

)

)


I need it to look like this:

Array
(
[Devotion] => Array
(
[name] => testcase
[description] => A cool Test case
)

[Disciplines] => Array
(
[0] => Array
(
[discipline_id] => 4

[discipline_level] => 2

)

)

)

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



Re: Is it possible? Many domains, the same application

2009-09-02 Thread majna

fow www.john.com $_SERVER['SERVER_NAME'] is  john.com

$site = $this->Website->findByDomain($_SERVER['SERVER_NAME']);
...

On Sep 2, 9:29 pm, "Fernando Z. Bob"  wrote:
> Hello everyone.
> My name is Fernando. I`m from Brazil.
> This is my first message in the group. I have one question about
> cake-solutions.
>
> Let me explation what i mean.
>
> Imagine that i have the table Websites which contains 5 fields.
> id int(5)
> name varchar(100)
> domain varchar (255)
> country varchar(50)
> stylesheet varchar(40)
>
> Lets consider also, that i have 3 rows in the table (actually, the table
> will have thousands of lines), but its only an example:
> id   name          domain                 country         stylesheet
> 1   PAUL    http://www.paul.com  BRASIL              31.css
> 2   JOHN    http://www.john.com  USA                    9.css
> 3   JACK    http://www.jack.com  CANADA          322.css
>
> In my system, i have installed my cake like this way (imagine windows only
> for example - my app will be placed in a linux).
>
> c:\cake [this is the core]
> c:\www\allsites [this is the app folder]
>
> Let me say also that all domains (paul.com, john.com, jack.com) points to
> the same folder (c:\www\allsites)
> So, very easy to understand. Now is my question:
> When the visitor comes into whatever site, is cake able to load information
> from the database according to the typed URL?
>
> I mean: if i typewww.john.comor john.com is that possible to do something
> that recognizes the URL and retrive all the Websites table information and
> all the related table only from id number 2 (which is john) and place the
> stylesheet 9.css into the rendered page?
>
> Has someone done any system like that which has only one app folder for many
> sites at the same time?
>
> This system will receive thousands of visits per day.
>
> Thank you
> Fernando
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Can select forms not return an array?

2009-09-02 Thread Miles J

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



Re: how to load initial data?

2009-09-02 Thread Thiago Nuic Vidigal
you can create a custom shell to do it...

On Wed, Sep 2, 2009 at 4:21 PM, Miles J  wrote:

>
> Cake doesnt import x amount of rows into your database. I ran into the
> same problem months ago, I had to write my own scripts to populate
> with test 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
-~--~~~~--~~--~--~---



Limit question

2009-09-02 Thread Dave Maharaj :: WidePixels.com
This might be something simple that has an easy solution.
 
I want to limit the number of images a User can have (create) for a specific
gallery. Top 10 images can only have 10 images obviously...
I figured a simple query to count images that are uploaded in the action and
if less than 10 allow to proceed else error message to delete 1 or more
images first.
 
Any other suggestions that would make more sense or easier?
 
Thanks
 
Dave

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



Question about $this->data

2009-09-02 Thread Kyle Decot

I am having a little bit of trouble w/ my $this->data. When someone
submits the form, in my beforeValidate() method, I create two new
variables inside of $this->data ($this->data['Model']['lat'] && $this-
>data['Model']['lng'])...I I then want to pass those back to the view
if the validation of the rest of the form fails but when I pr($this-
>data) in my view, lat and lng are not there. How do I make sure those
values are passed back? Thank you for any 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: Debugging SQL's

2009-09-02 Thread schreck84
Configure::write('debug',2);
Schreck

-Original Message-
From: Michael Gaiser 

Date: Wed, 2 Sep 2009 22:08:42 
To: 
Subject: Debugging SQL's


How do I view the sql generated by my controller's add() function? I need to
see why some code isn't working and was wondering if there is an easy to
view the generated sql. 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
-~--~~~~--~~--~--~---



Is it possible? Many domains, the same application

2009-09-02 Thread Fernando Z. Bob
Hello everyone.
My name is Fernando. I`m from Brazil.
This is my first message in the group. I have one question about
cake-solutions.

Let me explation what i mean.

Imagine that i have the table Websites which contains 5 fields.
id int(5)
name varchar(100)
domain varchar (255)
country varchar(50)
stylesheet varchar(40)

Lets consider also, that i have 3 rows in the table (actually, the table
will have thousands of lines), but its only an example:
id   name  domain country stylesheet
1   PAULhttp://www.paul.com   BRASIL  31.css
2   JOHNhttp://www.john.com   USA9.css
3   JACKhttp://www.jack.com   CANADA  322.css

In my system, i have installed my cake like this way (imagine windows only
for example - my app will be placed in a linux).

c:\cake [this is the core]
c:\www\allsites [this is the app folder]


Let me say also that all domains (paul.com, john.com, jack.com) points to
the same folder (c:\www\allsites)
So, very easy to understand. Now is my question:
When the visitor comes into whatever site, is cake able to load information
from the database according to the typed URL?

I mean: if i type www.john.com or john.com is that possible to do something
that recognizes the URL and retrive all the Websites table information and
all the related table only from id number 2 (which is john) and place the
stylesheet 9.css into the rendered page?



Has someone done any system like that which has only one app folder for many
sites at the same time?

This system will receive thousands of visits per day.



Thank you
Fernando

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Debugging SQL's

2009-09-02 Thread Miles J

Set debug to 1 or 2 and it should display the SQL output at the bottom
of the page.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: afterFind() inconsistencies ?

2009-09-02 Thread iFeghali
anyone got a clue ?

I am still very confused on this matter. I have tried moving from
"recursive" to "containable" with no luck.

Thank you.

On Jul 28, 5:31 pm, iFeghali  wrote:
> Hello All,
>
> I found myself stuck for a week in an issue that I would really
> appreciate any kind of help. Thats my scenario:
>
> Machine HABTM Service
> Machine belongsTo Type
> Type hasOne Machine
> Machine hasMany MachineContact
> MachineContact belongsTo Machine
>
> Now I have Machine->afterFind() hypothetically defined as:
>
>  function afterFind($results, $primary = false) {
> print_r($results);
> return $results;}
>
> ?>
>
> Recursive is set to 2 for everything. So far so good.
>
> If I go to /services/view/someId I get:
>
> Array
> (
>     [0] => Array
>         (
>             machine attribs ...
>             [MachinesService] => Array
>                 (
>                   ...
>                 )
>             [Type] => Array
>                 (
>                   ...
>                 )
>             [MachineContact] => Array
>                 (
>                     [0] => Array
>                         (
>                           ...
>                         )
>
>                     [1] => Array
>                         (
>                           ...
>                         )
>                 )
>         )
> )
> Array
> (
>     [0] => Array
>         (
>             [Machine] => the Array above
>        )
> )
>
> First question, I do not understand why afterFind() was called twice.
> In the SQL log there is only one query searching the machines table.
> As I browsed cake's source I found that afterFind() in called in the
> model layer and after that again at the DB layer. Did I get it right ?
> If so, why is the reason for that ?
>
> But the real issue comes when I go to /types/view/someId:
>
> Array
> (
>     [0] => Array
>         (
>             [Machine] => Array
>                 (
>                  ...
>                 )
>         )
> )
> Array
> (
>     [0] => Array
>         (
>             [Machine] => Array
>                 (
>                     [0] => Array
>                         (
>                            machine attribs...
>                             [Type] => Array
>                                 (
>                                  ...
>                                 )
>                             [MachineContact] => Array
>                                 (
>                                     [0] => Array
>                                         (
>                                          ...
>                                         )
>                                 )
>                             [Service] => Array
>                                 (
>                                     [0] => Array
>                                         (
>                                           ...
>                                         )
>                                 )
>                         )
>                 )
>         )
> )
>
> afterFind() is called twice again as [un]expected. The problem is,
> this time, in the first run it didn't fetch any of the Machines
> associated models, even though recursive is set to 2. Also, the array
> is indexed by model name what doesn't happens in the first test.
> Secondly, in the second run the machine array comes complete with all
> the attributes plus the associated models, indexed by model name
> again.
>
> So, what did I missed here ?
>
> Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Debugging SQL's

2009-09-02 Thread Michael Gaiser
How do I view the sql generated by my controller's add() function? I need to
see why some code isn't working and was wondering if there is an easy to
view the generated sql. 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: Learning cakePHP debugging

2009-09-02 Thread McScreech

@LunarDraco, Thank You, Thank You, Thank You, Thank You, Thank You,
Thank You!

I suspected that I was not setting the variable correctly and
$activeUser = $this->Auth->user()

in the beforeFilter function of app_controller.php was exactly the fix
I needed. I got the the other version from a forum somewhere and
obviously either took it out of context or the author was generalizing
his response (maybe to a different question?). Once I was able to see
the activeUser values change when logging on as different users I
could also correct the branch control command in start.ctp to
switch ($activeUser['User']['group_id']):

Redirecting to the home page when a user logs out was already working
(and thankfully still is), I had set
$this->Auth->autoRedirect = false;

in the beforeFilter function of app_controller.php and handled the
redirects manually with
$this->redirect( array('controller' => 'pages', 'action' =>
'start') );

in the login function and
$this->redirect( array('controller' => 'pages', 'action' =>
'home') );

in the logout function of the users_controller.php.

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



Re: how to load initial data?

2009-09-02 Thread Miles J

Cake doesnt import x amount of rows into your database. I ran into the
same problem months ago, I had to write my own scripts to populate
with test 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
-~--~~~~--~~--~--~---



Re: how to load initial data?

2009-09-02 Thread Zé Ricardo

Hi Vijay Kumbhar, thanks for you answer, but I have already read it.
I'm actually not THAT beginner. I wanted a higher level solution, like
the migration plugins, not SQL. Does anyone know something like this?

On Wed, Sep 2, 2009 at 1:24 PM, Vijay Kumbhar wrote:
> Hello Ricardo,
>
> Please try out with the basic cakephp assignment,
>
> http://book.cakephp.org/view/219/Blog
>
>
> 2009/9/2 Zé Ricardo 
>>
>> Hi, I'm a cakephp beginner and I'm wondering how I can load initial
>> data in my database (eg. some users and groups). I thought fixtures
>> could do the task, but it seems that they can only be used for tests,
>> right?
>>
>> Is there a plugin or even a standard way to do it? I've found some
>> migration scripts, but they have not helped me so far.
>>
>> Thanks in advance.
>>
>>
>
>
>
> --
> Thanks & Regards,
> Vijayk.
> Co-founder (www.weboniselab.com)
>
> "You Bring the Dreams, We'll Bring the Means"
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Welcome Page not finding CSS/Images

2009-09-02 Thread Vijay Kumbhar
Hello ajoberstar,

Please add Document_root before webroot/ in the .htaccess in the
application folder, app folder.

It will help you, coz i was facing same problem on my server.
When i added the DOCUMENT_ROOT path in the .htaccess befor /webroot it
worked fine for me.
please do check this.

On Tue, Sep 1, 2009 at 6:34 AM, ajoberstar  wrote:

>
> I did an install of CakePHP on my local device (Windows XP) with an
> Apache server.  I did the install to the letter as far as I can tell
> (removed comment in front of mod_rewrite's load module statement), but
> I'm getting a welcome page with no layout. And it seems like the whole
> page isn't even showing up.
>
> The thing that bugs me the most is that I uploaded the same exact
> files up to my bluehost account and got the right welcome page.  So
> it's got to be something with my server setup but I can't figure it
> out.  Any help would be much appreciated.
>
> This is all that showed up in the page source:
>
> Release Notes for CakePHP 1.2.4.8284.
> https://trac.cakephp.org/wiki/changelog/1.2.x.x";>Read the
> changelog 
> 
>Your tmp directory is
> writable. p>
> 
>The FileEngine is being used
> for caching. To change the config edit APP/config/core.php  p>
> 
>Your database configuration file is
> present.
>
> >
>


-- 
Thanks & Regards,
Vijayk.
Co-founder (www.weboniselab.com)

"You Bring the Dreams, We'll Bring the Means"

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Plugin paginator shows incorrect count and only shows 20 items out of 25

2009-09-02 Thread Vijay Kumbhar
Hello Agota,

Default limit for the pagination is 20 records per page in cakephp.

So if you want to set it to 25 then please refer the following link,

http://book.cakephp.org/view/165/Controller-Setup



On Wed, Sep 2, 2009 at 2:11 PM, Agota  wrote:

>
> Hi there, I am experiencing some issues with pagination in a plugin
> mine. It show incorrect pagination counts on all my models in the
> plugin. It also shows only 20 results although I have 25 items listed
> in one of the table. The search results also just shows 20 results.
>
> All the index pages shows "Page 1 of 1, showing 6 records out of 6
> total, starting on record 1, ending on 6"
>
> have anyone experience a similar issue?
>
> I have been struggling with this for some time and cannot find a
> solution.
>
> Any help would be appreciated.
>
> Thanks
>
> >
>


-- 
Thanks & Regards,
Vijayk.
Co-founder (www.weboniselab.com)

"You Bring the Dreams, We'll Bring the Means"

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



Re: how to load initial data?

2009-09-02 Thread Vijay Kumbhar
Hello Ricardo,

Please try out with the basic cakephp assignment,

http://book.cakephp.org/view/219/Blog


2009/9/2 Zé Ricardo 

>
> Hi, I'm a cakephp beginner and I'm wondering how I can load initial
> data in my database (eg. some users and groups). I thought fixtures
> could do the task, but it seems that they can only be used for tests,
> right?
>
> Is there a plugin or even a standard way to do it? I've found some
> migration scripts, but they have not helped me so far.
>
> Thanks in advance.
>
> >
>


-- 
Thanks & Regards,
Vijayk.
Co-founder (www.weboniselab.com)

"You Bring the Dreams, We'll Bring the Means"

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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
-~--~~~~--~~--~--~---



how to load initial data?

2009-09-02 Thread Zé Ricardo

Hi, I'm a cakephp beginner and I'm wondering how I can load initial
data in my database (eg. some users and groups). I thought fixtures
could do the task, but it seems that they can only be used for tests,
right?

Is there a plugin or even a standard way to do it? I've found some
migration scripts, but they have not helped me so far.

Thanks in advance.

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



Re: Learning cakePHP debugging

2009-09-02 Thread FrederickD

I have used DebugKit with great success. Here is the article about it:

http://thechaw.com/debug_kit/wiki

You get a toolbar at the top of the window with access to tons of
stuff. It does not do line by line debugging. I would like to use
FirePHP for adding breakpoints and watching variables, but I have not
have had the time to figure it out yet. There are instructions for it,
I just don't understand them yet.

p.s.: Thanks for sharing your code. I'm doing something similar, but
like your use of elements. I appreciate the example!

On Sep 2, 9:57 am, LunarDraco  wrote:
> $activeUser = $this->User->find(array($this->Auth->user('id')));
> Not sure I understand why you set the active user with this line:
> as $this->Auth->user() should contain everything you need from the
> user model.
>
> After a user is logged in you never tell the auth component that the
> user has logged out. So even after logging out this->Auth->user
> contains a valid user.
> I suppose after you've logged out and you click on your login link
> from the home page it probably never asks for new credentials and goes
> straight to the start page.
>
> At the end of your logout you should be calling:
> $this->redirect($this->Auth->logout());
>
> That will clear the $this->Auth->user() object and you can test for it
> via:
> if($this->Auth->user())
>
> You'll want to set in your beforeFilter:
> $this->Auth->logoutRedirect = array('controller' => 'pages', 'action'
> => 'home');
>
> which should take care of your redirect to the home page when a user
> logs out.
>
> On Sep 2, 7:54 am, McScreech  wrote:
>
> > @Martin, thanks. debug($activeUser); returns the type of output I was
> > expecting.
>
> > @abc, I'll look into the php version also.
>
> > Now on to my problem, once I actually stopped to _read_ the debug
> > output I realized that the $activeUser variable is NOT CHANGING when I
> > log out and log back in again. In addition to the partial setup that I
> > described above, here are the login and logout functions in my
> > users_controller.php:
>
> >         function login() {
> >                 if( $this->Auth->user() ) {
> >                         // Redirect to start page.
> >                         $this->redirect( array('controller' => 'pages', 
> > 'action' =>
> > 'start') );
> >                 }
> >         } // end login()
>
> >         function logout() {
> >                 $this->Session->destroy();
> >                 $this->Session->SetFlash(__('Successfully logged out', 
> > true));
> >                 $this->redirect( array('controller' => 'pages', 'action' =>
> > 'home') );
> >         } // end logout()
>
> > I am using php 5.2.9-1 and cakePHP 1.2.3.8166.
>
> > Thanx again, McS.
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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
-~--~~~~--~~--~--~---



User preferences

2009-09-02 Thread Dave Maharaj :: WidePixels.com
I have a Posts section which has a bookmark feature for users to save the
posts they like
 
Now I want to add a preferences section to the users table with a field
"display" which will be a bool true / false so when they view posts it will
either pull all posts or ones they have not bookmarked only based on the
"display" value and pass those posts to pagination.
 
What would be the best way to do this?
 
I was thinking:
in the query I have contain bookmark which gets the post_id 
so if the Bookmark.post_id is in the Post.id remove it from the array
 
What would anyone suggest?
 
thanks
 
Dave

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



Re: Plugin paginator shows incorrect count and only shows 20 items out of 25

2009-09-02 Thread Miles J

Have you set a limit in the $paginate property? If not it defaults
down to 20 I believe.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Welcome Page not finding CSS/Images

2009-09-02 Thread Brendon Kozlowski (Realm)

When images and/or CSS do not show, it's almost always typically an
issue with mod_rewrite not being enabled either on your server, your
account, or your particular directory that holds the CakePHP app.

If you're unable to understand how to get it working, that's what your
shared hosting support team is there for.  Submit a ticket, and
request help.

As for the local server not recognizing the change when you
uncommented the LoadModule line, you may also have to configure your
httpd.conf file to properly set the "AllowOverride" directive.  If
you're only developing locally and no one else will be connecting to
your machine, you can set it to All.  If anyone may be connecting to
it, then read up on the HTTPD docs over at Apache.org to understand
how to use this directive correctly as it can be a security concern.
(...and obviously, restart the server when making changes.)

On Sep 2, 6:55 am, CoolCourt  wrote:
> Yea I am also on bluehost and i cant even find the conf file or any
> solutions to get this newest version of cake php to load the css or
> images either.
>
> I am thinking about using the dev version because I wanna get started
> on my cake php i downloaded a cheat sheet and everything but i cant
> get the css to load.
>
> I would love to get an idea whats wrong just sucks that its not a
> problem for everyone. i know previous versions worked fine but this
> new version isnt loading the css.
>
> I hope someone can help figure this out.
>
> Court
>
> On Sep 1, 2:58 pm, ajoberstar  wrote:
>
>
>
> > .htaccess files are present.  And like I mentioned in my original post
> > I copied the files I had locally (that are not working) to bluehost
> > and they work there.  I have removed the hash in front of the
> > loadmodule statement as well.  So as far as I can tell mod_rewrite is
> > enabled, but the cake welcome page still does not work.
>
> > On Sep 1, 5:07 am, Kornelije Sajler  wrote:
>
> > > It is usually in apache/conf/httpd.confprobably you have comment on it
> > > #LoadModule rewrite_module modules/mod_rewrite.so
> > > remove hash # to look like this
> > > LoadModule rewrite_module modules/mod_rewrite.so
> > > and restart server
>
> > > and now you have rewrite enabled!
>
> > > Hope it helps,
>
> > > Kornelije Sajler
>
> > > On Tue, Sep 1, 2009 at 11:47, jeff  wrote:
> > > > HEY JUST CHECK IN UR SERVER SETTINGS WETHER THE MODE REWRITE IS ENALED 
> > > > OR
> > > > NOT...
>
> > > > YOU CAN FIND IT UNDER PHP SETTINGS OR SOMETHING LIKE THAT.
>
> > > > ENABLE IT .
>
> > > > On Mon, Aug 31, 2009 at 11:16 PM, fatnic...@googlemail.com <
> > > > fatnic...@googlemail.com> wrote:
>
> > > >> Did you make sure you copied over ALL of the files from the Cake
> > > >> download? Even the hidden ones? Sounds like the .htaccess file is
> > > >> missing.
>
> > > >> On Sep 1, 2:04 am, ajoberstar  wrote:
> > > >> > I did an install of CakePHP on my local device (Windows XP) with an
> > > >> > Apache server.  I did the install to the letter as far as I can tell
> > > >> > (removed comment in front of mod_rewrite's load module statement), 
> > > >> > but
> > > >> > I'm getting a welcome page with no layout. And it seems like the 
> > > >> > whole
> > > >> > page isn't even showing up.
>
> > > >> > The thing that bugs me the most is that I uploaded the same exact
> > > >> > files up to my bluehost account and got the right welcome page.  So
> > > >> > it's got to be something with my server setup but I can't figure it
> > > >> > out.  Any help would be much appreciated.
>
> > > >> > This is all that showed up in the page source:
>
> > > >> > Release Notes for CakePHP 1.2.4.8284.
> > > >> > https://trac.cakephp.org/wiki/changelog/1.2.x.x";>Read the
> > > >> > changelog 
> > > >> > 
> > > >> >         Your tmp directory is
> > > >> writable. > > >> > p>
> > > >> > 
> > > >> >         The FileEngine is being
> > > >> used
> > > >> > for caching. To change the config edit APP/config/core.php  > > >> > p>
> > > >> > 
> > > >> >         Your database configuration 
> > > >> > file is
> > > >> > present.
>
> > > > --
> > > > --
> > > > (¨`•.•´¨) I may be busy,
> > > > `•.¸(¨`•.•´¨)  but I assure you,
> > > > (¨`•.•´¨)¸.•´ you are always in my heart
> > > > `•.¸.•´
>
> > > > With Lots of Love.
>
> > > > THANKS AND REGARDS
>
> > > > Jeffery Jacob- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: admin application

2009-09-02 Thread FrederickD

I have had the same requirement, and ACL was "a bit heavy" for me too.
Plus I am too green to understand it.

Check out this tutorial that really helped me:

http://teknoid.wordpress.com/2009/04/22/simplistic-example-of-row-level-access-control-with-auth-security-and-app-model-in-cakephp/

I have applied the techniques in that tutorial, along with some
relationships amongst my tables. My project involves distributors who
own dealerships, the dealers have technicians and services. I want the
admin group members to see all, the distributor group members to see
only their distributor(s) plus only their associated dealers,
technicians, and services.

It takes a little coding in the controller but works very well. I can
post a sample of the code if you like. I'm sure there will be some
constructive criticism of the code, which I need to improve my coding
style with Cake.

On Sep 2, 9:41 am, brian  wrote:
> ACL might be a bit heavy for this. You can achieve this by using admin
> routing and AuthComponent. In your non-admin actions, just ensure that
> your conditions check for the user_id so that only books belonging to
> that user can be edited, deleted, etc. For example:
>
> 'conditions' => array('Book.user_id' => $this->Auth->user('id'))
>
> For editing a Book, pass the id as normal but check it first against
> the IDs of all books owned by the user. When a user logs in, grab the
> book IDs and store them in the session to make this easier.
>
> For the admin pages, of course, leave out this condition.
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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 1.3 var $scaffold redirect

2009-09-02 Thread Alex Ciminian

I've got it working by overwriting the scaffold controller in the cake
library with the controller from version 1.2.4. I did a diff on the
two files and I noticed that the main difference is the use of
$_validSession in the newer file. I'm new to CakePHP (this is my first
project), so I don't know if what I did is heresy, but it seems to
work. Maybe we should submit a bug for version 1.3?

On Aug 31, 5:09 am, Andras Kende  wrote:
> Hello,
>
> is it possible that in cake 1.3 using var $scaffoldwontredirecton  
> save or edit ?
> I just get a blank page.
>
>  class ProductsController extends AppController {
>    var $scaffold;}
>
> ?>
>
> core.php set to:
> Configure::write('debug', 0);
>
> Thanks,
>
> Andras
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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 used ezComponents successfully as a Vendor class with CakePHP?

2009-09-02 Thread Brendon Kozlowski (Realm)

Thanks, Rick.  I was trying to determine if there was an easier way to
add it, but after talking with some of the developers in their IRC
chat, I couldn't think of any as the call to the autoload is
required.  I was trying to think of a way to package it all up, such
as in a plugin or something similar.

By the way, I think I'll add the autoload in the boostrap file instead
of config, but I suppose that's personal preference.  ;)  Thanks for
replying!

On Aug 29, 9:43 am, Rick  wrote:
> You should be able to do this quite easily.  Put the ezcomponents dir
> into the Vendor then add the ezc autoload require in the config
> core.php.
>
> Rick
>
> On Aug 28, 1:27 pm, BrendonKoz  wrote:
>
>
>
> > I'm currently looking to use ezComponent's ezcGraph library within a
> > CakePHP project, but I've noticed ezComponents specify a requirement
> > to have their base library loaded.  (Is this similar to Zend now? Last
> > I knew Zend didn't require a loader to use it as a Vendor.)
>
> > Rather than rushing in head first into docs, hurdles, and heartache, I
> > was curious if anyone has tried integrating any of the ezComponents'
> > "framework" in to CakePHP as a vendor - successfully; and that may
> > have some tips?
>
> > ezComponent's Graphing Class (gallery of 
> > examples):http://www.ezcomponents.org/docs/api/trunk/Graph_gallery.html- 
> > Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Has anyone had success using Ext JS 2.2.2 and a grouping grid?

2009-09-02 Thread FrederickD

Thanks for your reply! I am missing the replies to the blog post
though. I've experienced a long time lag between posts being approved
on the extjs.com/forum lately. I will check again periodicaly.

I have changed the datastore over to the GroupingStore, but I am not
coding the field name correctly somehow. I need some assistance there.
It is good to know the Ext will take care of the rest. That is what I
was hoping for.

I look forward to converting over to your tool very soon. Looking
forward to some tutorials on how to do various Ext functions.

On Sep 1, 1:29 am, wirtsi  wrote:
> Hey Frederik
>
> check out the replies I gave you on the blog post ... grouping is
> quite easy actually, all you need to do is change the datastore into a
> GroupingStore and give it a groupField (ie. what field to group by).
> Ext will take care of the rest ...
>
> wirtsi
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Set the timestamp to current server time manually...

2009-09-02 Thread Brendon Kozlowski (Realm)

I use the following code:

$this->User->saveField('lastlogin', date('Y-m-d H:i:s'));

"lastlogin" is a field in my users table, so adjust your name/table
accordingly.
Also, if your server is not in the same timezone as you are, but you'd
like it to be, you'll probably want to add the following snippet to
your app/config/bootstrap.php file:
date_default_timezone_set('America/New_York');
You can find your timezone from the PHP site. 
http://php.net/manual/en/timezones.php
(<-- english version, I couldn't find the language agnostic short link
to the page)

On Sep 2, 10:29 am, brian  wrote:
> If you're using Postgres or MySQL, at least, the format should be:
>
> -MM-DD HH:MM:SS
>
> So, you can use PHP's date function:
>
> $this->data['Visit']['date'] = date('Y-m-d H:i:s');
>
> I'm not so sure that 'date' is a good name for a DB column, though.
>
> http://www.php.net/manual/en/function.date.php
>
>
>
> On Wed, Sep 2, 2009 at 1:01 AM, gparra wrote:
>
> > Hi,
>
> > I realize this question may be fairly easy to answer, but I just
> > haven't managed to get a clear understanding of how to do it through
> > the documentation or google search.
>
> > I settled by using the database convention of naming my date field to
> > 'created' as a datetime field in the database and in the model.
>
> > This way, when I save it stores the current timestamp.
>
> > However I'd like to know if there's a way I can manually set the
> > timestamp using the Time helper or another time/date function in
> > cakephp. Couldn't find anything similar online, I'd appreciate any
> > comments.
>
> > The idea is to do something like this in the controller:
>
> > $this->data[Visit].['date'] = timestamp()* (I realize this could take
> > any shape or form, please suggest the simplest most cakephp framework
> > centric alternative).
>
> > Thanks!
> > German.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Get Counts

2009-09-02 Thread brian

You want the total number of records?

echo $paginator->params['paging']['Conference']['count'];

On Wed, Sep 2, 2009 at 1:51 AM, SuMiT KuMaR wrote:
>
> Cakephp provides the function to get the count of a query with:
> $this->Model->find("count")
>
> Also I have noticed that cakephp fires the count query to each query
> that i execute.
>
> Questions:
> 1. Is it because of the Pagination component/helper?
> 2. How to get the result of the Count query?
>
> Here are the two queries:
> SELECT COUNT(*) AS `count` FROM `conferences` AS `Conference`
> LEFT JOIN `venues` AS `Venue` ON (`Conference`.`venue_id` =
> `Venue`.`id`)
> WHERE `Conference`.`date` >= '2009-09-01 21:37:35'
> AND `Conference`.`status` = 1
>
> SELECT * FROM `conferences` AS `Conference`
> LEFT JOIN `venues` AS `Venue` ON (`Conference`.`venue_id` =
> `Venue`.`id`)
> WHERE `Conference`.`date` >= '2009-09-01 21:37:35'
> AND `Conference`.`status` = 1
> ORDER BY `Conference`.`date` ASC
> LIMIT 20
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Learning cakePHP debugging

2009-09-02 Thread LunarDraco

$activeUser = $this->User->find(array($this->Auth->user('id')));
Not sure I understand why you set the active user with this line:
as $this->Auth->user() should contain everything you need from the
user model.

After a user is logged in you never tell the auth component that the
user has logged out. So even after logging out this->Auth->user
contains a valid user.
I suppose after you've logged out and you click on your login link
from the home page it probably never asks for new credentials and goes
straight to the start page.


At the end of your logout you should be calling:
$this->redirect($this->Auth->logout());

That will clear the $this->Auth->user() object and you can test for it
via:
if($this->Auth->user())

You'll want to set in your beforeFilter:
$this->Auth->logoutRedirect = array('controller' => 'pages', 'action'
=> 'home');

which should take care of your redirect to the home page when a user
logs out.

On Sep 2, 7:54 am, McScreech  wrote:
> @Martin, thanks. debug($activeUser); returns the type of output I was
> expecting.
>
> @abc, I'll look into the php version also.
>
> Now on to my problem, once I actually stopped to _read_ the debug
> output I realized that the $activeUser variable is NOT CHANGING when I
> log out and log back in again. In addition to the partial setup that I
> described above, here are the login and logout functions in my
> users_controller.php:
>
>         function login() {
>                 if( $this->Auth->user() ) {
>                         // Redirect to start page.
>                         $this->redirect( array('controller' => 'pages', 
> 'action' =>
> 'start') );
>                 }
>         } // end login()
>
>         function logout() {
>                 $this->Session->destroy();
>                 $this->Session->SetFlash(__('Successfully logged out', true));
>                 $this->redirect( array('controller' => 'pages', 'action' =>
> 'home') );
>         } // end logout()
>
> I am using php 5.2.9-1 and cakePHP 1.2.3.8166.
>
> Thanx again, McS.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: textmate snippets not working

2009-09-02 Thread mikeottinger

Thanks for the help. Yes, there's one bundle, it was a typo. And I
removed it and reinstalled it within /Library/Application Support/
TextMate/Bundles like this:

svn co http://svn.textmate.org/trunk/Review/Bundles/PHP%20Cake.tmbundle/

I then fired up TextMate, but alas, still no luck. I went into the
bundle's Snippet directory and listed the permissions there:

-rw-r--r--

Don't these need to be executable?

Thanks again.

On Sep 2, 3:36 am, Martin Westin  wrote:
> Bundles? Unless that's a typo, you might need to stick with one bundle
> for CakePHP or you might get some conflict.
>
> I have this 
> onehttp://svn.textmate.org/trunk/Review/Bundles/PHP%20Cake.tmbundle
> installed in ~/Library/Application Support/TextMate/Bundles/
>
> It works as it should for me. "dat" will expand to "$this->data['…']"
> for example.
>
> I have a vague memory of some bundle causing me problems because of
> file permissions. Try chmodding your bundle (which is one of these
> Apple faux-directories) to make sure Textmate can do it's thing. If
> you check it out using subversion they should be ok but you never
> know.
>
> On Sep 2, 8:15 am, mikeottinger  wrote:
>
> > Hi All, I've scoured the web and had no luck, I've installed the
> > bundles for cakephp, I've set the file type for my php file to HTML
> > (PHP Cake), yet none of the snippets work for me. For instance, I try
> > typing dat then hitting tab and nothing happens. Is there something
> > else I'm missing perhaps? Is this not a fully supported bundle
> > anymore?
>
> > Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: need help in $ajax->observerField

2009-09-02 Thread FrederickD

Friend,

I have been where you are. Here is a tutorial that helped me greatly:

http://forum.phpsitesolutions.com/php-frameworks/cakephp/ajax-cakephp-dynamically-populate-html-select-dropdown-box-t29.html

Of course I was not satisfied with just that, so check out this thread
and the final answer at the end of it:

http://groups.google.com/group/cake-php/browse_thread/thread/25fa39d4e10bff7c/8698c1252b3cf49a?lnk=gst&q=frederickd#8698c1252b3cf49a

Let me know if this helps.

On Aug 30, 11:06 pm, "adilraufk...@gmail.com" 
wrote:
> I have a ajax application form , i need to add state country select
> boxes to it (again using ajax)
>
> in my view file every thing goes fine if i use
>
> ///apply.ctp
> echo $form->create('User');
> echo $form->select('country_id',array($countries),null,array
> ('id'=>'countries'),false);
> echo $form->select('region_id',array(),null,array
> ('id'=>'regions'),false);
> echo $ajax->observeField('countries',array
> ('url'=>'update_region_select','update'=>'regions'));
>
> but nothing gets updated in state if i am using
>
> //apply.ctp
> echo $ajax->form();
> echo $form->select('country_id',array($countries),null,array
> ('id'=>'countries'),false);
> echo $form->select('region_id',array(),null,array
> ('id'=>'regions'),false);
> echo $ajax->observeField('countries',array
> ('url'=>'update_region_select','update'=>'regions'));
>
> is it possible to do this anyway, Please help, 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
-~--~~~~--~~--~--~---



id is getting lost inside ClassRegistry::init. BUG?!

2009-09-02 Thread Johannes Nohl

Am I wrong or is id dropped inside init funtion in /cake/libs/
class_registry.php ?!

I'm trying to load a model on the fly. I can pass a id to the function
like:

ClassRegistry::init( array('class' => 'User', 'id' => $id), 'Model' );

But inside the function init the id is never handled. Since this the
id is always the lowest available (mostly 1).


This is especially questionable because the example in the manual
(http://book.cakephp.org/view/845/loadModel) doesn't work:

$this->loadModel('User', 2);
$user = $this->User->read();

loadModel is using ClassRegistry::init -> Id will be lost.

Am I wrong? please correct me.

Johannes

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Set the timestamp to current server time manually...

2009-09-02 Thread brian

If you're using Postgres or MySQL, at least, the format should be:

-MM-DD HH:MM:SS

So, you can use PHP's date function:

$this->data['Visit']['date'] = date('Y-m-d H:i:s');

I'm not so sure that 'date' is a good name for a DB column, though.

http://www.php.net/manual/en/function.date.php

On Wed, Sep 2, 2009 at 1:01 AM, gparra wrote:
>
> Hi,
>
> I realize this question may be fairly easy to answer, but I just
> haven't managed to get a clear understanding of how to do it through
> the documentation or google search.
>
> I settled by using the database convention of naming my date field to
> 'created' as a datetime field in the database and in the model.
>
> This way, when I save it stores the current timestamp.
>
> However I'd like to know if there's a way I can manually set the
> timestamp using the Time helper or another time/date function in
> cakephp. Couldn't find anything similar online, I'd appreciate any
> comments.
>
> The idea is to do something like this in the controller:
>
> $this->data[Visit].['date'] = timestamp()* (I realize this could take
> any shape or form, please suggest the simplest most cakephp framework
> centric alternative).
>
> Thanks!
> German.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: admin application

2009-09-02 Thread brian

ACL might be a bit heavy for this. You can achieve this by using admin
routing and AuthComponent. In your non-admin actions, just ensure that
your conditions check for the user_id so that only books belonging to
that user can be edited, deleted, etc. For example:

'conditions' => array('Book.user_id' => $this->Auth->user('id'))

For editing a Book, pass the id as normal but check it first against
the IDs of all books owned by the user. When a user logs in, grab the
book IDs and store them in the session to make this easier.

For the admin pages, of course, leave out this condition.

On Tue, Sep 1, 2009 at 3:14 PM, Henrik Gemal wrote:
>
> I need to write an admin application where user can only see their own
> stuff and admins can see all the stuff.
>
> But I am a bit confused which way I need to look. Should I look into
> using ACLs or ?
>
> Think of a book site where users can only see and edit the books they
> posted and admins can see and edit all books. ACL's seems complicated.
>
> Any recommendations?
>
> I've been using Cake now for a year but have never used ACLs yet.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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
-~--~~~~--~~--~--~---



Questions regarding Auth component/login box as an element

2009-09-02 Thread Christian

Hello,

I am trying to check out different php frameworks. As a first test I
want to create a login box that should appear on every page of the
website (that has the standard layout). If a user is not logged in,
the login form should appear. If he is logged in, an appropriate
message and a logout link or button should appear.

I baked the Users model and controller, that worked fine.

The I created an element "loginbox" that I refer to in my default.ctp
by "echo $this->element('loginbox');". For a start, loginbox.ctp
simply created a login form.

The password field in the database table is hashed with md5, so in the
app_controller.php's beforeFIlter I execute "Security::setHash
('md5');".

I work on the very same database and table with a similar Zend test
project, and login works fine there.

But in CakePHP I have problems. First: I am not logged in. Instead I
land on a page with a login box in the main content area (plus of
course the login box that I constructed myself as an element).

In the users_controller.php's beforeFilter I placed:
$this->Auth->loginError = 'Invalid e-mail / password combination.
Please try again';

But this error appears nowhere (although I places "$session->flash
('auth');" in loginbox.ctp)

For testing purposes I places "$this->Auth->autoRedirect = false;" in
the users_controller.php's beforeFilter and then placed code in the
login function of that controller (from here:
http://www.littlehart.net/atthekeyboard/2007/09/11/a-hopefully-useful-tutorial-for-using-cakephps-auth-component/)

I modified that code a little to redirect to http://www.yahoo.de when
the login failed. That worked. So at least I think that the controller
is used at all.

But then the question is: Why does the login not work? I modified the
security's hashing algorithm to MD5, so it should work.

The other question is: how could I access the Auth component from a
layout or an element? The loginbox.ctp should only show the login form
if the user is not logged in. So I need an conditional clause in the
loginbox.ctp and need to determine whether the user is logged in or
not. Or alternatively I need a loginbox.ctp and a logoutbox.ctp and
then in the default.ctp I place an conditional clause that either
places the loginbox or the logoutbox in the header section.

A third question: As I mentioned above, if I keep the autoRedirect
switched on and the login fails, a login form is displayed in the main
area. Though this can be a wanted behavior for some websites, just out
of curiosity: How would it be done to keep the user on the actual page
and let the loginbox handle the display of the error? I found this as
a description of how to store the referrer into a session (http://
bin.cakephp.org/view/316159681). But then how would I tell the
users_controller.php to jump to the actual page in case of a failed
login attempt? Does it have to be done by switching of autoRedirect
and doing it by myself in the login function?

Any help or a hint would be very appreciated.

Christian

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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 on linking 3 model associations

2009-09-02 Thread brian

What's the difference between Subject & OfferedSubject? If it's just
that the latter are a subset of all available subjects but are the
only ones currently offered, you might as well add a column to
subjects table as a flag. Say, "enabled" or "current" or something
similar.

And offered_subjects_enrollees also seems a bit needlessly complex.
I'd think you could get away with just:

subjects
enrollees
enrollees_subjects (enrollee_id, subject_id)

... using HABTM assoc. between Subject & Enrollee.

That's not to say that this sort of thing is simple. I worked on a
similar project (non-Cake) once and it was *really* complex. The
schedule/calendar part was a real pain.

I really wish Cake had been around for that, actually.

On Wed, Sep 2, 2009 at 3:20 AM, learning_cake_php wrote:
>
> Im building a school enrollment system then i came across with this
> problem with associations.first of all, i need to link 3 tables:
>
> 1. subjects
> -id
> -name
> -lecture_units
> -lab_units
>
> 2. offered_subjects
> -id
> -subject_id
> -section
> -schedule
>
> 3. offered_subjects_enrollees
> -id
> -offered_subject_id
> -enrollee_id
>
> (of course there is an enrollee table but lets just stick with my main
> problem...)
>
> using this 3 tables, how can i get the Subject.name using
> OfferedSubjectsEnrollee model? can you please help me with the
> associations guys.. cause in the view of OfferedSubjectsEnrollee, i
> wanted to display the Subject.name of the OfferedSubject an Enrollee
> enrolled.. thanks in advance.. more power 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
-~--~~~~--~~--~--~---



Re: Learning cakePHP debugging

2009-09-02 Thread McScreech

@Martin, thanks. debug($activeUser); returns the type of output I was
expecting.

@abc, I'll look into the php version also.

Now on to my problem, once I actually stopped to _read_ the debug
output I realized that the $activeUser variable is NOT CHANGING when I
log out and log back in again. In addition to the partial setup that I
described above, here are the login and logout functions in my
users_controller.php:

function login() {
if( $this->Auth->user() ) {
// Redirect to start page.
$this->redirect( array('controller' => 'pages', 
'action' =>
'start') );
}
} // end login()

function logout() {
$this->Session->destroy();
$this->Session->SetFlash(__('Successfully logged out', true));
$this->redirect( array('controller' => 'pages', 'action' =>
'home') );
} // end logout()

I am using php 5.2.9-1 and cakePHP 1.2.3.8166.

Thanx again, McS.

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



Re: problem with recursive join from stats table

2009-09-02 Thread Ace

It must be somehow connected with "fields" parameter - when I dont use
it, cake does multiple join. But when I add 'fields'=>array
('Campaign.campaignname','SUM( StatsHourly.impressions ) AS
impressions',(...)) into the find method call cake does only first
level joins and I get sql error "Unknown column
'Campaign.campaignname' in 'field list'"..


On 2 Wrz, 13:27, Ace  wrote:
> Hi,
>
> In my adserver's database I have ad impressions stas in table named
> data_summary_ad_hourly. Model for this table is named StatsHourly and
> it "belongsTo" Banner and Zone model. Banner model belongsTo Campaign
> model and Zone model belongs to Publisher model. It's all quite
> logical. Now I would like to find all stats from some period of time -
> I did set recursive to 2 and called find('all') with conditions on
> StatsHourly model. Result contains info about zone and banner but
> doesn't say anything about associated Campaign and Publisher. Why is
> that? It seems that recursive joins are not working for some reason,
> but I don;t know why.. I called $this->Banner->find('all') to check if
> the relation between Banner and Campaign is ok - result contained
> Campaign info so it's ok.
>
> Can it be because I use fields parameter with SUM and other sql
> functions?
>
> Thanks for any help
> Konrad
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Welcome Page not finding CSS/Images

2009-09-02 Thread CoolCourt

Yea I am also on bluehost and i cant even find the conf file or any
solutions to get this newest version of cake php to load the css or
images either.

I am thinking about using the dev version because I wanna get started
on my cake php i downloaded a cheat sheet and everything but i cant
get the css to load.

I would love to get an idea whats wrong just sucks that its not a
problem for everyone. i know previous versions worked fine but this
new version isnt loading the css.

I hope someone can help figure this out.

Court

On Sep 1, 2:58 pm, ajoberstar  wrote:
> .htaccess files are present.  And like I mentioned in my original post
> I copied the files I had locally (that are not working) to bluehost
> and they work there.  I have removed the hash in front of the
> loadmodule statement as well.  So as far as I can tell mod_rewrite is
> enabled, but the cake welcome page still does not work.
>
> On Sep 1, 5:07 am, Kornelije Sajler  wrote:
>
> > It is usually in apache/conf/httpd.confprobably you have comment on it
> > #LoadModule rewrite_module modules/mod_rewrite.so
> > remove hash # to look like this
> > LoadModule rewrite_module modules/mod_rewrite.so
> > and restart server
>
> > and now you have rewrite enabled!
>
> > Hope it helps,
>
> > Kornelije Sajler
>
> > On Tue, Sep 1, 2009 at 11:47, jeff  wrote:
> > > HEY JUST CHECK IN UR SERVER SETTINGS WETHER THE MODE REWRITE IS ENALED OR
> > > NOT...
>
> > > YOU CAN FIND IT UNDER PHP SETTINGS OR SOMETHING LIKE THAT.
>
> > > ENABLE IT .
>
> > > On Mon, Aug 31, 2009 at 11:16 PM, fatnic...@googlemail.com <
> > > fatnic...@googlemail.com> wrote:
>
> > >> Did you make sure you copied over ALL of the files from the Cake
> > >> download? Even the hidden ones? Sounds like the .htaccess file is
> > >> missing.
>
> > >> On Sep 1, 2:04 am, ajoberstar  wrote:
> > >> > I did an install of CakePHP on my local device (Windows XP) with an
> > >> > Apache server.  I did the install to the letter as far as I can tell
> > >> > (removed comment in front of mod_rewrite's load module statement), but
> > >> > I'm getting a welcome page with no layout. And it seems like the whole
> > >> > page isn't even showing up.
>
> > >> > The thing that bugs me the most is that I uploaded the same exact
> > >> > files up to my bluehost account and got the right welcome page.  So
> > >> > it's got to be something with my server setup but I can't figure it
> > >> > out.  Any help would be much appreciated.
>
> > >> > This is all that showed up in the page source:
>
> > >> > Release Notes for CakePHP 1.2.4.8284.
> > >> > https://trac.cakephp.org/wiki/changelog/1.2.x.x";>Read the
> > >> > changelog 
> > >> > 
> > >> >         Your tmp directory is
> > >> writable. > >> > p>
> > >> > 
> > >> >         The FileEngine is being
> > >> used
> > >> > for caching. To change the config edit APP/config/core.php  > >> > p>
> > >> > 
> > >> >         Your database configuration file 
> > >> > is
> > >> > present.
>
> > > --
> > > --
> > > (¨`•.•´¨) I may be busy,
> > > `•.¸(¨`•.•´¨)  but I assure you,
> > > (¨`•.•´¨)¸.•´ you are always in my heart
> > > `•.¸.•´
>
> > > With Lots of Love.
>
> > > THANKS AND REGARDS
>
> > > Jeffery Jacob

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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 1.3 var $scaffold redirect

2009-09-02 Thread Alex Ciminian

I'm having the same issue. I hope to solve it today; if I do, I'll
post here.

On Aug 31, 5:09 am, Andras Kende  wrote:
> Hello,
>
> is it possible that in cake 1.3 using var $scaffoldwont redirect on  
> save or edit ?
> I just get a blank page.
>
>  class ProductsController extends AppController {
>    var $scaffold;}
>
> ?>
>
> core.php set to:
> Configure::write('debug', 0);
>
> Thanks,
>
> Andras

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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 recursive join from stats table

2009-09-02 Thread Ace

Hi,

In my adserver's database I have ad impressions stas in table named
data_summary_ad_hourly. Model for this table is named StatsHourly and
it "belongsTo" Banner and Zone model. Banner model belongsTo Campaign
model and Zone model belongs to Publisher model. It's all quite
logical. Now I would like to find all stats from some period of time -
I did set recursive to 2 and called find('all') with conditions on
StatsHourly model. Result contains info about zone and banner but
doesn't say anything about associated Campaign and Publisher. Why is
that? It seems that recursive joins are not working for some reason,
but I don;t know why.. I called $this->Banner->find('all') to check if
the relation between Banner and Campaign is ok - result contained
Campaign info so it's ok.

Can it be because I use fields parameter with SUM and other sql
functions?

Thanks for any help
Konrad





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: textmate snippets not working

2009-09-02 Thread Martin Westin

Bundles? Unless that's a typo, you might need to stick with one bundle
for CakePHP or you might get some conflict.

I have this one
http://svn.textmate.org/trunk/Review/Bundles/PHP%20Cake.tmbundle
installed in ~/Library/Application Support/TextMate/Bundles/

It works as it should for me. "dat" will expand to "$this->data['…']"
for example.

I have a vague memory of some bundle causing me problems because of
file permissions. Try chmodding your bundle (which is one of these
Apple faux-directories) to make sure Textmate can do it's thing. If
you check it out using subversion they should be ok but you never
know.



On Sep 2, 8:15 am, mikeottinger  wrote:
> Hi All, I've scoured the web and had no luck, I've installed the
> bundles for cakephp, I've set the file type for my php file to HTML
> (PHP Cake), yet none of the snippets work for me. For instance, I try
> typing dat then hitting tab and nothing happens. Is there something
> else I'm missing perhaps? Is this not a fully supported bundle
> anymore?
>
> Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Plugin paginator shows incorrect count and only shows 20 items out of 25

2009-09-02 Thread Agota

Hi there, I am experiencing some issues with pagination in a plugin
mine. It show incorrect pagination counts on all my models in the
plugin. It also shows only 20 results although I have 25 items listed
in one of the table. The search results also just shows 20 results.

All the index pages shows "Page 1 of 1, showing 6 records out of 6
total, starting on record 1, ending on 6"

have anyone experience a similar issue?

I have been struggling with this for some time and cannot find a
solution.

Any help would be appreciated.

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: Multiple Counts

2009-09-02 Thread Alok Mishra
yes you can used multiple join query

On Wed, Sep 2, 2009 at 11:24 AM, SuMiT KuMaR  wrote:

>
> I need to get the counts from three different tables. Is it possible
> to get the counts in a single query?
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Upgrade to new Cake PHP version

2009-09-02 Thread Martin Westin

Yes. That is usually it when is is an update of a stable branch.

The vendors folder is basically an empty placefolder and anything
useful in there will have been puy there by you.
The app folder very rarely change during these updates. If some file
in there does change I expect there will be a warning about it or at
least some buzz in this group about which file need to be replaced.

When Cake is in beta of even pre-beta I often replace app/webroot/
index.php just to be safe. I also diff the config files to see if
anything has changed.




On Sep 2, 11:33 am, Bs  wrote:
> So I generally only replace the cake folder with the one from the new
> release? And what about the app and vendor folders?
>
> On 31 Aug., 15:29, Martin Westin  wrote:
>
>
>
> > Generally you can just replace your cake folder with the new one or do
> > a pull if you use Git.
>
> > Unless you were having problems with some specific feature you are
> > unlikely to notice the changes as they are just to correct for less
> > common bugs that were not caught in beta. A number of changes to the
> > core has to do with improving the comments (and therefore the api-
> > docs) or formatting the core visually. So diff between two versions
> > might look massive since many files will have been altered without
> > affecting the functionality.
>
> > But as I said before, you should run tests or manually check your app
> > prior to putting the new version into production.
>
> > As an example, the only change that actually affected my main
> > application was this one:
> > "Ensuring that 'ext' param added by RequestHandler does not end up as
> > a queryString parameter in Auth.redirect."
> > But then I was one of the few that actually noticed this small bug in
> > the previous version. 99.9% of Cake users did not have the combination
> > of settings required to show that particular bug and they neither
> > noticed the bug nor the patch.
>
> > On Aug 31, 3:01 pm, Bs  wrote:
>
> > > I'm talking about theupgradefrom the 2nd latest stable release
> > > (1.2.3) to the latest stable (1.2.4).
>
> > > There seem to be a lot of differences between the files, at least
> > > that's what I get when using WinMerge to compare the files.
>
> > > On 31 Aug., 13:13, Martin Westin  wrote:
>
> > > > I am not sure you mean version 1.1 to 1.2 or every small update like
> > > > 1.2.3 to 1.2.4?
> > > > I will assume you are talking about possible incompatibilities between
> > > > versions and updated "cake files" in the app dir.
>
> > > > Small updates to the stable 1.2 will probably not ever change any file
> > > > in the app directory. Usually you will not be affected by these
> > > > updates in your code either. It is good practice to have test cases in
> > > > place to quickly check important code and to have a quick read through
> > > > the changelog. I do this just looking for keywords for things that
> > > > might impact my application. I am not so goot at test cases so I
> > > > always make sure I have a look in the browser and try out features
> > > > that are related to changes.
>
> > > > For making the bigger leap from 1.1 to 1.2 there are a number of
> > > > articles and tutorials and a chapter in the cookbook, I believe. You
> > > > can, for example, find one migration article I wrote in the bakery. I
> > > > just logged everything I did when migrating a real application.
>
> > > > /Martin
>
> > > > On Aug 31, 10:31 am, Bs  wrote:
>
> > > > > Hi,
>
> > > > > is there any tutorial available how toupgradeto the latest Cake PHP
> > > > > build? Or is this a task everybody has to do "by hand" by checking
> > > > > every file manually what has changed?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Upgrade to new Cake PHP version

2009-09-02 Thread Bs

So I generally only replace the cake folder with the one from the new
release? And what about the app and vendor folders?


On 31 Aug., 15:29, Martin Westin  wrote:
> Generally you can just replace your cake folder with the new one or do
> a pull if you use Git.
>
> Unless you were having problems with some specific feature you are
> unlikely to notice the changes as they are just to correct for less
> common bugs that were not caught in beta. A number of changes to the
> core has to do with improving the comments (and therefore the api-
> docs) or formatting the core visually. So diff between two versions
> might look massive since many files will have been altered without
> affecting the functionality.
>
> But as I said before, you should run tests or manually check your app
> prior to putting the new version into production.
>
> As an example, the only change that actually affected my main
> application was this one:
> "Ensuring that 'ext' param added by RequestHandler does not end up as
> a queryString parameter in Auth.redirect."
> But then I was one of the few that actually noticed this small bug in
> the previous version. 99.9% of Cake users did not have the combination
> of settings required to show that particular bug and they neither
> noticed the bug nor the patch.
>
> On Aug 31, 3:01 pm, Bs  wrote:
>
> > I'm talking about theupgradefrom the 2nd latest stable release
> > (1.2.3) to the latest stable (1.2.4).
>
> > There seem to be a lot of differences between the files, at least
> > that's what I get when using WinMerge to compare the files.
>
> > On 31 Aug., 13:13, Martin Westin  wrote:
>
> > > I am not sure you mean version 1.1 to 1.2 or every small update like
> > > 1.2.3 to 1.2.4?
> > > I will assume you are talking about possible incompatibilities between
> > > versions and updated "cake files" in the app dir.
>
> > > Small updates to the stable 1.2 will probably not ever change any file
> > > in the app directory. Usually you will not be affected by these
> > > updates in your code either. It is good practice to have test cases in
> > > place to quickly check important code and to have a quick read through
> > > the changelog. I do this just looking for keywords for things that
> > > might impact my application. I am not so goot at test cases so I
> > > always make sure I have a look in the browser and try out features
> > > that are related to changes.
>
> > > For making the bigger leap from 1.1 to 1.2 there are a number of
> > > articles and tutorials and a chapter in the cookbook, I believe. You
> > > can, for example, find one migration article I wrote in the bakery. I
> > > just logged everything I did when migrating a real application.
>
> > > /Martin
>
> > > On Aug 31, 10:31 am, Bs  wrote:
>
> > > > Hi,
>
> > > > is there any tutorial available how toupgradeto the latest Cake PHP
> > > > build? Or is this a task everybody has to do "by hand" by checking
> > > > every file manually what has changed?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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
-~--~~~~--~~--~--~---



saveall for hasone in edit method

2009-09-02 Thread cronet

Hi there,

i stuck in a problem which is perhaps obvious, but i didn't see the
solution right now.
It is a simple savell for a hasnone association. I try to edit the
primary and secondary data in one form. But the secondary data creates
always a new insert instead of updating it.

I think the naming conventions and the form is created correctly...
Address (addresses) hasOne AddressAddition (address_additions)

The Form
echo $form->create('Address');
echo $form->input('id');
echo $form->input('title');
echo $form->input('name');

echo $form->input('AddressAddition.field_1');
echo $form->input('AddressAddition.field_2');
echo $form->input('AddressAddition.field_3');
echo $form->end('Submit');

Which ends in the following data array:

Array
(
[Address] => Array
(
[id] => 1
[title] => 0
[name] => Testname
)

[AddressAddition] => Array
(
[field_1] => 0
[field_2] => 1
[field_3] => 1
)
)

Even if I add $form->input('AddressAddition.address_id') to the form
it did not save correctly.

UPDATE `addresses` SET `id` = 1, `title` = '0',  `name` = 'Testname'
INSERT INTO `address_additions` (`field_1`, `field_2`, `field_3`)
VALUES (1, 1, 1)

The second sql should be an update too...

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



Re: Translate Behavior Question ! ?

2009-09-02 Thread DatacenterHellas

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



Re: How to not escape Javascript in html helper link

2009-09-02 Thread Kana

Quoting myself:
"I already mentioned trying both SINGLE quotes and DOUBLE quotes. Both
result in escaped quotes, hence this post. "

I could have been more clear on where exactly I tried both double and
single quotes :)

On Sep 2, 9:44 am, Kana  wrote:
> Hi there, thanks for your quick reply.
>
> I already mentioned trying both SINGLE quotes and DOUBLE quotes. Both
> result in escaped quotes, hence this post.
>
> The example you gave results in:
>
>  onClick="pageTracker._trackEvent('category',
> 'action', 'label');">
> >
>
> Is there something I am overlooking here? Is it justnotpossible to
> haveJavascriptin $html->link() ?
>
> :)
>
> Kana
>
> On Sep 2, 4:03 am, "Dr. Loboto"  wrote:
>
>
>
> > Use SINGLE QUOTES when need quotes in tag attributes. It is the basics
> > ofHTML.
>
> >  >     echo $html->link(
> >         $html->image('an_image.jpg'),
> >         '/image/a_link.php?test',
> >         array(
> >             'class' => 'image',
> >             'escape' => false,
> >             'onClick' => "pageTracker._trackEvent('category',
> > 'action', 'label');"
> >         ),
> >         false,
> >         false
> > );
> > ?>
>
> > On Sep 2, 12:15 am, Kana  wrote:
>
> > > How tonotescapeJavascriptinhtmlhelperlinkwithout having to use
> > >Javascriptoutside $html->link?
>
> > > I try to achieve:
> > > - the quotes in the onClick event, either single or double quotes
>
> > >  > > onClick="pageTracker._trackEvent("category", "action", "label");">
> > >         
> > > 
>
> > > But the result I get when viewing pagesource is:
> > > - note the escaped quotes
> > > - I tried single and double quotes
>
> > >  > > onClick="pageTracker._trackEvent("category",
> > > "action", "label");">
> > >         
> > > 
>
> > > I use the following code:
>
> > >  > > echo $html->link(
> > >         $html->image('an_image.jpg'),
> > >         '/image/a_link.php?test',
> > >         array('class' => 'image', 'escape' => false, 'onClick' =>
> > > 'pageTracker._trackEvent("category", "action", "label");'),
> > >         false,
> > >         false
> > > );
> > > ?>
>
> > > There must be a way to onClickJavascriptworking inlink? I Googled
> > > but couldn't find any topic on 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
-~--~~~~--~~--~--~---



Re: How to not escape Javascript in html helper link

2009-09-02 Thread Kana

Hi there, thanks for your quick reply.

I already mentioned trying both SINGLE quotes and DOUBLE quotes. Both
result in escaped quotes, hence this post.

The example you gave results in:



Is there something I am overlooking here? Is it just not possible to
have Javascript in $html->link() ?

:)

Kana


On Sep 2, 4:03 am, "Dr. Loboto"  wrote:
> Use SINGLE QUOTES when need quotes in tag attributes. It is the basics
> ofHTML.
>
>      echo $html->link(
>         $html->image('an_image.jpg'),
>         '/image/a_link.php?test',
>         array(
>             'class' => 'image',
>             'escape' => false,
>             'onClick' => "pageTracker._trackEvent('category',
> 'action', 'label');"
>         ),
>         false,
>         false
> );
> ?>
>
> On Sep 2, 12:15 am, Kana  wrote:
>
>
>
> > How tonotescapeJavascriptinhtmlhelperlinkwithout having to use
> >Javascriptoutside $html->link?
>
> > I try to achieve:
> > - the quotes in the onClick event, either single or double quotes
>
> >  > onClick="pageTracker._trackEvent("category", "action", "label");">
> >         
> > 
>
> > But the result I get when viewing pagesource is:
> > - note the escaped quotes
> > - I tried single and double quotes
>
> >  > onClick="pageTracker._trackEvent("category",
> > "action", "label");">
> >         
> > 
>
> > I use the following code:
>
> >  > echo $html->link(
> >         $html->image('an_image.jpg'),
> >         '/image/a_link.php?test',
> >         array('class' => 'image', 'escape' => false, 'onClick' =>
> > 'pageTracker._trackEvent("category", "action", "label");'),
> >         false,
> >         false
> > );
> > ?>
>
> > There must be a way to onClickJavascriptworking inlink? I Googled
> > but couldn't find any topic on 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
-~--~~~~--~~--~--~---



Re: Multiple Counts

2009-09-02 Thread WebbedIT

Is this that different to your other post about counts that it needs
to be in a different thread?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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: Get Counts

2009-09-02 Thread WebbedIT

Need more info really ...

Is this a pagination or a count query?
Is it a count of related records (i.e. counterCache) or a count of a
returned result set?
In what situation would you be looking for the count of a record
alone?

Probably better of explaining in detail what it is you're trying to
achieve.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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
-~--~~~~--~~--~--~---



Multiple Counts

2009-09-02 Thread SuMiT KuMaR

I need to get the counts from three different tables. Is it possible
to get the counts in a single query?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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
-~--~~~~--~~--~--~---



textmate snippets not working

2009-09-02 Thread mikeottinger

Hi All, I've scoured the web and had no luck, I've installed the
bundles for cakephp, I've set the file type for my php file to HTML
(PHP Cake), yet none of the snippets work for me. For instance, I try
typing dat then hitting tab and nothing happens. Is there something
else I'm missing perhaps? Is this not a fully supported bundle
anymore?

Thanks in advance.

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



Get Counts

2009-09-02 Thread SuMiT KuMaR

Cakephp provides the function to get the count of a query with:
$this->Model->find("count")

Also I have noticed that cakephp fires the count query to each query
that i execute.

Questions:
1. Is it because of the Pagination component/helper?
2. How to get the result of the Count query?

Here are the two queries:
SELECT COUNT(*) AS `count` FROM `conferences` AS `Conference`
LEFT JOIN `venues` AS `Venue` ON (`Conference`.`venue_id` =
`Venue`.`id`)
WHERE `Conference`.`date` >= '2009-09-01 21:37:35'
AND `Conference`.`status` = 1

SELECT * FROM `conferences` AS `Conference`
LEFT JOIN `venues` AS `Venue` ON (`Conference`.`venue_id` =
`Venue`.`id`)
WHERE `Conference`.`date` >= '2009-09-01 21:37:35'
AND `Conference`.`status` = 1
ORDER BY `Conference`.`date` ASC
LIMIT 20

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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
-~--~~~~--~~--~--~---



Set the timestamp to current server time manually...

2009-09-02 Thread gparra

Hi,

I realize this question may be fairly easy to answer, but I just
haven't managed to get a clear understanding of how to do it through
the documentation or google search.

I settled by using the database convention of naming my date field to
'created' as a datetime field in the database and in the model.

This way, when I save it stores the current timestamp.

However I'd like to know if there's a way I can manually set the
timestamp using the Time helper or another time/date function in
cakephp. Couldn't find anything similar online, I'd appreciate any
comments.

The idea is to do something like this in the controller:

$this->data[Visit].['date'] = timestamp()* (I realize this could take
any shape or form, please suggest the simplest most cakephp framework
centric alternative).

Thanks!
German.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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 on linking 3 model associations

2009-09-02 Thread learning_cake_php

Im building a school enrollment system then i came across with this
problem with associations.first of all, i need to link 3 tables:

1. subjects
-id
-name
-lecture_units
-lab_units

2. offered_subjects
-id
-subject_id
-section
-schedule

3. offered_subjects_enrollees
-id
-offered_subject_id
-enrollee_id

(of course there is an enrollee table but lets just stick with my main
problem...)

using this 3 tables, how can i get the Subject.name using
OfferedSubjectsEnrollee model? can you please help me with the
associations guys.. cause in the view of OfferedSubjectsEnrollee, i
wanted to display the Subject.name of the OfferedSubject an Enrollee
enrolled.. thanks in advance.. more power 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
-~--~~~~--~~--~--~---



Re: Learning cakePHP debugging

2009-09-02 Thread Martin Westin


Any reason you are not just using debug?
debug($activeUser);

I have never used the Debugger class myself. I am generally content to
just debug to screen when something strange happens.

/Martin



On Sep 2, 2:36 am, abc  wrote:
> Use the var_dump of php,
>     ob_start();
>      var_dump($activeuser);
>     $dump_string = ob_get_clean();
>
> Now dump the string,
>
> On Sep 1, 12:06 pm, McScreech  wrote:
>
>
>
> > Hello,
>
> > I am learning to trace through my code to debug results that I don't
> > understand.
> > I have the following setup (in part):
> > (And apologies for running on in my attempt to describe the
> > situation.)
>
> > in app_controller.php:
> >         var $uses = array('User');
> >         var $components = array('Acl', 'Auth', 'Session');
>
> >         function beforeFilter() {
> >                 // Configure AuthComponent
> >                 $this->Auth->autoRedirect = false;
> >                 $this->Auth->authorize = 'actions';
> >                 $this->Auth->loginAction = array('controller' => 'users', 
> > 'action'
> > => 'login');
> >                 $this->Auth->allowedActions = array('display', 'login', 
> > 'logout');
>
> >                 // Remember user who is logged in
> >                 $activeUser = 
> > $this->User->find(array($this->Auth->user('id')));
> >                 $this->set('activeUser', $activeUser);
> >         } // end beforeFilter()
> >         . . .
>
> > in users_controller.php:
> >         function login() {
> >                 if( $this->Auth->user() ) {
> >                         $this->redirect( array('controller' => 'pages', 
> > 'action' =>
> > 'start') );
> >                 }
> >         } // end login()
> >         . . .
>
> > I have introductory content in home.ctp with a link to login.ctp which
> > on success redirects to start.ctp. This 'start' page is where I am
> > trying to setup different menus depending on the users access
> > privileges.
>
> > In start.ctp:
> >         // Debugging info begin
> >         $oldDebug = Configure::read('debug');
> >         Configure::write('debug', 3);
> >         Debugger::dump(isset($activeUser));
> >         Debugger::dump($activeUser);
> >         Debugger::dump($activeUser['User']);
> >         Debugger::dump($activeUser['Group']);
> >         Configure::write('debug', $oldDebug);
> >         // Debugging info end
>
> >         if(isset($activeUser)) {
> >                 switch ($activeUser['Group']['id']):
> >                     case 1: // user is in administrator group
> >                         echo $this->element('adm_menu');
> >                         break;
> >                     case 2: // moderator group
> >                         echo $this->element('mod_menu');
> >                         break;
> >                     case 3: // user group
> >                         echo $this->element('usr_menu');
> >                         break;
> >                     default: // guest group
> >                         echo $this->element('gst_menu');
> >                 endswitch;
> >         }
> >         . . .
>
> > The dump calls output:
> >         Debugger::dump(isset($activeUser));
> >                 true
>
> >         Debugger::dump($activeUser);
> >                 array(
> >                         "User" => array(),
> >                         "Group" => array()
> >                 )
>
> >         Debugger::dump($activeUser['User']);
> >                 array(
> >                         "id" => "1",
> >                         "username" => "xxx",
> >                         "first" => "xxx",
> >                         "last" => "xxx",
> >                         "password" => "xxx",
> >                         "group_id" => "1",
> >                         "created" => "2009-08-27 14:51:52",
> >                         "modified" => "2009-08-27 14:51:52"
> >                 )
>
> >         Debugger::dump($activeUser['Group']);
> >                 array(
> >                         "id" => "1",
> >                         "name" => "Administrator",
> >                         "created" => "2009-08-27 14:50:33",
> >                         "modified" => "2009-08-27 14:50:33"
> >                 )
>
> > All acceptable, however my question is: How can I dump the full
> > contents of $activeUser with sub components in a way that I do not
> > have to call the 'User' and 'Group' arrays separately? Or extended to
> > work on a variable where I don't have to know it's full structure.
>
> > Many thanx in advance, McS
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To 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
-~--~~~~--~~--~--~---