Re: implementing a custom cache for views

2011-05-18 Thread Amit Badkas
Hi,

I wrote
http://www.sanisoft.com/blog/2010/06/21/cakephp-cache-views-by-domain-a-cache-helper/a
while back, may help you.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, May 18, 2011 at 2:56 PM, Lorenzo Bettini
wrote:

> Hi
>
> I'm still struggling trying to make localization work together with view
> cache...
>
> do you think implementing a custom cache for views might be the solution?
>  For instance, by using a different cache file prefixed with the current
> language?
>
> In that case, should I provide a new cache in the views/helpers location?
>
> any suggestion/example of how to provide a custom cache view helper?
>
> many thanks in advance
>Lorenzo
>
> --
> Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
> HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
> BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
>
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org Check out the new CakePHP Questions site
> http://ask.cakephp.org and help others with their CakePHP related
> questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Problems with Auth->userScope

2011-02-10 Thread Amit Badkas
Hi,

I think you are talking about ACL, not
authentication. $this->Auth->userScope used as condition while doing login
and it doesn't provide mechanism to access or deny particular user to
particular page.

Hope that helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Feb 11, 2011 at 11:07 AM, zero00  wrote:

> Ok so the problem is that i have users who are admins and users who are
> not.
> but the users who dont have admin acess which is represent by 0 on the db
> still get on it
>
> //Database
>
> DB T Schema:
>id
>username  varchar
>password  varchar
>admin   tiny_int(1)
>
> //Controller class
>
> class AdminsController extends AppController {
> var $name = 'Admins';
> var $uses = array('User');
>
> function beforeFilter() {
> parent::beforeFilter();
> $this->Auth->loginAction = array('controller' => 'admins', 'action'
> => 'login');
> $this->Auth->userScope = array('User.admin' => '1');
> }
>
> }
> ?>
>
> Thanks in advance
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: array_key_exists php statement

2011-02-07 Thread Amit Badkas
Hi,

Off topic, for performance improvement, use isset() instead of
array_key_exists()

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Feb 7, 2011 at 12:52 PM, chris...@yahoo.com wrote:

> Ok,
> I manage to do that...
> here is what works
>
>
>
>link($gift['GiftCategory']['name'], '/gifts/
> category/' . $gift['GiftCategory']['name']) ?>
>
>
>
>
>
>
>
> thanks
> chris
>
>
> On Feb 6, 10:00 pm, Tilen Majerle  wrote:
> > wtf are u trying to do??
> >
> > {{{
> >
> > if (array_key_exists($gift['GiftCategory']['name'], $yourArray)):
> >
> > else:
> >
> > endif;
> >
> > if (array_key_exists('controller', $this->params) &&
> > $this->params['controller'] == 'gifts'):
> >
> > else:
> >
> > endif;
> >
> > //better choice
> > if (isset($this->params['controller']) && $this->controller == 'gifts')
> > {
> >
> > }
> > }}}
> >
> > --
> > Lep pozdrav, Tilen Majerlehttp://majerle.eu
> >
> > 2011/2/7 chris...@yahoo.com 
> >
> >
> >
> >
> >
> >
> >
> > > Hi guys,...
> > > how u ding...
> >
> > > I need help with php statement. I'm getting an error:
> > > Parse error: syntax error, unexpected ';' in /home/zipmaniak/
> > > zippopeople.com/html/app/views/gifts/admin_manage.ctp on line 93
> >
> > > 
> >
> > > Please some one help me with this...  or if I have to call from
> > > controller,... how do I do that...?
> >
> > > params) && $this-
> > > >params['controller'] == 'gifts' . ---WHAT ELSE IN
> > > HERE ???--- )): ?>
> >
> > > Thanks
> > > Chris
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Logging of PHP fatal errors not working

2011-02-03 Thread Amit Badkas
Hi,

You can log all the errors including fatal ones by using 'error_log' setting
in php.ini, for example, my php.ini has

log_errors = On
error_log = /home/amit/Web/demos/php/logs/php_errors.log

Then if there is any fatal error, I get an entry in php_errors.log like

[04-Feb-2011 10:48:57] PHP Fatal error:  Call to a member function test() on
a non-object in /home/amit/Web/demos/php/fatalError.php on line 3
[04-Feb-2011 10:48:57] PHP Stack trace:
[04-Feb-2011 10:48:57] PHP   1. {main}()
/home/amit/Web/demos/php/fatalError.php:0

Do ensure that your webserver has the permission to write to php_errors.log

Hope that helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Feb 4, 2011 at 10:39 AM, Dr. Tarique Sani wrote:

> On Fri, Feb 4, 2011 at 10:19 AM, Ryan Schmidt
>  wrote:
> >
> > On Feb 3, 2011, at 22:01, Dr. Loboto wrote:
> >
> >> Cake's logging settings can work only when Cake is working. If PHP
> >> dies on parse error it just don't reach Cake setup code at all. Same
> >> about fatal error before Cake sets own log. Etc. You better read PHP
> >> docs before blame Cake ones.
> >
> > So are you saying there are some CakePHP-related fatal errors that
> CakePHP would log, and other PHP-related fatal errors (parse errors, etc.)
> that it wouldn't?
>
> I went and saw that page, the information on the page is wrongly
> represented E_WARNING is the level of error reporting which shows only
> warnings and fatal errors, however if you set Configure::write('log',
> E_WARNING); only warnings will be logged because fatal error will kill
> PHP before it reaches CakePHP's Configure::write() method
>
> Cheers
> Tarique
>
> --
> =
> PHP for E-Biz: http://sanisoft.com
> =
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Logging of PHP fatal errors not working

2011-02-03 Thread Amit Badkas
Hi,

Think again :)

How can fatal error be logged when PHP is dead?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Feb 3, 2011 at 2:52 PM, bbf  wrote:

> Cake 1.3.7
>
> core.php:
> Configure::write('debug', 0);
> Configure::write('log', true);
>
>
> According to this page:
> http://book.cakephp.org/#!/view/1584/Error-logging
> the logging of warning and fatal errors can be handled by the Cake
> logs ("...Would log only warning and fatal errors.").
>
> Warning errors are being logged fine. (I test this by including a file
> that doesn't exist)
>
> Fatal errors are not logged.  Is this an error in the docs?  Fatal
> errors do show up in the log file specified in php.ini, but I can't
> touch the php.ini on my shared host.
>
>
> Thanks for any insight :)
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Views with Joined Models

2011-01-31 Thread Amit Badkas
Hi,

You need to get posts alongwith their tags for a single author, right?

Attach 'containable' behavior to AppModel (or the Author model, as per your
need) and in controller's action, put the code something like

$this->Author->contain(array(
  'Post' => array(
'Tag'
   )
 ));

$this->set('author', $this->Author->findById($id));

Now, in the view, if you loop through author's posts using

foreach ($author['Post'] as $post)

then $post['Tag'] will contain the list of tags assigned to that particular
post.

Hope that helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Feb 1, 2011 at 3:49 AM, Hill180  wrote:

> I am sorry for the basic question.. but here goes.
>
> I will use Blog Posts as an Example
>
> I have the following models:
>
> Author
> Post
> Tags
>
> All the associations are fine as the scaffold pages are working
> without a problem.
>
> I have a page under the Author Controller the standard view:
>
> function view($id = null) {
>if (!$id) {
>$this->Session->setFlash(__('Invalid Author',
> true));
>$this->redirect(array('action' => 'index'));
>}
>$this->set('author', $this->Post->read(null, $id))
>}
>
> In my view.ctp
>
> I want to show the author, all his/her posts and individual tags.
>
> I can easily show all the posts, but how do I get the individual tags?
>
> IE:
>
> echo $author->['Author']['name']; //good
>
> foreach ($author['Post'] as $post):
> print_r(post); //good
>
> How would I get all the tags for that specific post?
>
>
> Goal:
> Open http://localhost/authors/view/3
>
> AUTHOR:  DUDE #3
> Post  5 - Tags (OPEN, IT)
> Post 10 - Tags (IT)
> Post 11 - Tags (Open)
>
> Thanks!
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Sorting by a (second level) associated model using paginate helper

2011-01-31 Thread Amit Badkas
Hi,

As per the code at http://api13.cakephp.org/view_source/controller/#l-1060and
http://api13.cakephp.org/view_source/controller/#l-1128 , I don't think
paginate() can sort using the field of model which has more than one level
deep relation with the paginated model.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Jan 31, 2011 at 3:42 AM, Pete  wrote:

> Dear all,
>
> I suspect this is either really easy or very hard. I've been through
> endless apparently similar questions on here but haven't been able to
> figure out the answer.
>
> I have a "Quote" model, which I am trying to list in a view. Quote
> belongsTo Attendance which belongs to Person. I am trying to sort the
> list of quotes by the first_name field in the Person model.
>
> The array being sent to the view is
>
> Array
> (
> [0] => Array
>(
>[Quote] => Array
> (
>[id] => 1
>[attendance_id] => 15
>[quote_text] => Hello
>
>)
>
>[Attendance] => Array
>(
>[id] => 15
>[person_id] => 2
>[trip_id] => 7
>[Person] => Array
> (
>  [id] => 2
>  [first_name] => John
>  [last_name] => Smith
>
>   )
>
>)
>)
>
>
> }
> This seems to work fine, and in the view, I can echo out
>
>foreach ($quotes as $quote) {
>echo $quote['Attendance']['Person']['first_name'];
> }
> without any problem.
>
> What I cannot get to work is accessing/using the same variable as a
> sort field in paginate
>
>   echo $this->Paginator->sort('Name',
> 'Attendance.Person.first_name');
> or
>
>echo $this->Paginator->sort('Location',
> 'Attendance.Trip.location');
>
> Does not work. It appears to sort by something, but I'm not sure what.
> Am I using the correct syntax?. Is there something I should be doing
> in a model or controller to make this work?
>
> Thanks in advance.
>
> Peter
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: need help

2011-01-31 Thread Amit Badkas
Hi,

By setting 'empty' to false won't display the empty option but you need to
set an extra option having label as 'select state', right? For this, set
'empty' => 'select state' instead of false in the 4th argument of select().

Hope that helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Jan 31, 2011 at 10:06 AM, andy_the ultimate baker <
anandghaywankar...@gmail.com> wrote:

> thanks
>
> On Jan 29, 7:54 pm, cricket  wrote:
> > On Sat, Jan 29, 2011 at 3:45 AM, andy_the ultimate baker
> >
> >
> >
> >  wrote:
> > > hi, bakers
> > > i m working on one drop down list, i m getting all the values but the
> > > first option is coming blank. i want set this as "select state" with
> > > some value, like we used to in core php.
> > >  my view code is as fallows
> >
> > > > >echo $form-
> >
> >>select('state_code',array($newStates),null,array('id'=>'select_states'),false);
> > >?> > > //  echo $form-
> > >>select('id',array(),null,array('id'=>'select_cities'),false);
> >
> > >?>
> > >
> > >
> > > 
> >
> > > with this code when i see source view i get first option blank like
> > > bellow
> >
> > > option value="">
> >
> > > Libya (general)
> > > Baladiyat al `Aziziyah > > option>
> > > Baladiyat al Jufrah
> > >  can any one suggest me, how to make first option as "select
> > > something" in cake
> >
> > The API documentation is still VERY confusing on this. The answer is
> > to include 'empty' => false in the array that is the 4th param.
> >
> > echo select('name', $options, null, array('id'=>'select_states',
> > 'empty' => false));
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: save multiple related records

2011-01-27 Thread Amit Badkas
Hi,

Both the fields in the form are multi-select, so how you want to save the
data? Will all selected users relate to all selected exercises?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Jan 28, 2011 at 4:07 AM, cake bake  wrote:

> is there any way to save multiple related records here is my code
>
> function asign() {
>$this->loadModel('UsersExercise');
>if (!empty($this->data)) {
>$this->UsersExercise->create();
>if ($this->UsersExercise->save($this->data)) {
>$this->Session->setFlash(__('The exercise could not
> be saved.
> Please, try again.', true));
>$this->redirect(array('action' => 'index'));
>} else {
>$this->Session->setFlash(__('The exercise
> could not be saved.
> Please, try again.', true));
>}
>}
>$users = $this->Exercise->User->find('list');
>$exercises = $this->Exercise->find('list');
>$this->set(compact('users'));
>$this->set(compact('exercises'));
>}
>
> Form->create('UsersExercise',array('url' => '/
> exercises/asign'));?>
>
>
>echo $this->Form->input('user_id',array('type' =>
> 'select','multiple' => true,'options' => $users) );
>echo $this->Form->input('exercise_id',array('type' =>
> 'select','multiple' => true,'options' => $exercises) );
>?>
>
> Form->end(__('Submit', true));?>
>
>
>
> here is the debug for this->data
>
> Array
> (
>[_Token] => Array
>(
>[key] => 3sss
>[fields] => sss)
>
>[UsersExercise] => Array
>(
>[user_id] => Array
>(
>[0] => 1
>)
>
>[exercise_id] => Array
>(
>[0] => 1
>[1] => 2
>[2] => 3
>)
>
>)
>
> )
>
>
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How to know that user login failed due to wrong information?

2011-01-25 Thread Amit Badkas
Hi,

Have you outputted the authentication flash message (mostly in layout) using
following code?

echo $session->flash('auth');

You can also set your own error message when login fails, please have a look
at http://book.cakephp.org/view/1272/loginError

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Jan 24, 2011 at 3:42 PM, raymond  wrote:

> How do you do every one.
> I used ACL for user authentication, and now it works well.
> However, when user logs in with wrong information, he(or she) gets
> redirected to login page without any message.
> I am wondering if no way to show any message like "Your login
> information is not correct", etc.
> No suggestion?
> Best regards.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Model function for Controller :: how do I call it in the Controller?

2011-01-23 Thread Amit Badkas
Hi,

I already knew what you need and I can provide you the code but I think you
should refer http://book.cakephp.org/view/1231/Pagination and learn by
yourself how to use conditions, limit, order etc. for pagination.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Jan 21, 2011 at 11:19 PM, OldWest  wrote:

> I cannot resolve how to call a model function into a controller. I've been
> through too much documentation to count. Maybe I am wrong in what I am
> trying to do altogether? Continue to get MySQL errors.
>
> *Plan :: Model:*
>
> function getActive()
> {
> $findParameters = array(
> 'limit' => 10,
> 'order' => array('Plan.monthly_cost' => 'asc'),
> 'conditions' => array('PlanDetail.active' => 1) // Gets all
> active=1 plan_details.
> );
> return $this->find('all', $findParameters);
> }
>
> *Plan :: Controller:*
> *
> *
> function search() {
> $this->Plan->recursive = 2; //*** Modified by Jason: Recursion needs to be
> corrected with better method. ***//
>  *$active* = $this->Plan->getActive();
> $this->set('plans', $this->paginate(*$active*));
>  }
>
> *Notice* (8) 
> <http://cda-insurance.com.w3developing.com/pre/cake/beta/plans/search>: Array 
> to string conversion [*ROOT*
>
> *Warning* (512) 
> <http://cda-insurance.com.w3developing.com/pre/cake/beta/plans/search>: *SQL 
> Error:* 1054: Unknown column 'Plan' in 'where clause'
>
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Model query for controller to view results

2011-01-21 Thread Amit Badkas
Hi,

I think you need to set parameters for pagination, please have a look at
http://book.cakephp.org/view/1232/Controller-Setup

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Jan 21, 2011 at 2:36 PM, OldWest  wrote:

> Ok. Can you recommend a proper way of doing this or show a tutorial on
> this? I read the manual on fetching data, but it does not give examples of
> controllers using model queries (that I could find).
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Model query for controller to view results

2011-01-21 Thread Amit Badkas
Hi,

You are fetching active records in $active variable but that variable is not
being used anywhere. That's why the paginated results are not
affected.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Jan 21, 2011 at 2:27 PM, OldWest  wrote:

> Ok the error is gone now, but for some reason the results are not being
> effected?
>
> I am calling it like so in my Controller:
>
> function search() {
> $this->Plan->recursive = 2; //*** Modified by Jason: Recursion needs to be
> corrected with better method. ***//
>  *$active = $this->Plan->getActive();*
> $this->set('plans', $this->paginate());
> }
>
> Any ideas why this is not taking hold?
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Model query for controller to view results

2011-01-21 Thread Amit Badkas
Hi,

Following should be the correct way

function getActive()
{
$findParameters = array(
'limit' => 10,
'order' => array('PlanDetail.monthly_cost' => 'asc'),
'conditions' => array('PlanDetail.active' => 1) // Gets all active=1
plan_details.
    );

return $this->find('all', $findParameters);
}

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Jan 21, 2011 at 2:04 PM, OldWest  wrote:

> I am continuing to get an SQL error, and my query is NOT working???
>
> *Warning* (512) 
> <http://cda-insurance.com.w3developing.com/pre/cake/beta/plans/search>: *SQL 
> Error:* 1064: You have an error in your SQL syntax; check the manual that 
> corresponds to your MySQL server version for the right syntax to use near 
> 'order = ('asc') AND conditions = (1)' at line 1
>
>
> Here is my code:
>
> *Plan Controller* Method search()
>
> function search() {
> $this->Plan->recursive = 2; //*** Modified by Jason: Recursion needs to be
> corrected with better method. ***//
>  $active = $this->Plan->*getActive()*;
> $this->set('plans', $this->paginate());
> } // Trying to get $active to return to my results, but nothing is
> happening at all except the above error and ALL results (query is not
> effective).
>
> *Plan Model *Method search()
>
> function getActive() {
>   $conditions = array(
> 'limit' => 10,
> 'order' => array('monthly_cost' => 'asc'),
>  'conditions' => array('PlanDetail.active' => 1) // Gets all active=1
> plan_details.
> );
>   return $this->find('all', compact('conditions'));
>}
>
> Anyone know why this is not working?
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Database-Design for making a Comment a parent of another Comment

2011-01-20 Thread Amit Badkas
Hi,

I think you need to try Tree behavior, please have a look at
http://book.cakephp.org/view/1339/Tree

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 20, 2011 at 1:14 PM, josef corley  wrote:

> Howdy. ^^
>
> I'm a noob at this so, please bear with me.. ^_^
>
>
> I have these following tables with their corresponding associations:
>
> Users-
>  id, username, password,username, email, website,
> date_registered, name, role_id, last_name, first_name, about
>   hasMany=Post,Comment
>
> Posts-
>  id,   author_id , date_posted ,   content ,   title,
>  date_modified ,
> published
>  belongsTo=User=>
>   foreignKey=>author_id
>
>  hasMany=Comment
>
>
> Comments-
> id ,   post_id ,   date ,  content ,approved , agent ,
> user_id ,
> parent_id
> belongsTo=Post,
>  'User'=>
> foreignkey=>user_id
>
>
>
>
>
>
> Now if, for example, a registered-user wants to reply to a COMMENT,
> that is under a POST, (like in youtube, where when you click "Reply"
> in the side of another COMMENt by another registered-user, your
> comment will be indented, making the Comment where you've clicked
> "Reply",, the parent of your comment right?)
>
> is putting the "parent_id" inside the comments table good enough?,
> I've been thinking about this for hours now, sorry for the noobness.
> ^_^
>
> if it is good enough, how do I make a table associate with itself...
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: image upload issue

2011-01-20 Thread Amit Badkas
Hi,

It seems that you didn't read my replies carefully. I asked you twice about
correcting field names in view (e.g., 'filedata' instead of
'Image/filedata') but still you didn't do it.

If you are coding anything using CakePHP without learning the basics, then
please refer http://book.cakephp.org first and try to build a basic blog
application (http://book.cakephp.org/view/1528/Blog).

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 20, 2011 at 1:56 PM, andy_the ultimate baker <
anandghaywankar...@gmail.com> wrote:

> this is my view
> what changes should i do with this?
>
> Upload An Image
> Form->create('Image',
> array('action'=>'admin_upload', 'type' => 'file'));?>
> 
>
>Images
>
>
>
>label('Image/images',
> 'Image:' );?>
>file('Image/filedata');?>
>
>
>
>
> 
>
>
>
> On Jan 20, 12:38 pm, Amit Badkas  wrote:
> > Hi,
> >
> > Have you corrected field names in view (e.g., 'filedata' instead
> > of 'Image/filedata')?
> >
> > Also provide 'type' as 'file' to Form->create(). For example,  > $this->Form->create('Image', array('action'=>'admin_upload', 'type' =>
> > 'file'));?>
> >
> > Hope this helps.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Thu, Jan 20, 2011 at 12:37 PM, andy_the ultimate baker <
> >
> > anandghaywankar...@gmail.com> wrote:
> > > even by using
> > > $file = $this->data['Image']['filedata'];
> > > i m still getting an error. this time like bellow
> >
> > > Undefined index:  filedata [APP/controllers/images_controller.php,
> > > line 19]
> >
> > > now what???
> >
> > > On Jan 20, 11:58 am, Amit Badkas  wrote:
> > > > Hi,
> >
> > > > Why are you using field names in 'Modelname/fieldname' pattern
> instead of
> > > > just 'fieldname'? For example, you need to use 'filedata' instead of
> > > > 'Image/filedata'
> > > > as you have already given 'Image' as first parameter for
> Form->create();
> >
> > > > Also the code in controller's action is
> >
> > > > $file = $this->data['Image']['images'];
> >
> > > > but it should be
> >
> > > > $file = $this->data['Image']['filedata'];
> >
> > > > as the file upload field's name is 'filedata', not 'images'.
> >
> > > > Hope this helps.
> >
> > > > Amit Badkas
> >
> > > > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > > > On Thu, Jan 20, 2011 at 12:08 PM, andy_the ultimate baker <
> >
> > > > anandghaywankar...@gmail.com> wrote:
> > > > > Undefined index:  images [APP/controllers/images_controller.php,
> line
> > > > > 19]
> >
> > > > > and
> >
> > > > > Cannot modify header information - headers already sent by (output
> > > > > started at /home/satish/anand/cakephp/cake/libs/debugger.php:673)
> > > > > [CORE/cake/libs/controller/controller.php, line 742]
> >
> > > > > On Jan 20, 11:08 am, Amit Badkas  wrote:
> > > > > > Hi,
> >
> > > > > > What is the error you are facing?
> >
> > > > > > Amit Badkas
> >
> > > > > > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > > > > > On Thu, Jan 20, 2011 at 11:17 AM, andy_the ultimate baker <
> >
> > > > > > anandghaywankar...@gmail.com> wrote:
> > > > > > > hi there,
> > > > > > > i working on image uploading, but i m facing an error,
> > > > > > > can any one solve the issue,
> >
> > > > > > > //this is my controller file image_controller.php
> >
> > > > > > >  > > > > > > class ImagesController extends AppController {
> >
> > > > > &g

Re: image upload issue

2011-01-19 Thread Amit Badkas
Hi,

Have you corrected field names in view (e.g., 'filedata' instead
of 'Image/filedata')?

Also provide 'type' as 'file' to Form->create(). For example, Form->create('Image', array('action'=>'admin_upload', 'type' =>
'file'));?>

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 20, 2011 at 12:37 PM, andy_the ultimate baker <
anandghaywankar...@gmail.com> wrote:

> even by using
> $file = $this->data['Image']['filedata'];
> i m still getting an error. this time like bellow
>
> Undefined index:  filedata [APP/controllers/images_controller.php,
> line 19]
>
> now what???
>
>
> On Jan 20, 11:58 am, Amit Badkas  wrote:
> > Hi,
> >
> > Why are you using field names in 'Modelname/fieldname' pattern instead of
> > just 'fieldname'? For example, you need to use 'filedata' instead of
> > 'Image/filedata'
> > as you have already given 'Image' as first parameter for Form->create();
> >
> > Also the code in controller's action is
> >
> > $file = $this->data['Image']['images'];
> >
> > but it should be
> >
> > $file = $this->data['Image']['filedata'];
> >
> > as the file upload field's name is 'filedata', not 'images'.
> >
> > Hope this helps.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Thu, Jan 20, 2011 at 12:08 PM, andy_the ultimate baker <
> >
> > anandghaywankar...@gmail.com> wrote:
> > > Undefined index:  images [APP/controllers/images_controller.php, line
> > > 19]
> >
> > > and
> >
> > > Cannot modify header information - headers already sent by (output
> > > started at /home/satish/anand/cakephp/cake/libs/debugger.php:673)
> > > [CORE/cake/libs/controller/controller.php, line 742]
> >
> > > On Jan 20, 11:08 am, Amit Badkas  wrote:
> > > > Hi,
> >
> > > > What is the error you are facing?
> >
> > > > Amit Badkas
> >
> > > > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > > > On Thu, Jan 20, 2011 at 11:17 AM, andy_the ultimate baker <
> >
> > > > anandghaywankar...@gmail.com> wrote:
> > > > > hi there,
> > > > > i working on image uploading, but i m facing an error,
> > > > > can any one solve the issue,
> >
> > > > > //this is my controller file image_controller.php
> >
> > > > >  > > > > class ImagesController extends AppController {
> >
> > > > >var $name = 'Images';
> > > > >var $helpers = array('Html', 'Form');
> > > > >var $components = array('Upload');
> >
> > > > >function admin_upload() {
> >
> > > > >if (empty($this->data)) {
> > > > >$this->render();
> > > > >} else {
> > > > >//$this->cleanUpFields();
> >
> > > > >// set the upload destination folder
> > > > >$destination =
> > > > > realpath('../../app/webroot/img/uploads/');
> >
> > > > >// grab the file
> > > > >$file = $this->data['Image']['images'];
> >
> > > > >// upload the image using the upload
> component
> > > > >$result = $this->Upload->upload($file,
> > > $destination,
> > > > > null,
> > > > > array('type' => 'resizecrop', 'size' => array('400', '300'),
> 'output'
> > > > > => 'jpg'));
> >
> > > > >if (!$result){
> > > > >$this->data['Image']['images'] =
> > > > > $this->Upload->result;
> > > > >} else {
> > > > >// display error
> > > > >$errors = $this->Up

Re: image upload issue

2011-01-19 Thread Amit Badkas
Hi,

Why are you using field names in 'Modelname/fieldname' pattern instead of
just 'fieldname'? For example, you need to use 'filedata' instead of
'Image/filedata'
as you have already given 'Image' as first parameter for Form->create();

Also the code in controller's action is

$file = $this->data['Image']['images'];

but it should be

$file = $this->data['Image']['filedata'];

as the file upload field's name is 'filedata', not 'images'.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 20, 2011 at 12:08 PM, andy_the ultimate baker <
anandghaywankar...@gmail.com> wrote:

> Undefined index:  images [APP/controllers/images_controller.php, line
> 19]
>
> and
>
> Cannot modify header information - headers already sent by (output
> started at /home/satish/anand/cakephp/cake/libs/debugger.php:673)
> [CORE/cake/libs/controller/controller.php, line 742]
>
>
> On Jan 20, 11:08 am, Amit Badkas  wrote:
> > Hi,
> >
> > What is the error you are facing?
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Thu, Jan 20, 2011 at 11:17 AM, andy_the ultimate baker <
> >
> > anandghaywankar...@gmail.com> wrote:
> > > hi there,
> > > i working on image uploading, but i m facing an error,
> > > can any one solve the issue,
> >
> > > //this is my controller file image_controller.php
> >
> > >  > > class ImagesController extends AppController {
> >
> > >var $name = 'Images';
> > >var $helpers = array('Html', 'Form');
> > >var $components = array('Upload');
> >
> > >function admin_upload() {
> >
> > >if (empty($this->data)) {
> > >$this->render();
> > >} else {
> > >//$this->cleanUpFields();
> >
> > >// set the upload destination folder
> > >$destination =
> > > realpath('../../app/webroot/img/uploads/');
> >
> > >// grab the file
> > >$file = $this->data['Image']['images'];
> >
> > >// upload the image using the upload component
> > >$result = $this->Upload->upload($file,
> $destination,
> > > null,
> > > array('type' => 'resizecrop', 'size' => array('400', '300'), 'output'
> > > => 'jpg'));
> >
> > >if (!$result){
> > >$this->data['Image']['images'] =
> > > $this->Upload->result;
> > >} else {
> > >// display error
> > >$errors = $this->Upload->errors;
> >
> > >// piece together errors
> > >if(is_array($errors)){ $errors =
> > > implode("",$errors); }
> >
> > >
>  $this->Session->setFlash($errors);
> > >
>  $this->redirect('/images/upload');
> > >exit();
> > >}
> > >if ($this->Image->save($this->data)) {
> > >$this->Session->setFlash('Image has been
> > > added.');
> > >$this->redirect('/images/index');
> > >} else {
> > >$this->Session->setFlash('Please correct
> > > errors below.');
> > >
>  unlink($destination.$this->Upload->result);
> > >}
> > >}
> > >}
> > > }
> > > ?>
> >
> > > //this is my view admin_upload.ctp
> >
> > > Upload An Image
> > > Form->create('Image',
> > > array('action'=>'admin_upload'));?>
> > >
> > >
> > >Images
> > >
> > >
> > >

Re: image upload issue

2011-01-19 Thread Amit Badkas
Hi,

What is the error you are facing?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 20, 2011 at 11:17 AM, andy_the ultimate baker <
anandghaywankar...@gmail.com> wrote:

> hi there,
> i working on image uploading, but i m facing an error,
> can any one solve the issue,
>
> //this is my controller file image_controller.php
>
>  class ImagesController extends AppController {
>
>var $name = 'Images';
>var $helpers = array('Html', 'Form');
>var $components = array('Upload');
>
>function admin_upload() {
>
>if (empty($this->data)) {
>$this->render();
>} else {
>//$this->cleanUpFields();
>
>// set the upload destination folder
>$destination =
> realpath('../../app/webroot/img/uploads/');
>
>// grab the file
>$file = $this->data['Image']['images'];
>
>
>// upload the image using the upload component
>$result = $this->Upload->upload($file, $destination,
> null,
> array('type' => 'resizecrop', 'size' => array('400', '300'), 'output'
> => 'jpg'));
>
>if (!$result){
>$this->data['Image']['images'] =
> $this->Upload->result;
>} else {
>// display error
>$errors = $this->Upload->errors;
>
>// piece together errors
>if(is_array($errors)){ $errors =
> implode("",$errors); }
>
>$this->Session->setFlash($errors);
>$this->redirect('/images/upload');
>exit();
>}
>if ($this->Image->save($this->data)) {
>$this->Session->setFlash('Image has been
> added.');
>$this->redirect('/images/index');
>} else {
>$this->Session->setFlash('Please correct
> errors below.');
>unlink($destination.$this->Upload->result);
>}
>}
>}
> }
> ?>
>
> //this is my view admin_upload.ctp
>
> Upload An Image
> Form->create('Image',
> array('action'=>'admin_upload'));?>
>
>
>Images
>
>
>
>label('Image/images',
> 'Image:' );?>
>file('Image/filedata');?>
>
>
>
>
> 
>
>
> pleaase help me as soon as possible
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Can't get Form->select() with *no* empty value to work in 1.3 --psybear

2011-01-19 Thread Amit Badkas
Hi,

Form helper's select() method needs attributes as 4th argument and not 3rd,
so following should be the correct syntax

Form->select('dienstmodell', $dienstmodelle,
null, array('empty' => false)); ?>

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 19, 2011 at 6:57 PM, psybear83  wrote:

> Hey everybody
>
> This is a very basic one, but I'm just not getting it, and it's
> beginning to drive me nuts.
>
> According to this 1.3 guide (http://book.cakephp.org/view/1566/View-
> and-Helpers), I sohuld use 'empty' in select so my  has no
> empty value.
>
> Form->select('dienstmodell', $dienstmodelle,
> array('empty' => false)); ?>
>
> Sadly this isn't working. And it's surprising that when I set it to
> true, it always selects the last option per default...
>
> Thank you for help :-)
> Josh
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Problem with saveAll() not saving related model

2011-01-19 Thread Amit Badkas
Hi,


On Wed, Jan 19, 2011 at 9:46 PM, kdubya  wrote:

> So, to summarize, I can either use saveAll() to
>
> 1) save a single record of the main model (in this case Item) WITH
> it's related models (see note below)
>
> - OR -
>
> 2) save multiple instances of the main model (Item) WITHOUT it's
> related models (see note below)
>
> - BUT -
>
> Not both. Is this correct?
>

- Yes, you are absolutely right.


>
> Note:
> In the CakePHP book (Cake 1.2 collection) in the section on saving
> data  (http://book.cakephp.org/view/75/Saving-Your-Data) it talks in
> the saveAll() portion about saving hasOne and belongsTo relation and
> shows how to save multiple records. It also show below that saving a
> SINGLE record of a model with hasMany relations where the hasMAny
> model has multiple records.
>
> I guess my mistake was to assume you could extend that to saving
> multiple records of a model with sub-model data as well.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>


Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best way to write into array

2011-01-19 Thread Amit Badkas
Hi,

You need to use saveAll(), have a look at
http://book.cakephp.org/view/1032/Saving-Related-Model-Data-hasOne-hasMany-belongsTo

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 19, 2011 at 5:00 PM, Jens Dittrich  wrote:

> Hello!
>
> I want to manipulate an array that I get from a form. The situation is
> as follows:
> People hasMany MobilePhones
>
> The form is for creating a new Person with some MobilePhone numbers at
> once. So neither Person nor MobilePhone have an ID.
> I want to save the Person and the corresponding MobilePhone numbers in
> a single transaction. But what is the best way to set the person_id in
> each of the MobilePhone's in the array?
> Go with an foreach and to use Set::insert()?
> build and array for it and to use Set::pushDiff()?
>
> Anyone got an Idea?
>
> regards,
> Jens
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Problem with saveAll() not saving related model

2011-01-19 Thread Amit Badkas
Hi,

The saveAll() doesn't save all records recursively. You need to loop through
$items and do saveAll() on each one.

In details,

$item = Array
   (
   [Item] = Array
   (
   [id] => 1250
   [price] => 14.29
   [quantity] => 9
   )
   [Vendor] => Array
   (
   )

   [SalesTransaction] => Array
   (
   [0] => Array
   (
   [sale_id] => 1404
   [type_id] => 1
   [item_id] => 1250
   [old_qty] => 10
   [new_qty] => 9
   )

   )

   )

$this->Item->saveAll($item);

Above will work fine.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Jan 18, 2011 at 2:04 AM, kdubya  wrote:

> I realize I'm not the first person to have a problem with saveAll(). I
> have searched this group for a solution to my problem, which is - I
> can't get saveAll() to save related model data. I must be doing
> something wrong but I cannot spot it.
>
> My app is a sales/inventory system. Here are the pertinent relations:
>
> Vendor hasMany Item
> Item hasMany SalesTransaction
>
> I am trying to, in one call to saveAll(), save both an updated
> Item.quantity and insert a new SalesTransaction record
>
> My Item model code for the relations is this:
>
>  var $belongsTo = array(
>  'Vendor' => array('counterCache' => true)
>  );
>
>  var $hasMany = array(
>'SalesTransaction' => array(
>  'className' => 'SalesTransaction',
>  'foreignKey' => 'item_id'
>)
>  );
>
> My SalesTransaction model code for the relation is this:
>
>  var $belongsTo = array(
>  'Item' => array('className' => 'Item',
>'foreignKey' => 'item_id',
>'fields' => array('id', 'quantity')
>  )
>);
>
> For brevity, I am leaving out some other models that don't pertain to
> this particular problem.
>
> In my controller code, I construct the array ($items) to pass to
> saveAll().
>
> debug($items); output looks like this:
>
> Array
> (
>[0] => Array
>(
>[id] => 1250
>[price] => 14.29
>[quantity] => 9
>[Vendor] => Array
>(
>)
>
>[SalesTransaction] => Array
>(
>[0] => Array
>(
>[sale_id] => 1404
>[type_id] => 1
>[item_id] => 1250
>[old_qty] => 10
>[new_qty] => 9
>)
>
>)
>
>)
>
>[1] => Array
>(
>[id] => 1251
>[price] => 28.57
>[quantity] => 9
>[Vendor] => Array
>(
>)
>
>[SalesTransaction] => Array
>(
>[0] => Array
>(
>[sale_id] => 1404
>[type_id] => 1
>[item_id] => 1251
>[old_qty] => 10
>[new_qty] => 9
>)
>
>)
>
>)
>
>[2] => Array
>(
>[id] => 1252
>[price] => 42.86
>[quantity] => 9
>[Vendor] => Array
>(
>)
>
>[SalesTransaction] => Array
>(
>[0] => Array
>(
>[sale_id] => 1404
>[type_id] => 1
>[item_id] => 1252
>[old_qty] => 10
>[new_qty] => 9
>)
>
>)
>
>)
>
> )
>
> The code that does the saveAll() is:
> $this->Item->saveAll($items, array('fieldList'=>array('quantity')))
>
> The debug output looks like this:
>
> START TRANSACTION   0   0
> 19  SELECT COUNT(*) AS `count` FRO

Re: Form Validation does not work on Cake 1.3.6

2011-01-19 Thread Amit Badkas
Hi,

If you are having 'call to a member of a non-object' error for $this->Form
then I doubt you are using CakePHP 1.2.x and not 1.3.x

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 19, 2011 at 5:38 AM, Kh3ops  wrote:

> Actually, I baked my application and form validation is working fine
> now.
>
> As far as $this is concerned. I would love to use it but it doesn't
> work : "call to a member of a non-object"...
>
> Gaëtan
>
> On 11 jan, 05:03, Amit Badkas  wrote:
> > Hi,
> >
> > Your description of the validation problem is too less to give any
> > suggestion. Also about the usage of $form instead of $this->Form, you can
> > use $form in CakePHP-1.3.x but it will be removed in future versions and
> > that's why you have to use $this->Form.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Mon, Jan 10, 2011 at 6:38 AM, Kh3ops  wrote:
> > > Hi,
> >
> > > I installed cake 1.3.6 on PHP 5.3.3.
> >
> > > I've just run through the "blog tutorial" and everything's working
> > > fine except "form validation".
> > > For an unknown reason, validating an empty form works and databases is
> > > filled with empty records.
> >
> > > Here is what I used in my model code :
> >
> > >  var $validate = array(
> > >'title' => 'notEmpty'
> > >);
> >
> > > Any idea?
> >
> > > Compared to the tutorial, I also had to use $form() instead of $this-
> > > >Form() functions in templates files. Do you know why?
> >
> > > Thanks for your help,
> >
> > > Gaëtan
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: auth component issue

2011-01-18 Thread Amit Badkas
Hi,

You need to use

$this->redirect($this->Auth->logout());

instead of

$this->redirect(array('action'=>'login'));

in users controller's logout action.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 19, 2011 at 11:57 AM, andy_the ultimate baker <
anandghaywankar...@gmail.com> wrote:

> $this->redirect(array('action'=>'login'));
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: retrieve data from find result array

2011-01-18 Thread Amit Badkas
Hi,

As per the $status array structure, you should use $status[0][0]['time']

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 19, 2011 at 12:24 PM, ojonam  wrote:

> Hi,
>
> I have a model Status with fields 'name', 'time', of which 'time' is a
> timestamp. I perform a find query and try to cast timestamp as date:
>
> $status = $this->Status->find('all', array('fields' => array('CAST
> (Status.time AS DATE) time')));
>
> debug($status) gives me :
>
> Array
> (
>[0] => Array
>(
>[Status] => Array
>(
>[name] => AF1234
>)
>
>[0] => Array
>(
>[time] => 2010-12-02 15:05:11
>)
>
>)
>
> )
>
> How do I retrieve the time data from the array? $status[0]['time']
> does not work.
>
> Thanks,
> ojonam
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: About using saveField in a custom model save function

2011-01-13 Thread Amit Badkas
Hi,

I think you want to do something like following, right?

function save($data = null)
{
$data[$this->alias]['some_field_name'] = 'some_value'; //
or $data[$this->alias]['some_field_name'] = 'some_value';

return parent::save($data);
}

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 13, 2011 at 2:51 PM, makville  wrote:

> Hi,
> I have a requirement in one of my models. One of the fields is
> dependent on the autoincrement id so it has to be updated after the
> row has been saved in the database. Something like this
>
>  class SomeModel extends AppModel
> {
>   
>   //override the default save function
>   function save ( $data = null )
>   {
>  $r = parent::save($data);
>  if ( $r ) {
>$this->saveField('some_field_name', 'some_value');
>   }
>   return $r;
>}
> }
> ?>
> This saves the data correctly but crashes my apache server as an added
> bonus.
>
> If i however remove the saveField line. It saves but does not update
> the field i want updated (obviously!). And the server does not crash.
>
> Now if id did this instead,
>  class SomeModel extends AppModel
> {
>   
>   //override the default save function
>   function save ( $data = null )
>   {
>  $r = parent::save($data);
>  if ( $r ) {
>$data['some_field_name'] = 'some_value';
>return parent->save($data);
>   }
>}
> }
> ?>
> It works without issues. I just have a feeling it might be more
> demanding on the server.
> So Community, any thoughts?...
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: date

2011-01-13 Thread Amit Badkas
Hi,

There are 3 methods for this

First is to pass selected value as an array like this

array(
 'day' => 13,
 'month' => 1,
 'year' => 2011,
);

Second one is to use string like 2011-01-13.

And third one is use timestamp generated by mktime() or time() etc.
functions.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 13, 2011 at 11:31 AM, Miqdad Ali wrote:

> how to use selected date in
>
>  $form->input('dt',array('type'=>'date'));
> 
> Miqdad Ali
> http://www.miqdadali.co.cc
>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Not finding Cake folder

2011-01-12 Thread Amit Badkas
Hi,

The error is 'Fatal error: Call to a member function html() on a non-object
in /var/www/site/app/views/layouts/default.ctp on line 2', so I want to see
what have you written on 2nd line of default.ctp layout because I don't
think there is any helper method like html().

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 13, 2011 at 9:00 AM, Dave Maharaj  wrote:

>  I am setting up a site with this folder structure:
>
>
>
> -var
>
> -- libs
>
> ---cake
>
> 1.2
>
> 1.3
>
>
>
> -www
>
> --site
>
> ---app
>
>
>
> But now im getting Fatal error: Call to a member function html() on a
> non-object in /var/www/site/app/views/layouts/default.ctp on line 2
>
> Which is an html() view helper function so its not finding the cake folder
> helper yet its finding the database / everything else. If I change the
> define('CAKE_CORE_INCLUDE_PATH', ROOT); in index.php and make it wrong I get
> the errors cant find cake so I change it back to the right path just to
> check and the errors go away. Change the database password to something
> wrong and I get the sql cound not connect error so it does infact get to the
> Cake folder.
>
>
>
> Any ideas?
>
>
>
> Thanks,
>
>
>
> Dave
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: tmp Folder permissions

2011-01-12 Thread Amit Badkas
Hi,

The app/tmp directory should be recursively writable by the web server if
PHP is installed as a module (for example, with Apache) otherwise (for
example, with IIS) should be recursively writable by the user which runs
PHP.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 13, 2011 at 8:14 AM, Dave Maharaj  wrote:

> What is the correct CHMOD permission settings for tmp/cache directory.
>
> Unless I set it at 777 I get is not writable
> [CORE/cake/libs/cache/file.php,
> line 267]
>
> Im working on a new server and before I had it set to 755 but now unless
> its
> set to 777 I get the error.
>
> Thanks,
>
> Dave
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Display custom View based on 3 schema's - Recommendation please

2011-01-12 Thread Amit Badkas
Hi,

If you need this for only a single page then it would be fine to write the
'if' conditions to that action otherwise you can use beforeRender() callback
to change view file's name to render.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 13, 2011 at 2:47 AM, OldWest  wrote:

> Hello,
>
> I have a table that has 5 fields of data.
>
> In many cases, not all of the fields have data in them.
>
> Each time the View action of the Controller is requested, I would like
> to only display the fields that have content in them AND the tabular
> structure of the data will change based on the content as well.
>
> So basically, I think I will need a unique View file for each type of
> data schema. And there are 3 schemes. For example,
>
> Schema   |   1   |   2   |   3   |   4   |   5   |
>
> AX   X   X  X   X
> BXX   X
> C X   X  X
>
> As you can see, each schema has different data populated.
>
> This tells me I will need 3 View structures to accommodate these
> schema's.
>
> Can anyone make a recommendation on the best way to handle this in the
> CakePHP framework. I am thinking an if condition in the Controller,
> and then render() based on that, but its seems there would be a more
> conventional method.
>
> Thanks for any thoughts on this.
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: District and city select with Ajax in cakephp 1.2

2011-01-12 Thread Amit Badkas
Hi,

Have you tested in Firefox with Firebug if the AJAX request goes or not?
Also try to access the AJAX page (something like
http://your-domain/your-directory/cities/getcities) directly in the browser
to check if it outputs what you need.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 12, 2011 at 11:37 PM, n4thancake  wrote:

> Hello to all, I have been trying to write a dynamic district and city
> select in cakephp 1.2 using Ajax Helper.
> These are the code  I wrote, but it isn't work.
> I have two db tables, cities and districts in which I have insert all
> the Italian district and cities.
>
> Then I have a controller, course_controller.php in which I have
>
>function add() {
>  if(!empty($this->data)) {
>
>if($this->Course->save($this->data))
>   {
>$this->Session->setFlash(__('Course saved',true));
>$this->redirect(array('action' => 'index'));
>
>   }
>  else
>   {
>$this->Session->setFlash('Error');
>   }
>
>
>  }
>
>
>  $this->set('districts',$this->Course->City->District->find('list'));
>
> in order to save the Data Form.
>
> In cities_controller.php I put
>
>function getCities() {
>
>  $district_id = $this->data['City']['district_id'];
>  debug($district_id);
>  $cities = $this->City->find('list',array
>   ('conditions' => array('City.district_id'=>$district_id)));
>  $this->set('cities',$cities);
>
>
>  }
>
> And in views/cities/getCities.ctp I have
>
> echo "";
> foreach($cities as $k=>$v) : ?>{
> 
> 
>
> After all in views/courses/add.ctp I have
>
>
>   echo $form->create('Course');
>   echo $form->input('district_id',array('empty'=>true));
>   echo $form->input('city_id',array('type'=>'select'));
>   echo $form->end('Crea Corso');
>   echo $ajax->observeField('CourseDistrictId',
>  array(
>   'url' => array('controller'=>'cities','action'=> 'getcities'),
>   'update' => 'CourseCityId',
>   'frequency' => 0.2,
>
>   )
>  );
>  $this->render('/cities/getCities');
> ?>
>
> Ofcourse in my app_controller I have
>
>var $helpers = array('Html', 'Form', 'Ajax', 'Javascript',
> 'Session', 'Number');
> and in my default.ctp I have
>
>echo $javascript->link('prototype',false);
>echo $javascript->link('scriptaculous',false);
>
>
>
> After all, this isn't work at all, and when I select a district the
> city select will not update at all.
> Can somebody help me ?
> thank you for all.
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Cakephp MVC Pattern

2011-01-12 Thread Amit Badkas
Hi,

Sure, you can do that by using $this->query() in the model.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 12, 2011 at 6:49 PM, Gopinath T.M  wrote:

> Shall we use model without association...instead of association shall
> we use direct query in model
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Getting error : 500 Internal Server Error to create a subdomain with cakephp

2011-01-12 Thread Amit Badkas
Hi,

Most of the time, this error is due to HTTP server mis-configuration and you
need to look at the access and error logs. Most probably this error occurred
for you due to use of .htaccess in CakePHP. Have you allowed configuration
management using .htaccess for your sub-domain (please check for
AllowOverride directive)?

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 12, 2011 at 5:58 PM, masud  wrote:

> Hello there.
> I have create a subdomain on my godaddy hosting. my previeous site was
> made by CakePHP now i want to make a subdomain. but getting error :
> 500 Internal Server Error.
>
> Have you any solution. guys.
>
> thanks.
> Masud
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: setflash edit

2011-01-11 Thread Amit Badkas
Hi,

As I already mentioned "You don't need to delete flash message in session
explicitly, $this->Session->flash() does it automagically.", the message
doesn't appear after page refresh.

In the first message you mentioned "But when I go after the edit to the
details view and back to the index view it gives me the message 'your job
has been updated'." and now you are asking "How can I refresh the page to
remove the flash message from the page?". So, I am confused about what
exactly you need. Please be specific about your problem.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Jan 11, 2011 at 11:42 PM, lvdb  wrote:

> Hello Amit,
>
> Thank you for your answer. When I refresh the view page the message is
> gone.
> It is not done automatically. How can I refresh the page?
>
> Leo
>
> On 10 jan, 07:31, Amit Badkas  wrote:
> > Hi,
> >
> > Does the details page output flash message? You don't need to delete
> flash
> > message in session explicitly, $this->Session->flash() does it
> > automagically.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> >
> >
> > On Sat, Jan 8, 2011 at 1:13 AM, lvdb  wrote:
> > > Hello,
> >
> > > I have made a flash message "your job has been updated". When I edit a
> > > job and have been redirected to the index view the message appears
> > > (and after 3 seconds it hides). This is working fine. But when I go
> > > after the
> > > edit to the details view and back to the index view it gives me the
> > > message "your job has been updated".
> > > Must I delete the session and how do I do that?
> >
> > > Thank you in advance for your answer.
> >
> > > Leo van den Berg
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> For more options, visit this
> group at
> > >http://groups.google.com/group/cake-php?hl=en- Tekst uit oorspronkelijk
> bericht niet weergeven -
> >
> > - Tekst uit oorspronkelijk bericht weergeven -
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: manipulation of fields before saving - how to get it to work for saveAll?

2011-01-11 Thread Amit Badkas
Hi,

The saveAll() internally calls save(), that's why I suggested to use
beforeSave(). Are you passing any option to saveAll() other than data?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Jan 11, 2011 at 5:11 PM, Zeu5  wrote:

> Thank you Amit, but the same issue arises.
>
> in a saveAll, the fields are not directly at ['model_alias']
> ['field_name']
>
> so changing it to beforeSave would not help.
>
> I am not sure if i have made myself clear enough.
>
> On Jan 11, 7:36 pm, Amit Badkas  wrote:
> > Hi,
> >
> > I think you need to try beforeSave() instead of beforeValidate(), hope it
> > may work.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Jan 11, 2011 at 5:02 PM, Zeu5  wrote:
> > > let say my model Link has 3 fields
> > > route, model, action,
> >
> > > what I want is that route is the combination of model and action.
> >
> > > eg
> > > model = '/orders/view/';
> > > action = '3';
> >
> > > so route is '/orders/view/3';
> >
> > > i did this in my beforeValidate
> >
> > > if (isset($this->data['Link']['model']) && isset($this->data['Link']
> > > ['action'])) {
> > >$this->data['Link']['route'] =
> > > $this->data['Link']['model'] . $this-
> > > >data['Link']['action'];
> > > }
> >
> > > now the problem is when i do a saveAll, this will not work.
> >
> > > because the data will be
> >
> > > Array(
> > >[Link] => Array(
> > >   [0] => Array(
> > > [id] => 3,
> > > [model]=>'/orders/view/',
> > > [action]=>'3'
> > >   )
> > >)
> > > )
> >
> > > Please advise.
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> For more options, visit this
> group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: manipulation of fields before saving - how to get it to work for saveAll?

2011-01-11 Thread Amit Badkas
Hi,

I think you need to try beforeSave() instead of beforeValidate(), hope it
may work.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Jan 11, 2011 at 5:02 PM, Zeu5  wrote:

> let say my model Link has 3 fields
> route, model, action,
>
> what I want is that route is the combination of model and action.
>
> eg
> model = '/orders/view/';
> action = '3';
>
> so route is '/orders/view/3';
>
> i did this in my beforeValidate
>
> if (isset($this->data['Link']['model']) && isset($this->data['Link']
> ['action'])) {
>$this->data['Link']['route'] =
> $this->data['Link']['model'] . $this-
> >data['Link']['action'];
> }
>
> now the problem is when i do a saveAll, this will not work.
>
> because the data will be
>
> Array(
>[Link] => Array(
>   [0] => Array(
> [id] => 3,
> [model]=>'/orders/view/',
> [action]=>'3'
>   )
>)
> )
>
> Please advise.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Fatal error: Call to undefined function __l()

2011-01-11 Thread Amit Badkas
Hi,

You can check in the old code, in which file does the 'function __l' string
contain.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Jan 11, 2011 at 2:39 PM, osamo101  wrote:

> Hi Amit,
>
> This is very strange, the __l() is repeated in the code over 8000
> times with strings i.e. __l('Delete'), do you have any idea about how
> this can happen?
>
> On Jan 11, 8:46 am, Amit Badkas  wrote:
> > Hi,
> >
> > I don't think there is/was any __l() function in CakePHP-1.2.x, it may be
> > written in any file which got overwritten.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Tue, Jan 11, 2011 at 12:09 PM, osamo101  wrote:
> > > Hello,
> >
> > > I have a website written in CakePHP 1.2 and I am upgrading it to 1.3,
> > > when I try to run it, it displays the error "Fatal error: Call to
> > > undefined function __l() ", could you please tell me what is that
> > > function? and what function should I use instead of it if it is
> > > deprecated.
> >
> > > thanks in advance.
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
> >
> >
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Fatal error: Call to undefined function __l()

2011-01-10 Thread Amit Badkas
Hi,

I don't think there is/was any __l() function in CakePHP-1.2.x, it may be
written in any file which got overwritten.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Jan 11, 2011 at 12:09 PM, osamo101  wrote:

> Hello,
>
> I have a website written in CakePHP 1.2 and I am upgrading it to 1.3,
> when I try to run it, it displays the error "Fatal error: Call to
> undefined function __l() ", could you please tell me what is that
> function? and what function should I use instead of it if it is
> deprecated.
>
> thanks in advance.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Form Validation does not work on Cake 1.3.6

2011-01-10 Thread Amit Badkas
Hi,

Your description of the validation problem is too less to give any
suggestion. Also about the usage of $form instead of $this->Form, you can
use $form in CakePHP-1.3.x but it will be removed in future versions and
that's why you have to use $this->Form.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Jan 10, 2011 at 6:38 AM, Kh3ops  wrote:

> Hi,
>
> I installed cake 1.3.6 on PHP 5.3.3.
>
> I've just run through the "blog tutorial" and everything's working
> fine except "form validation".
> For an unknown reason, validating an empty form works and databases is
> filled with empty records.
>
> Here is what I used in my model code :
>
>  var $validate = array(
>'title' => 'notEmpty'
>);
>
> Any idea?
>
> Compared to the tutorial, I also had to use $form() instead of $this-
> >Form() functions in templates files. Do you know why?
>
> Thanks for your help,
>
> Gaëtan
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Plugin tutorial in the book

2011-01-10 Thread Amit Badkas
Hi,

http://book.cakephp.org/view/1114/Plugin-Models doesn't have what you
mentioned. It uses model name as 'PizzaOrder' and not 'PizzaOrderModel'.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Jan 11, 2011 at 5:42 AM, Parris  wrote:

> Hi All,
> I was wondering why the plugin tutorial names models like:
> "PizzaOrderModel." I understand Pizza is the name of the plugin, and
> am fine with that, but the word model throws off the convention. Plus
> it breaks a few other things like validation. It also forces you to
> use: var $uses in your controllers. When I take the word model out of
> the name everything works as expected and should.
>
> Thanks,
> Parris
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: I am getting an error like this after i submit an action.

2011-01-10 Thread Amit Badkas
Hi,

The error message itself has information for file and line number
('C:\xampp\htdocs\todo\app\models\post.php:9')
you need to look at.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Jan 10, 2011 at 5:09 PM, Deepak  wrote:

> Warning (2): Cannot modify header information - headers already sent
> by (output started at C:\xampp\htdocs\todo\app\models\post.php:9) [CORE
> \cake\libs\controller\controller.php, line 742]
> Code | Context
>
> $status =   "Location: http://localhost/todo/posts";
>
> header - [internal], line ??
> Controller::header() - CORE\cake\libs\controller\controller.php, line
> 742
> Controller::redirect() - CORE\cake\libs\controller\controller.php,
> line 721
> PostsController::delete() - APP\controllers\posts_controller.php, line
> 64
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> [main] - APP\webroot\index.php, line 85
>
>
>
> please help me as i want to finish it of as early as possible.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Filtering by related model...

2011-01-09 Thread Amit Badkas
Hi,

Could you please show me the structure of categories table. I need to know
surely if Product belongs to Category or Product has many Category or
Product has and belongs to many Category.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Sat, Jan 8, 2011 at 1:25 AM, TSG  wrote:

> I know I've read this somewhere, but I've been searching for an hour
> now and cannot find it.
>
> I have a Product model
> I have a Category model
>
> A product can have many categories
>
> The categories table has a field, slug, that is used for SEO purposes.
>
> I currently have a beautifully formatted, paginated list of my
> products at /products and that works just great.  But I need to be
> able to filter by the category slug (I'm thinking /products/category/
> my-slug-goes-here) and have it use my same view, just with the
> filtered data.
>
> How do I do this?  It is driving me absolutely nuts.  I know it's a
> simple thing, as the relationships are all set up in the models
> perfectly fine.  But for the life of me, I just can't get it to work.
>
> My index method:
>
> function index() {
>$this->Product->recursive = 1;
>$this->Product->contain('WordAd');
>$this->set('products', $this->paginate());
>}
>
> Can someone please help me with this?  I'm loving Cake so far.  It has
> greatly sped up my development.  I've just hit a snag.
>
> Thanks
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: setflash edit

2011-01-09 Thread Amit Badkas
Hi,

Does the details page output flash message? You don't need to delete flash
message in session explicitly, $this->Session->flash() does it
automagically.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Sat, Jan 8, 2011 at 1:13 AM, lvdb  wrote:

> Hello,
>
> I have made a flash message "your job has been updated". When I edit a
> job and have been redirected to the index view the message appears
> (and after 3 seconds it hides). This is working fine. But when I go
> after the
> edit to the details view and back to the index view it gives me the
> message "your job has been updated".
> Must I delete the session and how do I do that?
>
> Thank you in advance for your answer.
>
> Leo van den Berg
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Validation messages not showing up on Change Password page

2011-01-09 Thread Amit Badkas
Hi,

Check if the validation errors has any data or not. The code for this will
be something like

if ($this->User->save($this->data)) {
$this->Session->setFlash(__('Your account information has been saved',
true));
$this->redirect(array('controller' => 'users', 'action' => 'view'));
} else {
debug($this->User->validationErrors);
$this->Session->setFlash(__('Sorry, a problem occurred trying to save
your account information. Please, try again.', true));
}

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Jan 7, 2011 at 10:55 AM, alvinj  wrote:

> if ($this->User->save($this->data)) {
>  $this->Session->setFlash(__('Your account information has
> been saved', true));
>  $this->redirect(array('controller' => 'users', 'action' =>
> 'view'));
>} else {
>  $this->Session->setFlash(__('Sorry, a problem occurred
> trying to save your account information. Please, try again.', true));
>}
>

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

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


Re: Save and Update 2 or more Tables

2011-01-06 Thread Amit Badkas
Hi.

I think the line

if(!$this->GroupMember->save($this->$member))

should be

if($this->GroupMember->save($member))

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Jan 7, 2011 at 10:22 AM, chris...@yahoo.com wrote:

> if(!$this->GroupMember->save($this->$member))
>

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

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


Re: Logging out from Admin/ that should point to App/Users Controller

2011-01-05 Thread Amit Badkas
Hi,

Your explanation is somewhat confusing for me. But following is my attempt
to explain you about the solution you need.

First of all, if you looked at the description of 'logoutRedirect'
parameter, it says 'specify where you want the user to go after they are
logged out, with the default being the login action'. So, IMO, this value
shouldn't go to the logout page.

If you have only one routing prefix, for example, 'admin', then you can use
something like

$this->Auth->logoutRedirect = array('admin' => false, 'controller' =>
'', 'action' => '');

or if you have more than one or want a generic solution then try

$this->Auth->logoutRedirect = '//';

You can use above in the views too to build URLs for the links.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 6, 2011 at 11:48 AM, John Maxim  wrote:

> and of course I meant this, typo:
>
> > $this->Auth->logoutRedirect = array(Configure::read('Routing.admin')
> > => false, 'controller' => 'users', 'action' => 'logout');
>
>
> On Jan 6, 2:11 pm, John Maxim  wrote:
> > It's here:http://book.cakephp.org/view/1271/logoutRedirect
> >
> > $this->Auth->logoutRedirect = array(Configure::read('Routing.admin')
> > => false, 'controller' => 'members', 'action' => 'logout');
> >
> > It can't find the users controller from App/  .. since I enabled Admin
> > routing I guess. Whenever I go to website.com/admin/acl   .. as I
> > click my logout link which works when I'm in website.com/(models)
> >
> > --does not work when I'm in website.com/admin/acl
> >
> > That's why I ask whether to redirect from:
> >
> > 1. App controller
> > 2. Function logout
> > 3. My layout logout link
> >
> > ?
> >
> > It seems most likely to be in App controller, but it currently has:
> >
> > $this->Auth->logoutRedirect = array('controller' => 'users', 'action'
> > => 'login');
> >
> > I tried replacing it with the first one:
> >
> > $this->Auth->logoutRedirect = array(Configure::read('Routing.admin')
> > => false, 'controller' => 'members', 'action' => 'logout');
> >
> > I changed both action to logout and login to no avail. (for the above)
> >
> > So my question now reverted back to:
> >
> > Redirecting from :
> >
> > 1. App controller
> > 2. Function logout
> > 3. My layout logout link
> >
> > ?
> >
> > On Jan 6, 12:29 pm, Amit Badkas  wrote:
> >
> > > Hi,
> >
> > > What do you mean by "It can't find the users controller"? Isn't the
> logout
> > > link outputting the URL correctly and/or isn't the redirection in
> logout()
> > > action working correctly?
> >
> > > Also you have used "Configure::read('Routing.admin')" to set the
> > > 'logoutRedirect' URL but as per thehttp://
> book.cakephp.org/view/950/Prefix-Routing, there is nothing
> > > like 'Routing.admin' configuration option.
> >
> > > Amit Badkas
> >
> > > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > > On Wed, Jan 5, 2011 at 10:52 PM, John Maxim  wrote:
> >
> > > >http://book.cakephp.org/view/950/Prefix-Routing
> >
> > > > Hi I have enabled admin/
> >
> > > > When I'm herehttp://example.com/admin/acl
> >
> > > > I find that as I click on my logout link which is currently;
> > > > controller=>users, action=>logout
> >
> > > > It can't find the users controller, how should I change it?;
> >
> > > > In my app controller I have this:
> >
> > > > $this->Auth->logoutRedirect = array(Configure::read('Routing.admin')
> > > > => false, 'controller' => 'users', 'action' => 'login')
> >
> > > > But it still doesn't work, my logout function:
> > > > this->redirect($this->Auth->logout());
> >
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> others
> > > > with their CakePHP related questions.
> >
> > > > You received this message because you are subscribed to the Google
> Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Video Points, Cost

2011-01-05 Thread Amit Badkas
Hi,

The code in action uses $id but from where does it come/initialize?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Jan 6, 2011 at 1:55 AM, chris...@yahoo.com wrote:

> Hi guys,
> I need help with video points,... I'm creating feature that users can
> promote their videos, groups,... etc... in my social network site. In
> order to do that we need video promotion cost, which is in this case
> is points. And ADMIN can update points any time from control panel.
> Say default is 300 points, and in one month I can increase to 350 or
> make at less to 250.
>
> And I can't make it work, Its kind of adding points to and
> auto_increment id, and I want it to update ONLY the cost, and NOT TO
> auto_increment id.
>
> Here is what I have
>
> In my video_controller.php
>
>
>  function admin_points()
>  {
>
>  //print_r($_SESSION);
>
>  $this->VideoPoint->cost = $id;
>
> if(!($points = $this->VideoPoint->findById($id)))
>
>  $this->set('points', $points);
>  $this->set_title(ucfirst(i18n::translate('edit Video Cost')));
>
>  if(empty($this->data))
>  {
>$this->data['VideoPoint']['cost'] = $points;
>// $this->data = $points;
>  }
>  else
>  {
>
>if($this->VideoPoint->save($this->data))
>{
>
>$this->flash('valid', ucfirst(i18n::translate('Video Costs
> Updated Succesfully')));
>$this->redirect('/admin/videos/points/');
>}
>  }
>
>  }
>
> In models: video_point.php
>
>  class VideoPoint extends AppModel {
>  var $name = 'VideoPoint';
>
>  var $validate = array(
>'cost' => VALID_NOT_EMPTY
>  );
>
>var $belongsTo = array( );
>
>  function afterDelete()
>  {
>  }
> }
> ?>
>
> And in View ../views/videos/admin_points.ctp
>
>
> 
>
>  
>
>  
> Cost', true)) ?>
>text('VideoPoint/cost', array('value' =>
> $points ,'style' => 'width: 200px')) ?>
>
>  
>
>
>
>  
>
>  
>
>
>image('tick.png') ?>
>
>
>
>  
>  
> 
>
>
> Thank You for your help in advance !!
> Chris
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Logging out from Admin/ that should point to App/Users Controller

2011-01-05 Thread Amit Badkas
Hi,

What do you mean by "It can't find the users controller"? Isn't the logout
link outputting the URL correctly and/or isn't the redirection in logout()
action working correctly?

Also you have used "Configure::read('Routing.admin')" to set the
'logoutRedirect' URL but as per the
http://book.cakephp.org/view/950/Prefix-Routing, there is nothing
like 'Routing.admin' configuration option.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 5, 2011 at 10:52 PM, John Maxim  wrote:

>
> http://book.cakephp.org/view/950/Prefix-Routing
>
> Hi I have enabled admin/
>
> When I'm here http://example.com/admin/acl
>
> I find that as I click on my logout link which is currently;
> controller=>users, action=>logout
>
> It can't find the users controller, how should I change it?;
>
> In my app controller I have this:
>
> $this->Auth->logoutRedirect = array(Configure::read('Routing.admin')
> => false, 'controller' => 'users', 'action' => 'login')
>
> But it still doesn't work, my logout function:
> this->redirect($this->Auth->logout());
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: select box with fullName

2011-01-04 Thread Amit Badkas
Hi,

Please have a look at http://book.cakephp.org/view/1608/Virtual-fields

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Jan 4, 2011 at 2:41 PM, Gazmend Nrecaj  wrote:

> Hi,
>
> I have a users table with columns firstName and lastName, and want in a
> SelectBox Options to have a value of firstName and lastName as fullName, its
> normall.
>
> How can I put in select box options 2 values together with Cake ?
>
> Sorry for my English
>
>
> Thanks
>
> Gazmend
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: find() conditions using hasMany relationship

2011-01-02 Thread Amit Badkas
Hi,

Please have a look at 'Sub-queries' section of
http://book.cakephp.org/view/1030/Complex-Find-Conditions (at the end of the
page), hope it helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Dec 31, 2010 at 8:15 PM, aughrt  wrote:

> Hello!
>
> I would like to know the best way to accomplish this task in this
> framework.
>
> CakePHP 1.3, MySQL
>
> Company(id, name)
> FormerExecutive(id, name, company_id)
>
> Company hasMany FormerExecutive
> FormerExecutive belongsTo Company
>
> Now I am building a search action in CompanyController:
>
>
> function search() {
>
>   // check if submitted search params
>   if ($this->data['Company']) {
>
>  // parse keywords param
>  if ($keywords = $this->data['Company']['keywords']) {
>
>  $conditions['OR'] = array(
> 'Company.name LIKE'=>
> "%$keywords%",
> // this line is errorneous:
> 'FormerExecutive.name LIKE'  =>
> "%$keywords%",
>  );
>
>   }
>
>
>  // other params
>  // ...
>
>  // query & send to view
>  $this->set('companies', $this->Company->find('list',
> compact('conditions')));
>
>}
>
> }
>
>
> How to make hasMany find() conditions properly?
> Should I force join or use bindModel or a better way?
>
> Side question 1: why Google indexes Cookbook 1.2 Collection, but not
> 1.3?
> Side question 2: why CakePHP use '' for empty VARCHAR instead of NULL
> and then NULL for empty INT?
> Side question 3: is it planned to support MySQL YEAR?
> Side question 4: is it better to use $order in Model or find()
> $params['order']?
>
> Ok, I have more questions, but that's for now.
>
> Thank you for the answers. I really appreciate your time.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: a small issue

2010-12-31 Thread Amit Badkas
Hi,

You need to tell link() method to NOT escape the title, please have a look
at http://book.cakephp.org/view/1442/link for more help, though you can use
the following code as it is.

echo
$this->Html->link($this->Html->image('logout.png',array('alt'=>'logout')),array('controller'=>'users','action'=>'logout'),
*array('escape' => false)*);

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Dec 31, 2010 at 3:05 PM, poor-grammar  wrote:

>  echo $this->Html->link($this->Html-
> >image('logout.png',array('alt'=>'logout'))
>
> ,array('controller'=>'users','action'=>'logout'));
>
> $this->Html->image('logout.png',array('alt'=>'logout')--> this line is
> giving me html source
>  ..
>  and i think it sould give me this html ..
>
> am i missing any thing?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: How to use Grant in Shell ?

2010-12-31 Thread Amit Badkas
Hi,

Try the command by replacing $aroAlias (this should be any record's value in
aros table for alias field) and $acoAlias (this should be any record's value
in acos table for alias field) with their proper values.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Dec 31, 2010 at 12:42 PM, John Maxim  wrote:

> I don't know. Do you mean the table's data ?
>
> I'm following the tutorial here
>
> http://book.cakephp.org/view/1550/Setting-up-permissions
>
> it says to allow permission for aro and aco tables..
>
> how to enable the permission ?
>
> rgrds,
> maxim
> On Dec 31, 2:32 pm, Amit Badkas  wrote:
> > Hi,
> >
> > What are the actual values of $aroAlias and $acoAlias variables?
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Fri, Dec 31, 2010 at 11:47 AM, John Maxim  wrote:
> > > I have tried:
> >
> > > >cake acl grant $aroAlias $acoAlias
> > > ---
> > > Error: Wrong number of parameters
> > > Got: 2
> > > Expected: 3
> > > Please type `cake acl help` for help
> > > on usage of the AclShell grant.
> >
> > > ---
> >
> > > >cake acl grant $aroAlias $acoAlias all
> > > --
> > > PHP Warning:  DbAcl::allow() - Invalid node in C:\wamp\www\cakephp\cake
> > > \libs\controller\components\acl.php on line 361
> >
> > > Warning: DbAcl::allow() - Invalid node in C:\wamp\www\cakephp\cake\libs
> > > \controller\components\acl.php on line 361
> > > Permission was not granted.
> >
> > > --
> >
> > > I think the problem is I just saw it. My cake console core path is at:
> >
> > > www/cakephp
> >
> > > How can I change to /www
> >
> > > ?
> >
> > > My work and app path is both at /www
> >
> > > Or is there something wrong with my grant command line ?
> >
> > > Regards,
> > > Maxim
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: (Acl) Error: aro not found No tree returned.

2010-12-30 Thread Amit Badkas
Hi,

Add following code at the end of myAction() method, so that it won't try to
render the view

$this->render(false);

Also look at the SQL queries if 'aros' table is populating correctly or not
by setting debug level to 2.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Dec 31, 2010 at 11:52 AM, John Maxim  wrote:

> I tried executing by going to url: localhost/my_app_name/users/
> anyAction
>
> can't load it asks me to check and make sure my file anyaction.ctp is
> created in views/users
>
> regards,
> maxim
>
> On Dec 31, 12:42 pm, Amit Badkas  wrote:
> > Hi,
> >
> > I meant that you need to access the method myAction() from URL so that
> the
> > code in that method will get executed and according to that code, the
> dummy
> > records will get populated to 'aros' table.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Fri, Dec 31, 2010 at 9:40 AM, John Maxim  wrote:
> > > Hi Amit...thanks for the reply but.. I don't understand.
> >
> > > In my Users, there is no file named by anyAction..
> >
> > > anyAction function was saved in /controllers/users_controller.php
> >
> > > What do you mean ?..
> >
> > > best regards,
> > > Maxim
> > > On Dec 31, 11:33 am, Amit Badkas  wrote:
> > > > Hi,
> >
> > > > Have you executed the code in anyAction() to populate ACL tables with
> > > dummy
> > > > data, something like http://
> > > > //users/anyAction?
> >
> > > > Amit Badkas
> >
> > > > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > > > On Thu, Dec 30, 2010 at 8:39 PM, John Maxim 
> wrote:
> > > > > Hi everyone,
> >
> > > > > While working on the sample provided from cookbook (link below) I
> was
> > > > > going to create an aro where the codes are to be placed in a
> > > > > controller. I chose users_controller.php and I then verify by
> typing
> > > > > on my console:
> >
> > > > > cake acl view aro
> >
> > > > > It resulted in
> >
> > > > > Error: aro not found No tree returned.
> >
> > > > > What's wrong with it ?
> >
> > > > >
> http://book.cakephp.org/view/1245/Defining-Permissions-Cake-s-Databas.
> > > ..
> >
> > > > > Regards,
> > > > > Maxim
> >
> > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > others
> > > > > with their CakePHP related questions.
> >
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "CakePHP" group.
> > > > > To post to this group, send email to cake-php@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com
> 
> >
> > > 
> 
> >>For
> > > more options, visit this group at
> > > > >http://groups.google.com/group/cake-php?hl=en
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: How to use Grant in Shell ?

2010-12-30 Thread Amit Badkas
Hi,

What are the actual values of $aroAlias and $acoAlias variables?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Dec 31, 2010 at 11:47 AM, John Maxim  wrote:

> I have tried:
>
> >cake acl grant $aroAlias $acoAlias
> ---
> Error: Wrong number of parameters
> Got: 2
> Expected: 3
> Please type `cake acl help` for help
> on usage of the AclShell grant.
>
> ---
>
> >cake acl grant $aroAlias $acoAlias all
> --
> PHP Warning:  DbAcl::allow() - Invalid node in C:\wamp\www\cakephp\cake
> \libs\controller\components\acl.php on line 361
>
> Warning: DbAcl::allow() - Invalid node in C:\wamp\www\cakephp\cake\libs
> \controller\components\acl.php on line 361
> Permission was not granted.
>
> --
>
> I think the problem is I just saw it. My cake console core path is at:
>
> www/cakephp
>
> How can I change to /www
>
> ?
>
> My work and app path is both at /www
>
> Or is there something wrong with my grant command line ?
>
> Regards,
> Maxim
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: (Acl) Error: aro not found No tree returned.

2010-12-30 Thread Amit Badkas
Hi,

I meant that you need to access the method myAction() from URL so that the
code in that method will get executed and according to that code, the dummy
records will get populated to 'aros' table.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Dec 31, 2010 at 9:40 AM, John Maxim  wrote:

> Hi Amit...thanks for the reply but.. I don't understand.
>
> In my Users, there is no file named by anyAction..
>
> anyAction function was saved in /controllers/users_controller.php
>
> What do you mean ?..
>
> best regards,
> Maxim
> On Dec 31, 11:33 am, Amit Badkas  wrote:
> > Hi,
> >
> > Have you executed the code in anyAction() to populate ACL tables with
> dummy
> > data, something like http://
> > //users/anyAction?
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Thu, Dec 30, 2010 at 8:39 PM, John Maxim  wrote:
> > > Hi everyone,
> >
> > > While working on the sample provided from cookbook (link below) I was
> > > going to create an aro where the codes are to be placed in a
> > > controller. I chose users_controller.php and I then verify by typing
> > > on my console:
> >
> > > cake acl view aro
> >
> > > It resulted in
> >
> > > Error: aro not found No tree returned.
> >
> > > What's wrong with it ?
> >
> > >http://book.cakephp.org/view/1245/Defining-Permissions-Cake-s-Databas.
> ..
> >
> > > Regards,
> > > Maxim
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Add User/Group in Descending Order by Time(Last Add)

2010-12-30 Thread Amit Badkas
Hi,

>From the data you posted, it seems that they are properly inserting in table
as the IDs are incrementing. If you are displaying that data anywhere and
you need to sort/order them in a particular way then use 'order' parameter
while finding the records.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Dec 31, 2010 at 9:31 AM, John Maxim  wrote:

> Hi
> As I go through this tutorial:
> http://book.cakephp.org/view/1547/Acts-As-a-Requester
>
> When we add Group/User, after deleting some, the new data doesn't line
> up in descending order e.g. User:
>
> Id  Name
> -
> 2. Jennifer<--- 2nd user is added
> 1. Jason   <--- 1st user is added
> 3. Mark<--- 3rd user is added
>
> ~~
>
> Can someone point this logical issue? like how to fix it so it goes in
> descending order by time. (the oldest at the top)
>
>
> regards,
> Maxim
>
>
>
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Url to action without action name

2010-12-30 Thread Amit Badkas
Hi,

Please have a look at
http://book.cakephp.org/view/949/Passing-parameters-to-action, hope this
helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 30, 2010 at 3:15 PM, talisker  wrote:

> Hello!
>
> I need just this: go directy to an action without the action name on
> the url, like this example:
>
> www.example.com/news/read/2-hello_world_is_dying
>
> to
>
> www.example.com/news/2-hello_world_is_dying
>
> I tried to achieve this adding this route on routes.php:
>
> Router::Connect('/news/:id-:slug', array ('controller' => 'news',
> 'action' => 'read'), ...
>
> I thought defining this route, the inverse routing would make these
> desired url's but... not!
>
> Help, please?
>
>
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Help with 'persist' on Router::Connect

2010-12-30 Thread Amit Badkas
Hi,

I haven't tried this yet but I think you need to build the link using code
something like

echo $this->Html->link('News', array(
'controller' => 'news',
'action' => 'index',
'lang' => 'esp'
   ));

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Dec 31, 2010 at 2:50 AM, talisker  wrote:

> Hello again! :P
>
> can someone explain me how to set the parameter 'persist' in
> Router::Connect() function to achieve insert automatically the
> language on the first level of url in every $html->link()? I searched
> a lot and I didn't find a goog exlanation about this. I need url's
> like this:
>
> www.example.com/esp/news/...
> www.example.com/cat/news/...
>
> The explanation in api is as follows:
>
> "persist is used to define which route parameters should be
> automatically included when generating new urls. You can override
> peristent parameters by redifining them in a url or remove them by
> setting the parameter to false. Ex. 'persist' => array('lang')"
>
> Thanks!
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Cakephp related tables show id's instead of values

2010-12-30 Thread Amit Badkas
Hi,

You mentioned that Candidate hasMany Qualificationlookup belongsTo
Qualification. By default, while finding the record, the recursion level is
1. That's why Qualificationlookup data fetched automatically when you find a
particular Candidate. So you need to do something like following in 'view
candidate' action to get qualification name and also need to use Containable
behavior

$this->Candidate->contain('Qualificationlookup.Qualification');
$candidateDetails = $this->Candidate->findById($id);

Now the $candidateDetails will have data something like

array(
'Candidate' => array()
'Qualificationlookup' => array(
   0 => array(

,
   'Qualification' =>
array(...)
  )
)

After this, you need to modify the 'view' to display qualification name
in 'related qualificationlookups' table.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 30, 2010 at 4:16 AM, vauneen  wrote:

> Hi, i think i have all 'baked' all my relationships correctly but my
> 'related' table shows id's instead of values.
>
> my db has 3 tables. candidates, qualificationlookups, qualifications.
> qualificationlookups, links candidates to qualifications using the id
> of the candidate and the id of the qualification.
>
> in my view view, for 'candidates', i have a 'related
> qualificationlookups' table. (generated by baking a candidate hasmany
> qualificationlookups and a qualificationlookups belongsto candidate
> relationship)
>
> in my edit view, for 'qualificationlookups', i can correctly set up
> the candidates and qualifications fields as dropdowns so i know
> 'qualificationlookups's relationships are fine.
>
> So how do i ask cakephp to list the name of the qualification (from
> 'qualifications' table) in the 'related qualificationlookups' table on
> a candidate's page?
>
> i must be missing something...
>
> could someone please point me in the right direction?
>
> Thanks, Vauneen
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: using onmouseup to update database

2010-12-30 Thread Amit Badkas
Hi,

I think you are asking this question at a wrong place as it is more of a
HTML/Javascript related than PHP/CakePHP. Have you ever
done AJAX using onchange in a simple HTML/PHP application using jQuery or
javascript etc.?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 30, 2010 at 10:04 PM, roundrightfarm
wrote:

> Thanks for pointing out I needed to use onchange and not onmouseup.
>
> I know this is not standard cakephp.  I am new to php and cakephp and
> found the form helper confusing, so I decided not to use it and just
> code the html which I understand a little better.
>
> how do I go about coding the value of the selected option into
> onchange
> 
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: (Acl) Error: aro not found No tree returned.

2010-12-30 Thread Amit Badkas
Hi,

Have you executed the code in anyAction() to populate ACL tables with dummy
data, something like http://
//users/anyAction?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 30, 2010 at 8:39 PM, John Maxim  wrote:

> Hi everyone,
>
> While working on the sample provided from cookbook (link below) I was
> going to create an aro where the codes are to be placed in a
> controller. I chose users_controller.php and I then verify by typing
> on my console:
>
> cake acl view aro
>
> It resulted in
>
> Error: aro not found No tree returned.
>
> What's wrong with it ?
>
> http://book.cakephp.org/view/1245/Defining-Permissions-Cake-s-Database-ACL
>
>
>
> Regards,
> Maxim
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: query

2010-12-30 Thread Amit Badkas
Hi,

Please have a look at
http://book.cakephp.org/view/1030/Complex-Find-Conditions, you will get the
solution definitely.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 30, 2010 at 5:37 PM, Miqdad Ali  wrote:

> $qry="select * from enrollments where program_id=10 and (semester_id=12 or
> batch_id=23)
>
> how it rewrite to cakephp model find
>
> $this->Enrollment->find('all',array(
>
> 'conditions'=>array('program_id'=>12,
>
> i want it correct please help
> 
> Miqdad Ali
> http://www.miqdadali.co.cc
>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: query

2010-12-30 Thread Amit Badkas
Hi.

You don't need 'AND' key,

$conditions = array(
   'Enrollment.program_id'=>12,
   'OR'=>array(
   'Enrollment.semester_id'=>12,
   'Enrollment.batch_id'=>23,
   )
);

is the correct one.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 30, 2010 at 5:52 PM, Jon Bennett  wrote:

> > $qry="select * from enrollments where program_id=10 and (semester_id=12
> or batch_id=23)
> >
> > how it rewrite to cakephp model find
> >
> > $this->Enrollment->find('all',array(
> >
> 'conditions'=>array('program_id'=>12,
> >
> > i want it correct please help
>
> this should do it:
>
> $conditions = array(
>'Enrollment.program_id'=>12,
>'AND'=>array(
>'OR'=>array(
>'Enrollment.semester_id'=>12,
>'Enrollment.batch_id'=>23,
>)
>)
> );
> $this->Enrollment->find('all', array(
> 'conditions'=>$conditions
> ));
>
> hth
>
> Jon
>
> --
> jon bennett - www.jben.net - blog.jben.net
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: using onmouseup to update database

2010-12-29 Thread Amit Badkas
Hi,

The code doesn't seem to be as per CakePHP standard. However, you need to
handle onchange event of a select to save the selected option (probably
using an AJAX request).

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 30, 2010 at 12:58 AM, roundrightfarm
wrote:

> I have a  drop down menu in a view and I'm wondering
> if i can send data based on the selected result to my database when it
> is selected onmouseup.
>
> the s are populated from the optional_share_products table.
> I'd like to send data about the selected product (actually Item.id) to
> the optional_share_users table to record the choice for that user.
>
> this is what I have so far
>
> [code]
>  foreach($share_users as $user){
> if ($user['OptionalShareUser']['user_id'] == $this->Session-
> >read('Auth.User.id') && $user['OptionalShareUser']['share_id'] ==
> $optional_share['OptionalShare']['id']){
>  echo ('Your ' . $optional_share['OptionalShare']['name'] . '
> share this week is');?>
>
>  
>   if ($optional_share['OptionalShare']['id'] ==
> $product['OptionalShareProduct']['share_id']){
>  echo (' '. $product['Item']['name'] . '');
>}
>   } ?>
>  
> else continue;
> }
>}?>
>  [/code]
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Save and Loops

2010-12-29 Thread Amit Badkas
Hi,

You said that first and last iterations failed to insert. Was there any
errors outputted? Try to
output $this->Enrollment->Appointment->validationErrors array for failed
data. Please remember to test this with debug level 2 so that it will output
errors (if any) as well as SQL queries.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 2:44 PM, Mark wrote:

> Hi everyone,
>
> I just need some help on inserting records using loops.
>
> To give you an overview, I have programs that run for a certain number
> of days and this code will insert a separate row for each appointment
> record. The problem is that the loop fails at the first iteration.
> Another weird thing is that when the number of appointments is 20+, it
> will fail both the first and the 20th+ iterations. (rows 2-19 get
> inserted just fine).
>
> I've tried looking for other topics involving save and loops, but
> still couldn't find a solution.
>
> I'm placing here the code for your reference.
>
> Thank you in advance,
> Mark
>
>
> //PHP Code Starts Here
> $program = $this->Enrollment->Program->read(null, $this-
> >data['Enrollment']['program_id']);
>
> for($i=1;$i<=$program['Program']['no_of_appointments'];$i++) {
>$appointment = array(
>'appointment_no' => $i,
>'appointment_date' => array('month' =>
> date('m'), 'day' =>
> date('d'), 'year' => date('Y')),
>'employee_id' =>
> $this->data['Enrollment']['employee_id'],
>'enrollment_id' => $enrollment_id
>);
>$this->Enrollment->Appointment->create(false);
>if($this->Enrollment->Appointment->save($appointment)) {
>debug("Saved #$i");
>} else {
>debug("Failed #$i");
>}
> }
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Help with function Login()--using Auth (Redirecting issue)

2010-12-29 Thread Amit Badkas
Hi,

By default, Auth component redirects to referrer page (if set) otherwise to
the page set in loginRedirect. So you may need to overwrite
'Auth.redirect' session
parameter.

FYI, please have a look at http://book.cakephp.org/view/1270/loginRedirect

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 30, 2010 at 12:29 AM, cricket  wrote:

> On Tue, Dec 28, 2010 at 11:58 PM, John Maxim  wrote:
> > Users_controllers.php:
> > 
> >
> > var $name = 'Users';
> >
> > /*some codes in between*/
> >
> > function login()
> > {
> > if(!empty($this->data))
> >{
> > // If the username/password match
> > if($this->Auth->login($this->data))
> > {
> > $this->redirect(array('action' => 'index'), null,
> > true);
> > } else {
> >$this->User->invalidate('username', 'Username and password
> > combination is incorrect!');
> > }
> > }
> >  }
> >
>
> The code in your login method does basically what Auth would do if
> left to its own devices. You could get the same functionality as above
> by setting the following in AppController's beforeFilter method:
>
> // this tells Auth to handle redirects
> $this->Auth->autoRedirect = true;
>
> // this tells Auth where to send the user
> $this->Auth->loginRedirect = array(
>'controller' => 'posts',
>'action' => 'index'
> );
>
> $this->Auth->loginError = 'Username and password combination is
> incorrect!';
>
> if (!$this->Session->read('Auth.User'))
> {
>$this->Auth->authError = 'Please log in';
> }
>
> You set the first one to false when you need to do some routines
> during login--like record the login time, set a session var, etc.
> Otherwise, you can leave login() empty and allow Auth to sort it all
> out.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: HELP NEEDED with Auth "Component" in Views; Fatal error: (While using Auth component inside a helper)

2010-12-29 Thread Amit Badkas
Hi,

My question was 'are the ACL tables (aros, acos and aros_acos) populated
correctly?', please refer to
http://book.cakephp.org/view/1543/Simple-Acl-controlled-Application to
understand how to populate ACL tables.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 3:35 PM, John Maxim  wrote:

> Thanks Amit,
>
> Yes, the first undefined: is solved, I posted a post before yours. I
> ran the DB sql scripts with no error. The sql is as follow:
>
> 
>
> CREATE TABLE acos (
>  id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
>  parent_id INTEGER(10) DEFAULT NULL,
>  model VARCHAR(255) DEFAULT '',
>  foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
>  alias VARCHAR(255) DEFAULT '',
>  lft INTEGER(10) DEFAULT NULL,
>  rght INTEGER(10) DEFAULT NULL,
>  PRIMARY KEY  (id)
> );
>
> CREATE TABLE aros_acos (
>  id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
>  aro_id INTEGER(10) UNSIGNED NOT NULL,
>  aco_id INTEGER(10) UNSIGNED NOT NULL,
>  _create CHAR(2) NOT NULL DEFAULT 0,
>  _read CHAR(2) NOT NULL DEFAULT 0,
>  _update CHAR(2) NOT NULL DEFAULT 0,
>  _delete CHAR(2) NOT NULL DEFAULT 0,
>  PRIMARY KEY(id)
> );
>
> CREATE TABLE aros (
>  id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
>  parent_id INTEGER(10) DEFAULT NULL,
>  model VARCHAR(255) DEFAULT '',
>  foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
>  alias VARCHAR(255) DEFAULT '',
>  lft INTEGER(10) DEFAULT NULL,
>  rght INTEGER(10) DEFAULT NULL,
>  PRIMARY KEY  (id)
> );
>
>
> ~~~
>
> On Dec 29, 5:56 pm, Amit Badkas  wrote:
> > Hi,
> >
> > About 'Undefined index: content' error, you should already know how to
> fix
> > it.
> >
> > About 'DbAcl::check() - Failed ARO/ACO node lookup in permissions check'
> > error, are the ACL tables (aros, acos and aros_acos) populated correctly?
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Wed, Dec 29, 2010 at 2:56 PM, John Maxim  wrote:
> > > Hi Amit, Thanks...!
> >
> > > I just put it in the controllers components--access.php:
> > > --
> > >  > > class AccessComponent extends Object{
> > >var $components = array('Acl', 'Auth');
> > >var $user;
> >
> > >function startup(){
> > > $this->user = $this->Auth->user();
> > >}
> >
> > >function check($aco, $action='*'){
> > > if(!empty($this->user) &&
> $this->Acl->check('User::'.$this-
> > > >user['User']['id'], $aco, $action)){
> > >return true;
> > >} else {
> > >return false;
> > >}
> > >}
> >
> > >function checkHelper($aro, $aco, $action = "*"){
> > >App::import('Component', 'Acl');
> > >$acl = new AclComponent();
> > >return $acl->check($aro, $aco, $action);
> > >}
> > > }
> > > ?>
> > > --
> >
> > > Now the errors are:
> > > ~~
> >
> > > Notice (8): Undefined index: content [APP\views\posts\index.ctp, line
> > > 7]
> > > ~~
> > > Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in
> > > permissions check.  Node references:
> > > Aro: User::44
> > > Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273]
> > > ~~
> >
> > > Regards,
> > > Maxim
> >
> > > On Dec 29, 4:43 pm, Amit Badkas  wrote:
> > > > Hi,
> >
> > > > Have you had AccessComponent class defined in
> > > > app/controllers/components/access.php?
> >
> > > > Amit Badkas
> >
> > > > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > > > On Wed, Dec 29, 2010 at 1:30 PM, John Maxim 
> wrote:
> > > > >  > > > > class AccessHelper extends Helper{
> > > > >var $helpers = array("Session");
> > > > >var $Access;
> > > > >var $Auth;
> > > > >var $user;
> >
> > > > >function beforeRender(){
> > > > >App::import('Component', 'Access');
> > > > >   

Re: HELP NEEDED with Auth "Component" in Views; Fatal error: (While using Auth component inside a helper)

2010-12-29 Thread Amit Badkas
Hi,

About 'Undefined index: content' error, you should already know how to fix
it.

About 'DbAcl::check() - Failed ARO/ACO node lookup in permissions check'
error, are the ACL tables (aros, acos and aros_acos) populated correctly?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 2:56 PM, John Maxim  wrote:

> Hi Amit, Thanks...!
>
> I just put it in the controllers components--access.php:
> --
>  class AccessComponent extends Object{
>var $components = array('Acl', 'Auth');
>var $user;
>
>function startup(){
> $this->user = $this->Auth->user();
>}
>
>function check($aco, $action='*'){
> if(!empty($this->user) && $this->Acl->check('User::'.$this-
> >user['User']['id'], $aco, $action)){
>return true;
>} else {
>return false;
>}
>}
>
>function checkHelper($aro, $aco, $action = "*"){
>App::import('Component', 'Acl');
>$acl = new AclComponent();
>return $acl->check($aro, $aco, $action);
>}
> }
> ?>
> --
>
> Now the errors are:
> ~~
>
> Notice (8): Undefined index: content [APP\views\posts\index.ctp, line
> 7]
> ~~
> Warning (512): DbAcl::check() - Failed ARO/ACO node lookup in
> permissions check.  Node references:
> Aro: User::44
> Aco: Post [CORE\cake\libs\controller\components\acl.php, line 273]
> ~~
>
> Regards,
> Maxim
>
> On Dec 29, 4:43 pm, Amit Badkas  wrote:
> > Hi,
> >
> > Have you had AccessComponent class defined in
> > app/controllers/components/access.php?
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Wed, Dec 29, 2010 at 1:30 PM, John Maxim  wrote:
> > >  > > class AccessHelper extends Helper{
> > >var $helpers = array("Session");
> > >var $Access;
> > >var $Auth;
> > >var $user;
> >
> > >function beforeRender(){
> > >App::import('Component', 'Access');
> > >$this->Access = new AccessComponent();
> >
> > >App::import('Component', 'Auth');
> > >$this->Auth = new AuthComponent();
> > >$this->Auth->Session = $this->Session;
> >
> > >$this->user = $this->Auth->user();
> > >}
> >
> > >function check($aco, $action='*'){
> > >if(empty($this->user)) return false;
> > >return
> > > $this->Access->checkHelper('User::'.$this->user['User']
> > > ['id'], $aco, $action);
> > >}
> >
> > >function isLoggedin(){
> > >return !empty($this->user);
> > >}
> > > }
> > > ?>
> >
> > > 
> >
> > > This access.php file is saved in app/views/helpers
> > > 
> > > In "Posts" Controller, I have added: var $helpers = array('Access');
> >
> > > So it can be accessed from the view.
> >
> > > My Posts index is here:
> > > --
> > >  Welcome to my CakePHP Blog
> >
> > > 
> >
> > > > > $post['Post']['title'] ?>
> >
> > > 
> >
> > > isLoggedin() && $access->check('Post')): ?>
> >
> > > edit
> > > |
> > > link('delete', '/posts/delete/'.$post['Post']['id'],
> > > NULL, 'Are you sure?'); ?>
> >
> > > 
> > > 
> > > 
> > > ---
> >
> > > I got this error as I view Posts index:
> > > ---
> > > Fatal error: Class 'AccessComponent' not found in C:\wamp\www\cakephp
> > > \app\views\helpers\access.php on line 10
> > > ---
> >
> > > Line 10 points to this:
> > > 
> > > $this->Access = new AccessComponent();
> > > -
> >
> > > ~~
> >

Re: HELP NEEDED with Auth "Component" in Views; Fatal error: (While using Auth component inside a helper)

2010-12-29 Thread Amit Badkas
Hi,

Have you had AccessComponent class defined in
app/controllers/components/access.php?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 1:30 PM, John Maxim  wrote:

>  class AccessHelper extends Helper{
>var $helpers = array("Session");
>var $Access;
>var $Auth;
>var $user;
>
>function beforeRender(){
>App::import('Component', 'Access');
>$this->Access = new AccessComponent();
>
>App::import('Component', 'Auth');
>$this->Auth = new AuthComponent();
>$this->Auth->Session = $this->Session;
>
>$this->user = $this->Auth->user();
>}
>
>function check($aco, $action='*'){
>if(empty($this->user)) return false;
>return
> $this->Access->checkHelper('User::'.$this->user['User']
> ['id'], $aco, $action);
>}
>
>function isLoggedin(){
>return !empty($this->user);
>}
> }
> ?>
>
> 
>
> This access.php file is saved in app/views/helpers
> 
> In "Posts" Controller, I have added: var $helpers = array('Access');
>
> So it can be accessed from the view.
>
>
> My Posts index is here:
> --
>  Welcome to my CakePHP Blog
>
> 
>
> $post['Post']['title'] ?>
>
> 
>
> isLoggedin() && $access->check('Post')): ?>
>
> edit
> |
> link('delete', '/posts/delete/'.$post['Post']['id'],
> NULL, 'Are you sure?'); ?>
>
> 
> 
> 
> ---
>
> I got this error as I view Posts index:
> ---
> Fatal error: Class 'AccessComponent' not found in C:\wamp\www\cakephp
> \app\views\helpers\access.php on line 10
> ---
>
> Line 10 points to this:
> 
> $this->Access = new AccessComponent();
> -
>
> ~~
>
> What am I trying to accomplish ?
>
> The edit and delete links can only be viewed when User is logged in.
> If not logged in, only the Posts index and view page are viewable--
> without displaying the edit and delete links to the Guest users.
>
> ~~
>
> Is the method of doing wrong ? what is the suggested way ?
>
> Thanks,
> Maxim
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Help with function Login()--using Auth (Redirecting issue)

2010-12-28 Thread Amit Badkas
Hi,

I think the problem is due to other thing(s). I can't advise much without
looking at all of the code. However, please refer
http://book.cakephp.org/view/1250/Authentication to check if you have set-up
authentication parameters correctly or not.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 11:49 AM, John Maxim  wrote:

> Hi Amit,
>
> I used your code:
>
>  $this->redirect(array('controller' => 'posts', 'action' => 'index'));
>
> but it still redirects me to the root directory...
>
> What can be wrong ?
>
>
>
> On Dec 29, 1:39 pm, Amit Badkas  wrote:
> > Hi,
> >
> > In CakePHP, the views don't display directly, you need to render them
> using
> > actions of controllers. From your description, it seems that you need to
> > redirect to /posts/index page, so use
> >
> > $this->redirect(array('controller' => 'posts', 'action' => 'index'));
> >
> > to go to that page.
> >
> > Hope this helps.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Wed, Dec 29, 2010 at 10:28 AM, John Maxim  wrote:
> > > Users_controllers.php:
> > > 
> >
> > > var $name = 'Users';
> >
> > > /*some codes in between*/
> >
> > > function login()
> > > {
> > > if(!empty($this->data))
> > >{
> > > // If the username/password match
> > > if($this->Auth->login($this->data))
> > > {
> > > $this->redirect(array('action' => 'index'), null,
> > > true);
> > > } else {
> > >$this->User->invalidate('username', 'Username and
> password
> > > combination is incorrect!');
> > > }
> > > }
> > >  }
> >
> > > -
> > > Hi,
> >
> > > After successful login, I want it to redirect to app/views/posts/
> > > index.ctp
> >
> > > Originally, the redirect code is like this:
> > > (1)
> > > ~~
> > > $this->redirect('/');
> > > ~~
> > > I changed to:
> > > (2)
> > > ~~
> > >  $this->redirect(array('action' => 'index'), null, true);
> > > ~~
> > > (3)
> > > ~~
> > > $this->redirect(array('action' => 'views/posts/index'), null, true);
> > > ~~
> >
> > > All failed to redirect to *app/views/posts/index.ctp
> > > ~~
> > > It consistently redirected me to my App/index.ctp which displays all
> > > my cakephp versions stuff (mod rewrite...etc the green page),
> > > regardless of the 3 redirect methods used above.
> >
> > > Is it something wrong with my Login() function instead ??
> >
> > > Thanks,
> >
> > > Maxim J.
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Help with function Login()--using Auth (Redirecting issue)

2010-12-28 Thread Amit Badkas
Hi,

In CakePHP, the views don't display directly, you need to render them using
actions of controllers. From your description, it seems that you need to
redirect to /posts/index page, so use

$this->redirect(array('controller' => 'posts', 'action' => 'index'));

to go to that page.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 10:28 AM, John Maxim  wrote:

> Users_controllers.php:
> 
>
> var $name = 'Users';
>
> /*some codes in between*/
>
> function login()
> {
> if(!empty($this->data))
>{
> // If the username/password match
> if($this->Auth->login($this->data))
> {
> $this->redirect(array('action' => 'index'), null,
> true);
> } else {
>$this->User->invalidate('username', 'Username and password
> combination is incorrect!');
> }
> }
>  }
>
> -
> Hi,
>
> After successful login, I want it to redirect to app/views/posts/
> index.ctp
>
> Originally, the redirect code is like this:
> (1)
> ~~
> $this->redirect('/');
> ~~
> I changed to:
> (2)
> ~~
>  $this->redirect(array('action' => 'index'), null, true);
> ~~
> (3)
> ~~
> $this->redirect(array('action' => 'views/posts/index'), null, true);
> ~~
>
> All failed to redirect to *app/views/posts/index.ctp
> ~~
> It consistently redirected me to my App/index.ctp which displays all
> my cakephp versions stuff (mod rewrite...etc the green page),
> regardless of the 3 redirect methods used above.
>
> Is it something wrong with my Login() function instead ??
>
>
>
> Thanks,
>
> Maxim J.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Help with function Register--using Auth

2010-12-28 Thread Amit Badkas
Hi,

The code posted by you in second mail is the most common way to validate and
save data in a single go but it doesn't mean that you can't do it using
validates() and save(). As you asked in the first mail about what's wrong in
the code, I pointed you to the missing 'set' code, that's it.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 9:47 AM, John Maxim  wrote:

> Hi Amit,
>
> Thanks, crossed posted with your message..
>
> Why is it we do the validation in Controller? instead of like the code
> I provided for the second one.
>
>
>
> On Dec 29, 12:08 pm, Amit Badkas  wrote:
> > Hi,
> >
> > You need to set the data for the model to validate it, please
> referhttp://book.cakephp.org/view/1182/Validating-Data-from-the-Controller
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Wed, Dec 29, 2010 at 9:36 AM, John Maxim  wrote:
> > > function register()
> > > {
> > > if(!empty($this->data))
> > >{
> >
> > > if($this->User->validates())
> > >   {
> > > $this->User->save($this->data);
> >
> > > $data = $this->User->read();
> >
> > > $this->Auth->login($data);
> >
> > > $this->redirect('/');
> > >}
> > >  }
> > >   }
> > > 
> > > Hi,
> >
> > > My models/user.php validation scripts stopped working if I used the
> > > above script in my controller. What's wrong with it?
> >
> > > Thanks,
> >
> > > Maxim J.
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Help with function Register--using Auth

2010-12-28 Thread Amit Badkas
Hi,

You need to set the data for the model to validate it, please refer
http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 29, 2010 at 9:36 AM, John Maxim  wrote:

> function register()
> {
> if(!empty($this->data))
>{
>
> if($this->User->validates())
>   {
> $this->User->save($this->data);
>
> $data = $this->User->read();
>
> $this->Auth->login($data);
>
> $this->redirect('/');
>}
>  }
>   }
> 
> Hi,
>
> My models/user.php validation scripts stopped working if I used the
> above script in my controller. What's wrong with it?
>
> Thanks,
>
> Maxim J.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: how to use updateAll and IN clause together

2010-12-26 Thread Amit Badkas
Hi,

Have you looked at the SQL queries log?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Dec 27, 2010 at 11:45 AM, Zeu5  wrote:

> This is the example of the query I want to execute.
> // UPDATE cart_items SET product_price = 2 WHERE product_id = 4 AND id
> IN (2,4)
>
> $this->updateAll(array('product_price' => $newPrice),
>array('product_id'=>$product_id,
>   'id '=>$cartItemIdArray));
>
>
>
> $this->updateAll(array('product_price' => $newPrice),
>array('product_id'=>$product_id,
>   'id IN '=>$cartItemIdArray));
>
> Neither of these queries work.
>
> Please advise.
>
> Thank you.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: recursive call

2010-12-26 Thread Amit Badkas
Hi,

The form helper judges the options of a select field according to the
section of field name before '_id'. For example, it uses $departments if
field name is 'department_id', so try to set variable name as 'parents'
instead of 'parentUsers'.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Sun, Dec 26, 2010 at 4:34 AM, Valter  wrote:

> All,
>
> I a newbie to cake and need your expert help. I've created a db schema
> then baked it (used cake naming convention all the way). See below the
> schema:
>
> users {id(PK), name, lastname, username, password, email,
> department_id(FK), parent_id(FK)**}
>
> **parent_id refers to the users table recursively (a user can
> supervise another user). When I bake it to create all the CRUD
> functions It seems to work fine but then when I try to ADD a new user
> the drop down menu do not populate itself with the data I entered
> manually in the database.
>
> Funily enough, when I debug() the parentUsers table generated by cake,
> it returns the values I was expecting in the dropdown element.
>
> See the bake generated code below:
>
> thanks
>
> ** View*
>debug($parentUsers);
>   echo $this->Form->input('name');
>   echo $this->Form->input('last_name');
>   echo $this->Form->input('username');
>   echo $this->Form->input('password');
>   echo $this->Form->input('email');
>   echo $this->Form->input('department_id');
>   echo $this->Form->input('parent_id');
> ?>
> 
>
> ** Controller *
> .
>   $departments = $this->User->Department->find('list');
>   $parentUsers = $this->User->ParentUser->find('list');
>   $this->set(compact('departments', 'parentUsers'));
> .
> .
> .
> ** Model *
> var $belongsTo = array(
> 'ParentUser' => array(
>'className' => 'User',
>'foreignKey' => 'parent_id',
>'conditions' => '',
>'fields' => '',
>'order' => ''
>)
> );
>
> ***
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Display data from specific data in the Home Page

2010-12-26 Thread Amit Badkas
Hi,

Please follow http://book.cakephp.org/view/1528/Blog to build a basic blog
application in CakePHP so that you will get familiar with CakePHP working.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Sun, Dec 26, 2010 at 7:38 PM, Ahmed - CakePHP wrote:

>
> Hello Everybody,
>
> As you know, I am a beginner in CakePHP.
> I trying to do a blog, simple blog, just as a training in how to build
> a websites using CakePHP.
>
> I created few Controllers, such as (users, posts, comments and
> categories).
> Also I designed the Home Page, which is empty now.
>
> I want to know:
> How can I display data from the Tables in the database in the Home
> Page.
>
> For example:
> - I want to display the latest posts.
> also, may be, the latest registered users
> or whatever
>
>
> Can you please tell me how CakePHP deals with this.
>
>
>
> Thank you in Advance,
> Ahmed
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Plugin-DataSources Sample ?

2010-12-26 Thread Amit Badkas
Hi,

The guide shows you a way to build/implement datasources which you can use
for your models. About the interface, it's upto you how you want it.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Sat, Dec 25, 2010 at 9:54 PM, John Maxim  wrote:

> Following the link below:
>
> http://book.cakephp.org/view/1652/Plugin-DataSources-and-Datasource-Drivers
>
> Does anyone have any working sample already implemented using the
> above Plugin ?
>
> I read how it connects to Twitter and Facebook. How is the interface
> look like after connecting ?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: how to use transactions in cakephp

2010-12-24 Thread Amit Badkas
Hi,

I didn't know that you need to use saveAll() inside transaction. By default,
saveAll() starts new transaction. So change your saveAll() call from

$result = $this->saveAll($data);

to

$result = $this->saveAll($data, array('atomic' => false));

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Fri, Dec 24, 2010 at 1:30 PM, Zeu5  wrote:

> Hi all,
>
> it did not work.
>
> I have tried
>
> This is for a Merchant Model;
>
> $datasource = $this->getDataSource();
>
> $datasource->begin($this);
>
> $result = $this->saveAll($data);
> if (!$result) {
>  $datasource->rollback($this);
>  return false;
> }
> /**
> * do something to form a $domainData array
> **/
> $result = $this->Shop->Domain->save($domainData);
>
> if (!$result) {
>  $datasource->rollback($this);
>  return false;
> }
>
> // and so on.
>
> // finally the last one has
>
> if (!$result) {
>  $datasource->rollback($this);
>  return false;
> } else {
>  $datasource->commit($this);
> }
>
>
> There is no single transaction to speak of. because if i purposely
> fail the last save() or saveAll(). the previous save and saveAll will
> work.
>
> Please advise.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: how to use transactions in cakephp

2010-12-23 Thread Amit Badkas
Hi,

I would use something like following in one of the models to save data for
non-related InnoDB tables

$db =& ConnectionManager::getDataSource($this->useDbConfig);
$db->begin($this);



$db->commit($this);

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 23, 2010 at 7:46 PM, Zeu5  wrote:

> Alright thanks!
>
> On Dec 23, 8:55 pm, Jon Bennett  wrote:
> > > Unfortunately the 7 models are not interrelated to each other, some
> > > are of course related.
> >
> > > So i am not sure if saveAll allows that non interrelated models.
> >
> > I've only used transactions in cake to save related data, though I
> > believe once a transaction has been triggered, it will wrap any
> > subsequent saveAll's as well - not certain on that, worth checking!
> >
> > not used the datasource way of doing it, sorry.
> >
> > hth
> >
> > Jo
> >
> > --
> > jon bennett -www.jben.net- blog.jben.net
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: does $this->render act as "die" in 1.2?

2010-12-23 Thread Amit Badkas
Hi,

No, $this->render() doesn't stop execution.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 23, 2010 at 3:47 PM, Stephen wrote:

> Simple question.
>
> I'm reworking some of my code to make it more efficient and user friendly
> (Fat Models etc)
>
> I'm wondering, does $this->render() stop cake from reading further on in
> the controller action? (I.e. Act like running die() )
>
> Cheers
>
> --
> Kind Regards
>  Stephen @ NinjaCoderMonkey
>
>  www.ninjacodermonkey.co.uk
>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: How can I add to one table while I'm adding to another

2010-12-22 Thread Amit Badkas
Hi,

The link given by me was not a broken one as I am still able to access that.
Also I told you to refer the behavior and it doesn't have cleanUpFields()
anywhere, anyhow I didn't think that the behavior provides complicated
solution. I also mentioned 'this is a too old article and some code in it
need to change as per latest version of CakePHP'.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 22, 2010 at 11:02 PM, georgeman wrote:

> Thanks for the tips. I don't think SaveAll is the solution I am
> looking for.
>
> What I want to do is enter a list of tags separated by commas then
> save them correctly. The 'simple tagging' article seems to be geared
> towards this but the solution offered is SO COMPLICATED and his
> comments are too brief to be very helpful, so I would have to go
> through each line by line.   Here is the link again because the link
> Amit posted got broken: http://bit.ly/hILzLN. It also uses
> cleanUpFields() function which is deprecated and some searching
> through the old APIs, this group, and Google I realized this was going
> to be some work...
>
> Here is another article on this topic (http://bit.ly/hCC7Cc) but gwoo
> this is not a good approach because it is not a good idea to use a
> model inside a component. But at least his comments explain in an
> understandable way what he is doing? He left a clue in his comment
> "Look how we implemented tagging in the bakery code". I wish he would
> have supplied a link. I did some searching on the bakery and couldn't
> find anything.
>
> But I did find another article: http://bit.ly/hJiP8y , and it looks
> promising but as I was reading it I noticed the quality of
> explanations gradually deteriorating. The article starts off being
> excellently organized and clearly explaining everything that is about
> to happen, and by the time we get to the end it looks like the writer
> decided to get it over with and dump the rest of the code... (lmao)..
>
> Since tagging is so common on the web I am really surprised there
> isn't already developed an easier way to do this for CakePHP.
>
>
>
> On Dec 20, 11:57 pm, Amit Badkas  wrote:
> > Hi,
> >
> > You need to use behavior for this, I use modified version ofhttp://
> bakery.cakephp.org/articles/dooltaz/2007/05/02/simple-tagging-...
> > this is a too old article and some code in it need to change as per
> > latest version of CakePHP.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Dec 21, 2010 at 7:32 AM, georgeman 
> wrote:
> > > Here is the scenario based on a simple blog:
> >
> > > The model for the blog is called Post. Post has the following fields:
> > > id, title, body, created, modified. There are two other related
> > > models: Tag and Comment. Tag has the following fields: id, name,
> > > created, modified. Comment has the following fields: id, name, email,
> > > body, blog_id, created, modified.
> >
> > > These are the associations: Post hasMany Comment, Post
> > > hasAndBelongsToMany Tag, Tag hasAndBelongsToMany Post, Comment
> > > belongsTo Post.
> >
> > > Therefore another table is required to keep track of the associations
> > > between Post and Tag. The posts_tags table has the following fields:
> > > post_id, tag_id.
> >
> > > So let's say I want to write a new blog Post. And let's say I want to
> > > add some new tags that already are not in the table. How do I do that?
> > > How do I add to two tables at the same time?
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> For more options, visit this
> group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Default Page

2010-12-22 Thread Amit Badkas
Hi,

By default CakePHP renders app/views/pages/home.ctp view for '/' URL, though
you can change this by making changes in app/config/routes.php

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 22, 2010 at 7:53 PM, Nicolas400  wrote:

> Hyi I'm quite new to cake and I wonder how can I do this
> I want a welcome or index page that shows me a lot of info.
> I don't want toenter directly to a "List of ..." page.
>
> Thinking in how Cake work I think that I need a sort of "default"
> controller that shows me a particular view.
> But in this default controler I want to "use" models" of my database
> (system) , to show for example a random article or something like
> that.
>
> Any Idea how to do that ?
>
> Best regards
>
> PS: It will be great if the Cake Blog demo had this issue as a last
> lesson.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: IDE

2010-12-22 Thread Amit Badkas
Hi,

I think you need to try TextMate, though I am a linux user, I heard a lot of
good things about it.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 22, 2010 at 3:24 PM, Jorge Garifuna wrote:

> I alternate between eclipse and netbeans.
>
> I find that they both get slow with large projects, so I keep looking for
> new opportunities that will work on the MAC OSX:)
>
> Jorge Garifuna
> Professional Web Developer
> "Your Web Solution Partner"
> Garinet Media Network, LLC.
> PO BOX 570402
> Tarzana, CA 91357
> http://www.GariDigital.com
> Business Operating Hours: Monday - Friday: 9AM - 6 PM PST
> Tel: 213-915-4402
>
>
>
> On Wed, Dec 22, 2010 at 12:11 AM, fadhli  wrote:
>
>> netbeans
>>
>>
>> On Wed, Dec 22, 2010 at 12:32 PM, Amit Badkas wrote:
>>
>>> Hi,
>>>
>>> I use easy eclipse for PHP (
>>> http://www.easyeclipse.org/site/distributions/php.html). I have also
>>> used Aptana IDE once but found easy eclipse better.
>>>
>>> Amit Badkas
>>>
>>> PHP Applications for E-Biz: http://www.sanisoft.com
>>>
>>>
>>>
>>> On Tue, Dec 21, 2010 at 8:27 PM, Kristofer  wrote:
>>>
>>>> What IDE do people typically use with CakePHP?  I've been doing stuff
>>>> from the Linux command line using vim for so long.  I'd like something
>>>> more graphical that (hopefully) supports SVN.  Looking for more point-
>>>> and-click.  :)
>>>>
>>>> Check out the new CakePHP Questions site http://cakeqs.org and help
>>>> others with their CakePHP related questions.
>>>>
>>>> You received this message because you are subscribed to the Google
>>>> Groups "CakePHP" group.
>>>> To post to this group, send email to cake-php@googlegroups.com
>>>> To unsubscribe from this group, send email to
>>>> cake-php+unsubscr...@googlegroups.comFor
>>>>  more options, visit this group at
>>>> http://groups.google.com/group/cake-php?hl=en
>>>>
>>>
>>>  Check out the new CakePHP Questions site http://cakeqs.org and help
>>> others with their CakePHP related questions.
>>>
>>> You received this message because you are subscribed to the Google Groups
>>> "CakePHP" group.
>>> To post to this group, send email to cake-php@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> cake-php+unsubscr...@googlegroups.comFor
>>>  more options, visit this group at
>>> http://groups.google.com/group/cake-php?hl=en
>>>
>>
>>  Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> You received this message because you are subscribed to the Google Groups
>> "CakePHP" group.
>> To post to this group, send email to cake-php@googlegroups.com
>> To unsubscribe from this group, send email to
>> cake-php+unsubscr...@googlegroups.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: IDE

2010-12-21 Thread Amit Badkas
Hi,

I use easy eclipse for PHP (
http://www.easyeclipse.org/site/distributions/php.html). I have also used
Aptana IDE once but found easy eclipse better.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Dec 21, 2010 at 8:27 PM, Kristofer  wrote:

> What IDE do people typically use with CakePHP?  I've been doing stuff
> from the Linux command line using vim for so long.  I'd like something
> more graphical that (hopefully) supports SVN.  Looking for more point-
> and-click.  :)
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: CakePHP in subdirectory, but in the url

2010-12-21 Thread Amit Badkas
Hi,

I haven't done this yet but by looking at
http://api13.cakephp.org/file/cake/libs/router.php#method-Routerurl, I think
you can set the 'base' for URLs.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 22, 2010 at 6:21 AM, Luos  wrote:

> Hi!
>
> I want to place my CakePHP app to a subdirectory like this:
>
> web (server document root)
> cake_app
> app
> cake
> etc
>
>
> I made a htaccess to the document root:
>
> 
> RewriteEngine on
> RewriteBase /
> RewriteRule^$ cideo/app/webroot/[L]
> RewriteRule(.*) cideo/app/webroot/$1 [L]
> 
>
> (cideo is the name of the app)
>
> Evrything works well at first look, but if i make links with html
> helper, the links will look like this:
>
> http://domain.com/cideo/controller/action
> but i want only
> http://domain.com/controller/action
>
> is there any way to solve this?
>
> I looked at the source of Router but i only figured out that i have to
> modify the $base variable, but i didnt find out where (how) it gets
> value.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Short Names Navigation (like Twitter and Facebook)

2010-12-21 Thread Amit Badkas
Hi,

Please have a look at routing configuration,
http://book.cakephp.org/view/945/Routes-Configuration

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 22, 2010 at 4:53 AM, tcornett  wrote:

> I am trying to get an app to work with Twitter-like and Facebook-like short
> names for navigation (like http://twitter.com/) where  is a value
> referenced in the database.
>
> Where should I be looking to do the URL manipulation?  I am having trouble
> getting to the request prior to the normal CakePHP Framework behavior which
> will return 'No Such Controller'.
>
> I can handle the development, just a little confused on where I need to
> look in the process when Cake breaks down the URL request.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: CakePHP HABTM association rules

2010-12-21 Thread Amit Badkas
Hi,

Instead of writing custom SQL queries in controller's action, it would be
preferred to write respective methods in related (for example, product)
models to run those queries (and to build the needed data from them, if
needed) and then call those methods in controller's action.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Dec 21, 2010 at 8:44 PM, halfasleeps  wrote:

>
> Hi Amit, thank you for your answer. Your query makes sense to me, but
> how do I use that in a cakephp controller/model?
>
> I should probably mention I have a few years experience with PHP but
> this is my first MVC framework experience. From the tutorials I am
> supposed to use someting like $this->Model->find() .. should I use
> $this->Model->query() inside the controller?
>
>
> Thanks!
>
>
> On Dec 21, 12:15 am, Amit Badkas  wrote:
> > Hi,
> >
> > Try to build the SQL query something like
> >
> > SELECT *, COUNT(DISTINCT tags.name) AS uniques FROM products,
> products_tags,
> > tags WHERE products.id = products_tags.product_id AND tags.id =
> > products_tags.tag_id AND tags.name IN ('ruby', 'earrings') GROUP BY
> > products_tags.photo_id HAVING uniques = 2
> >
> > Please feel free to change the table and field names as per your need but
> > have a look at the use of 'uniques'. We used 2 for its value for HAVING
> as
> > the number of tags to use are 2 ('ruby' and 'earrings').
> >
> > Hope this helps.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> >
> >
> >
> >
> >
> >
> > On Tue, Dec 21, 2010 at 1:43 AM, halfasleeps 
> wrote:
> >
> > > If I want to create a category and be able to link products to it by
> > > tags I can like so:
> >
> > >  - Create the category and product tables.
> > >  - Create a tags table with tags like: Ruby, Earrings, White-Gold
> > >  - Create a category_tags and product_tags table to map them
> > >  - Set category and product to hasAndBelongsToMany tags
> > >  - Set tags to hasAndBelongsToMany products and hasAndBelongsToMany
> > > categories
> > >  - Now say I have 2 products one with tags: Ruby and Earrings and
> > > another with tags: Ruby and Bracelet
> >
> > > Say I want to create a "Ruby Earrings" category.
> >
> > > I could add the Ruby and Earrings tags to the category. But under
> > > normal HABTM Model associations both products will be returned because
> > > even though only 1 has an earrings tag they both have a ruby tag.
> >
> > > How can I make it only match products that have ALL of the same tags
> > > as the category (products can have more tags but must have all the
> > > tags the corresponding category has) in order be returned?
> >
> > > Also, taking that even further, how could I add -tags to a category
> > > that the products must NOT have these tags to be returned?
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> For more options, visit this
> group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Problem with Password validation ?

2010-12-21 Thread Amit Badkas
Hi,

You need to use custom validation method for this in your model, something
like

'confirm_password' => array(
'notEmpty' => array(
'rule' => 'notEmpty',
'message' => 'This field cannot be blank.',
'last' => true,
),
'lengthCheck' => array(
'rule' => '/^.{6,40}$/',
'message' => 'Minimum password 6
characters.',
'last' => true,
),
'confirmed' => array(
'rule' => 'confirmPassword'
'message' => 'Both passwords should match.'
),
),

function confirmPassword()
{
return ($this->data[$this->alias]['password'] ==
Security::hash($this->data[$this->alias]['confirm_password'], null, true));
}

FYI, password hash mechanism uses Security::hash(), that's why we also need
to hash our confirmed password for comparison.

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Dec 21, 2010 at 2:39 PM, John Maxim  wrote:

> Hi,
>
> Do you know how to match value in password with confirm_password ? I
> tried equalTo but it is meant for fixed value ?
>
> I have tried what you suggested before this, since your first post, I
> understand, however, the passwords matching for the 2 password fields
> using validation--do you think it is possible without creating a
> function ?
>
> @previous post, I was referring to the Solution 1 where it created a
> function, I think it was put in model.
>
> Solution 2 is something what I'm trying to do half-way
>
> thanks for you time.
>
> On Dec 21, 4:45 pm, Amit Badkas  wrote:
> > Hi,
> >
> > Use name of password confirmation field instead of 'password' in validate
> > array, something like
> >
> > 'confirm_password' => array(
> >'notEmpty' => array(
> >'rule' => 'notEmpty',
> >'message' => 'This field cannot be
> blank.',
> >'last' => true,
> >),
> >'lengthCheck' => array(
> >'rule' => '/^.{6,40}$/',
> >'message' => 'Minimum password 6
> > characters.',
> >'last' => true,
> >    ),
> >),
> >
> > Hope this helps.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Tue, Dec 21, 2010 at 1:22 PM, John Maxim  wrote:
> > > @Amit
> > > First,
> >
> > > Thanks man.
> >
> > > Second...,
> > > Do you know how to implement Solution 1 above ?
> >
> > > On Dec 21, 12:47 pm, Amit Badkas  wrote:
> > > > Hi,
> >
> > > > If your form has password confirmation field then you can add 'not
> empty'
> > > > and 'length check' validations for that field as it won't contain
> hashed
> > > > value.
> >
> > > > Amit Badkas
> >
> > > > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > > > On Mon, Dec 20, 2010 at 10:43 PM, John Maxim 
> wrote:
> > > > > 'password' => array(
> > > > >'notEmpty' => array(
> > > > >'rule' => 'notEmpty',
> > > > >'message' => 'This field cannot be
> > > blank.',
> > > > >'last' => true,
> > > > >),
> > > > >'lengthCheck' => array(
> > > > >'rule' => '/^.{6,40}$/',
> > > > >'message' => 'Minimum password 6
>

Re: Problem with Password validation ?

2010-12-21 Thread Amit Badkas
Hi,

Use name of password confirmation field instead of 'password' in validate
array, something like

'confirm_password' => array(
   'notEmpty' => array(
   'rule' => 'notEmpty',
   'message' => 'This field cannot be blank.',
   'last' => true,
   ),
   'lengthCheck' => array(
   'rule' => '/^.{6,40}$/',
   'message' => 'Minimum password 6
characters.',
   'last' => true,
   ),
   ),

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Dec 21, 2010 at 1:22 PM, John Maxim  wrote:

> @Amit
> First,
>
> Thanks man.
>
> Second...,
> Do you know how to implement Solution 1 above ?
>
>
>
> On Dec 21, 12:47 pm, Amit Badkas  wrote:
> > Hi,
> >
> > If your form has password confirmation field then you can add 'not empty'
> > and 'length check' validations for that field as it won't contain hashed
> > value.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Mon, Dec 20, 2010 at 10:43 PM, John Maxim  wrote:
> > > 'password' => array(
> > >'notEmpty' => array(
> > >'rule' => 'notEmpty',
> > >'message' => 'This field cannot be
> blank.',
> > >'last' => true,
> > >),
> > >'lengthCheck' => array(
> > >'rule' => '/^.{6,40}$/',
> > >'message' => 'Minimum password 6
> > > characters.',
> > >'last' => true,
> > >),
> > >),
> >
> > > **
> > > The registration validation is affected when hash password is enabled.
> > > It doesn't matter how the hash was enabled; using Auth component; or
> > > Md5, once hash is enabled, the password validation no longer can be
> > > triggered. So, I think something wrong with the above validation ?
> >
> > > The full validations for all fields are below: (Note: only the
> > > password validation is affected)
> >
> > > 'username' => array(
> > >'notEmpty' => array(
> > >'rule' => 'notEmpty',
> > >'message' => 'This field cannot be
> blank.',
> > >'last' => true,
> > >),
> > >'uniqueCheck' => array(
> > >'rule' => 'isUnique',
> > >'message' => 'That username has already
> been
> > > taken.',
> > >'last' => true,
> > >),
> > >'lengthCheck' => array(
> > >'rule' => '/^.{6,40}$/',
> > >'message' => 'Minimum username 6
> > > characters.',
> > >'last' => true,
> > >),
> > >),
> >
> > >'email' => array(
> > >'notEmpty' => array(
> > >  'rule' => 'notEmpty',
> > >  'message' => 'This field cannot be blank.',
> > >  'last' => true,
> > > ),
> > >'email' => array(
> > >  'rule' => 'email',
> > >  'message' => 'That is not a valid email address.',
> > >  'last' => true,
> > >  ),
> > >  ),
> >
> > >   

Re: How to display password_2 field in asterisk ?

2010-12-21 Thread Amit Badkas
Hi,

If you are using input() method of form helper then set 'type' as 'password'
(http://book.cakephp.org/view/1392/options-type) otherwise use password()
method (http://book.cakephp.org/view/1428/password).

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Dec 21, 2010 at 1:18 PM, John Maxim  wrote:

> I have 2 password fields;
>
> 1. password
> 2. password_2
>
> The value displayed in field password_2 is in plain text, how to
> change it to asterisks/dots ?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: CakePHP HABTM association rules

2010-12-20 Thread Amit Badkas
Hi,

Try to build the SQL query something like

SELECT *, COUNT(DISTINCT tags.name) AS uniques FROM products, products_tags,
tags WHERE products.id = products_tags.product_id AND tags.id =
products_tags.tag_id AND tags.name IN ('ruby', 'earrings') GROUP BY
products_tags.photo_id HAVING uniques = 2

Please feel free to change the table and field names as per your need but
have a look at the use of 'uniques'. We used 2 for its value for HAVING as
the number of tags to use are 2 ('ruby' and 'earrings').

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Dec 21, 2010 at 1:43 AM, halfasleeps  wrote:

>
> If I want to create a category and be able to link products to it by
> tags I can like so:
>
>  - Create the category and product tables.
>  - Create a tags table with tags like: Ruby, Earrings, White-Gold
>  - Create a category_tags and product_tags table to map them
>  - Set category and product to hasAndBelongsToMany tags
>  - Set tags to hasAndBelongsToMany products and hasAndBelongsToMany
> categories
>  - Now say I have 2 products one with tags: Ruby and Earrings and
> another with tags: Ruby and Bracelet
>
> Say I want to create a "Ruby Earrings" category.
>
> I could add the Ruby and Earrings tags to the category. But under
> normal HABTM Model associations both products will be returned because
> even though only 1 has an earrings tag they both have a ruby tag.
>
> How can I make it only match products that have ALL of the same tags
> as the category (products can have more tags but must have all the
> tags the corresponding category has) in order be returned?
>
> Also, taking that even further, how could I add -tags to a category
> that the products must NOT have these tags to be returned?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: How can I add to one table while I'm adding to another

2010-12-20 Thread Amit Badkas
Hi,

You need to use behavior for this, I use modified version of
http://bakery.cakephp.org/articles/dooltaz/2007/05/02/simple-tagging-behavioras
this is a too old article and some code in it need to change as per
latest version of CakePHP.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Tue, Dec 21, 2010 at 7:32 AM, georgeman  wrote:

> Here is the scenario based on a simple blog:
>
> The model for the blog is called Post. Post has the following fields:
> id, title, body, created, modified. There are two other related
> models: Tag and Comment. Tag has the following fields: id, name,
> created, modified. Comment has the following fields: id, name, email,
> body, blog_id, created, modified.
>
> These are the associations: Post hasMany Comment, Post
> hasAndBelongsToMany Tag, Tag hasAndBelongsToMany Post, Comment
> belongsTo Post.
>
> Therefore another table is required to keep track of the associations
> between Post and Tag. The posts_tags table has the following fields:
> post_id, tag_id.
>
> So let's say I want to write a new blog Post. And let's say I want to
> add some new tags that already are not in the table. How do I do that?
> How do I add to two tables at the same time?
>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Problem with Password validation ?

2010-12-20 Thread Amit Badkas
Hi,

If your form has password confirmation field then you can add 'not empty'
and 'length check' validations for that field as it won't contain hashed
value.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Dec 20, 2010 at 10:43 PM, John Maxim  wrote:

> 'password' => array(
>'notEmpty' => array(
>'rule' => 'notEmpty',
>'message' => 'This field cannot be blank.',
>'last' => true,
>),
>'lengthCheck' => array(
>'rule' => '/^.{6,40}$/',
>'message' => 'Minimum password 6
> characters.',
>'last' => true,
>),
>),
>
> **
> The registration validation is affected when hash password is enabled.
> It doesn't matter how the hash was enabled; using Auth component; or
> Md5, once hash is enabled, the password validation no longer can be
> triggered. So, I think something wrong with the above validation ?
>
> The full validations for all fields are below: (Note: only the
> password validation is affected)
>
> 'username' => array(
>'notEmpty' => array(
>'rule' => 'notEmpty',
>'message' => 'This field cannot be blank.',
>'last' => true,
>),
>'uniqueCheck' => array(
>'rule' => 'isUnique',
>'message' => 'That username has already been
> taken.',
>'last' => true,
>),
>'lengthCheck' => array(
>'rule' => '/^.{6,40}$/',
>'message' => 'Minimum username 6
> characters.',
>'last' => true,
>),
>),
>
>
>'email' => array(
>'notEmpty' => array(
>  'rule' => 'notEmpty',
>  'message' => 'This field cannot be blank.',
>  'last' => true,
> ),
>'email' => array(
>  'rule' => 'email',
>  'message' => 'That is not a valid email address.',
>  'last' => true,
>  ),
>  ),
>
>'password' => array(
>'notEmpty' => array(
>'rule' => 'notEmpty',
>'message' => 'This field cannot be blank.',
>'last' => true,
>),
>'lengthCheck' => array(
>'rule' => '/^.{6,40}$/',
>'message' => 'Minimum password 6
> characters.',
>'last' => true,
>),
>),
>
>
> **
> Is there an alternative way to write these validations?; I have no
> clue why the password validation is nullified when hash password is
> enabled using any way.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: setFlash() doesn't wotk with me on WAMP

2010-12-20 Thread Amit Badkas
Hi,

The controller code seems to be fine. Are you using CakePHP's built-in
layout or your own?

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Dec 20, 2010 at 12:52 PM, Ahmed - CakePHP wrote:

>
> This is the Controller code:
>
>  class PostsController extends AppController {
>var $name = 'Posts';
>var $helpers = array('Session','Html','Form');
>var $components = array('Session');
>
>function index() {
>$this->set('posts', $this->Post->find('all', array('order'
> =>
> array('id DESC';
>}
>
>function add() {
>if (!empty($this->data)) {
>$this->Post->create();
>if ($this->Post->save($this->data)) {
>$this->Session->setFlash('The post has been added
> successfully.');
>$this->reDirect(array('action' => 'index'));
>} else {
>$this->Session->setFlash('The post has not been
> added
> successfullt');
>    }
>}
>}
> }
> ?>
>
>
> On Dec 20, 10:02 am, Amit Badkas  wrote:
> > Hi,
> >
> > Have you followed the blog tutorial exactly? If you can show me the code
> > written by you, that would be helpful to go ahead to solve the problem.
> >
> > Amit Badkas
> >
> > PHP Applications for E-Biz:http://www.sanisoft.com
> >
> > On Mon, Dec 20, 2010 at 12:18 PM, Ahmed - CakePHP <
> ahmed.amo...@gmail.com>wrote:
> >
> >
> >
> > > Any help here ?!?!?!
> >
> > > On Dec 19, 10:07 am, Ahmed - CakePHP  wrote:
> > > > You said:
> > > > "Make sure you have declared both the Session Component and the
> > > > Session Helper in your app_controller."
> >
> > > > How to do that ?!?!
> > > > What shill I do exactly Jeremy ?
> >
> > > > On Dec 19, 12:27 am, Jeremy Burns | Class Outfit
> >
> > > >  wrote:
> > > > > Make sure you have declared both the Session Component and the
> Session
> > > Helper in your app_controller. setFlash only places the message into
> the
> > > session. To show it, use echo $this->Session->flash() in a view,
> element or
> > > layout.
> >
> > > > > Jeremy Burns
> > > > > Class Outfit
> >
> > > > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
> >
> > > > > On 18 Dec 2010, at 16:13, Ahmed - CakePHP wrote:
> >
> > > > > > Hello,
> >
> > > > > > I am very very very new on CakePHP.
> > > > > > I tried to do a blog using the CakePHP. I did it :).
> > > > > > but I found a problem:
> > > > > > when I want to use "$this->Session->setFlash("Write whatever");"
> >
> > > > > > it doesn't work.
> > > > > > I don't see the sentences that I write inside setFlash. They
> doesn't
> > > > > > occur when I run the code/functions.
> >
> > > > > > I am using the local server "WAMP"
> >
> > > > > > Can you please tell me what is the problem ?
> >
> > > > > > Regards,
> > > > > > Ahmed
> >
> > > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > others with their CakePHP related questions.
> >
> > > > > > You received this message because you are subscribed to the
> Google
> > > Groups "CakePHP" group.
> > > > > > To post to this group, send email to cake-php@googlegroups.com
> > > > > > To unsubscribe from this group, send email to
> > > > > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group athttp://
> > > groups.google.com/group/cake-php?hl=en
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > You received this message because you are subscribed to the Google
> Groups
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com
> >For
> more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: setFlash() doesn't wotk with me on WAMP

2010-12-19 Thread Amit Badkas
Hi,

Have you followed the blog tutorial exactly? If you can show me the code
written by you, that would be helpful to go ahead to solve the problem.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Mon, Dec 20, 2010 at 12:18 PM, Ahmed - CakePHP wrote:

>
> Any help here ?!?!?!
>
>
> On Dec 19, 10:07 am, Ahmed - CakePHP  wrote:
> > You said:
> > "Make sure you have declared both the Session Component and the
> > Session Helper in your app_controller."
> >
> > How to do that ?!?!
> > What shill I do exactly Jeremy ?
> >
> > On Dec 19, 12:27 am, Jeremy Burns | Class Outfit
> >
> >  wrote:
> > > Make sure you have declared both the Session Component and the Session
> Helper in your app_controller. setFlash only places the message into the
> session. To show it, use echo $this->Session->flash() in a view, element or
> layout.
> >
> > > Jeremy Burns
> > > Class Outfit
> >
> > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
> >
> > > On 18 Dec 2010, at 16:13, Ahmed - CakePHP wrote:
> >
> > > > Hello,
> >
> > > > I am very very very new on CakePHP.
> > > > I tried to do a blog using the CakePHP. I did it :).
> > > > but I found a problem:
> > > > when I want to use "$this->Session->setFlash("Write whatever");"
> >
> > > > it doesn't work.
> > > > I don't see the sentences that I write inside setFlash. They doesn't
> > > > occur when I run the code/functions.
> >
> > > > I am using the local server "WAMP"
> >
> > > > Can you please tell me what is the problem ?
> >
> > > > Regards,
> > > > Ahmed
> >
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> others with their CakePHP related questions.
> >
> > > > You received this message because you are subscribed to the Google
> Groups "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.comFor
> > > >  more options, visit this group athttp://
> groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: find('list') with conditions of joined tables? --psybear

2010-12-16 Thread Amit Badkas
Hi,

By default, find('list') sets recursion to -1. That's why you need to set
'recursive' => 0 in the options array, something like

$userProfile->find('list', array(
   'conditions' => array(
 'User.id' => $id
   ),
   'recursive' => 0
 ));

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 16, 2010 at 11:41 PM, psybear83  wrote:

> Hey everybody
>
> I want to use find('list') that uses conditions of joined tables. But
> it seems find('list') doesn't support that?
>
> Example: I have a model User which hasOne UserProfile.
>
> $userProfile->find('all', array(
>'conditions' => array(
>)
>  ));
>
> ...works like a charm, but...
>
> $userProfile->find('list', array(
>'conditions' => array(
>  'User.id' => $id
>)
>  ));
>
> ...tells me:
>
> SQL Error: 1054: Unknown column 'User.id' in 'where clause' [CORE/cake/
> libs/model/datasources/dbo_source.php, line 684]
>
> Query: SELECT `UserProfile`.`id` FROM `user_profiles` AS `UserProfile`
> WHERE `User`.`id` = 1102
>
> Evidently it doesn't join the hasOne table by itself... Is there a way
> to force it to do it anyway?
>
> Thank you
> Josh
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: how can i create a default selection

2010-12-15 Thread Amit Badkas
Hi,

For CakePHP-1.3, if you are using input() method then set 'empty' => 'Select
category' in 2nd parameter array, or do the same for 4th parameter of
select() method.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 16, 2010 at 10:43 AM, cake-learner  wrote:

> how i can insert the a little text on top of select form so that it
> goes
> Select category, cat1, cat2, cat3
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: flash vs redirect

2010-12-15 Thread Amit Badkas
Hi,

You need to return the control after calling flash() method in action,
something like

function my_action()
{
if ($this->data) {
// some code here

$this->flash(...);
return;
}

// remaining code here
}

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Thu, Dec 16, 2010 at 3:11 AM, bram  wrote:

> In the 1.3 book, the controller method flash is compared to the
> redirect method. It states that the only difference is the use of an
> intermediate page with your flash message, before the user gets
> redirected to a given url.
>
> When using the flash method, it looks like there is another
> significant difference in that it doesn't exit your script.
>
> Is this a documentation or an implementation bug? (or something else)
>
> B
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: setFlash

2010-12-14 Thread Amit Badkas
Hi,

Assuming that the flash message DIV has class 'message', you can write
something like following jQuery code

window.setTimeout('$(".message").fadeOut("slow")', 3000);

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Dec 15, 2010 at 1:17 AM, lvdb  wrote:

> Hello,
>
> I'am new to Cakephp. I have been doing the blog tutorial. In this
> tutorial there is a setFlash message after
> adding a new record. Is it possible to hide this message after 3
> seconds?
>
> thank ou in advance for your answer.
>
> Regards,
>
> Leo
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


  1   2   3   >