Tuesday, January 26, 2010

Re: Loop Issue Cakephp

Why are you using raw SQL?

I take a very hard stand on this. If you are using raw SQL then you
should stop using CakePHP, simple as that (There are exceptions to the
rule, but they are very few). By using raw SQL you are entirely
negating all the benefits using a framework like CakePHP gives you.

On Jan 26, 7:11 pm, alex <gen...@gmail.com> wrote:
> Yes I tried! it works!!...
> Thanks !
>
> On 26 Gen, 18:05, John Andersen <j.andersen...@gmail.com> wrote:
>
> > Did you try to reset the email fields?
>
> > I wanted to see that your index action didn't loop!
> > Enjoy,
> >    John
>
> > On Jan 26, 5:05 pm, alex <gen...@gmail.com> wrote:
>
> > > I notice that removing $this->flash(...) and writing only the code of
> > > redirecting $this->redirect('action'=>'index'); that pic isn't
> > > appeared again...
>
> > > my index function is that standard :
>
> > >         function index() {
> > >                 $this->Content->recursive = 0;
> > >                 $this->set('contents', $this->paginate());
> > >         }
>
> > > why ?
>
> > > On 26 Gen, 15:53, John Andersen <j.andersen...@gmail.com> wrote:
>
> > > > It is stated the CakePHP manual, that you have to reset the Email
> > > > fields using the reset method as specified in:
>
> > > >http://book.cakephp.org/view/270/Class-Attributes-and-Variables#Sendi...
>
> > > > Your final flash message invokes the action "index" in the current
> > > > controller. What is the content of that action?
> > > > Enjoy,
> > > >    John
>
> > > > On Jan 26, 3:34 pm, alex <gen...@gmail.com> wrote:
>
> > > > > Hi, I'm trying to develop a mailing list .... In the controller
> > > > > CONTENTS there's a function called sendMailingList
> > > > > [code]
> > > > >                 $list = $this->Content->query("SELECT * FROM mails WHERE sub =
> > > > > '1'");
> > > > >                 $data = $this->Content->find($id);
>
> > > > >                 $this->Email->smtpOptions = array(
> > > > >                   .....
> > > > >                 );
>
> > > > >                 foreach($list as $info){
> > > > >                     $this->Email->subject = 'Test';
> > > > >                     $this->Email->replyTo = 'no-re...@yyyy.it;
> > > > >                     $this->Email->from = 'xxx <x...@yyyy.it>';
>
> > > > >                         $this->Email->to = 'mailingl...@alexgenovese.it';
> > > > >                         $this->Email->delivery = 'smtp';
> > > > >                         $this->Email->template = 'html/default';
> > > > >                         $this->Email->sendAs = 'html';
> > > > >                         $this->Email->to = $info['mails']['mail'];
> > > > >                         $this->set('title', $data['Content']['titolo']);
> > > > >                         $this->set('content_for_layout', $data['Content']['descrizione']);
> > > > >                         $this->set('image', $data['Content']['link']);
> > > > >                         $this->set('mail', $this->Email->to);
> > > > >                         $this->Email->send();
> > > > >                 }
>
> > > > >                 $this->flash(__('Email sent', true), array
> > > > > ('action'=>'index'));
> > > > > [/code]
>
> > > > > it works for one email ( without foreach($list as $info){...} ), but
> > > > > when i trying to send with this method I see this nex pic...
>
> > > > >http://www.flickr.com/photos/davidale/4306633066/
>
> > > > > ...I wait your answers ....
>
> > > > > Thanks a lot!
> > > > > Alex.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: