Thursday, February 5, 2015

Re: Cake v2.x -- Looking to return rendered view to the Controller

It looks like `Controller::render()` sets the body on the CakeResponse object and then returns the CakeResponse object: http://api.cakephp.org/2.6/source-class-Controller.html#922-962. I would imagine you could access the rendered view like so:
    public function test()
    {
       
$this->render('/Emails/html/test', false);
        $emailBody
= $this->response->body;
        // Do what you want with $emailBody here
   
}



On Wednesday, February 4, 2015 at 5:33:35 PM UTC-5, BrendonKoz wrote:
For various reasons I had decided to use a 3rd party email library within my current CakePHP project. I thought that it might be nice to use CakePHP's Views to create templating for my emails and take advantage of layouts too. Unfortunately I'm stumped on just how to retrieve the rendered output of a view back to the Controller method.

I've tried the following:

    public function test() {
        $this
->layout = false;
       
#$this->view = '/Emails/html/test.ctp';
        $var
= $this->render('/Emails/html/test', false);
        pr
($var->_body); die();
   
}

$var->_body is protected (as denoted by the underscore). I saw no other property within the $var variable that contained the "body" code within my (template) view.

Are there any ways to do this that I'm just not seeing? If so, can I safely presume that layouts would be handled in a similar fashion?

Thank you for any possible help...

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Re: CakePHP 2.6 Controllers with New Folder Structure

Please always reply to the group - I seldom checks my mailbox :)

I looked in the CakePHP book and it did not show any examples of passing all the different paths for different classes, so lets try this:

App::build(array('Model' => array(APP . 'Model' . DS, APP . 'Model' . DS . 'Customers' . DS, APP . 'Model' . DS. 'Products' . DS)));
App::build(array('Controller' => array(APP . 'Controller' . DS, APP. 'Controller' . DS. 'Customers' . DS, APP . 'Controller' . DS . 'Products' . DS)));

and so on. That should set it up with the full path as the book says it needs. Please try and report back :)
Enjoy, John


On 5 February 2015 at 21:15, Shiv Modi <shiv...@gmail.com> wrote:
Hi John,

I tried that one as well but not getting desired results.

Regards,
Shiv

On Thursday, 5 February 2015 20:05:01 UTC+2, John Andersen wrote:
You are trying to create an array that contains two entries with the same index - only the last entry with the same index will be used.

Change your array to look like this - showing only the Model entry as an example:
'Model' => array('/Model/', '/Model/Customers/', '/Model/Products/'),

Do the same for Controller and View entries.

Enjoy, John

On Thursday, 5 February 2015 12:24:41 UTC+2, Shiv Modi wrote:
Hi,

I am using CakePHP 2.6 and want to make two sub-folders, Products and Customers in app/Controller , Model and View folders. So that I can categories my product and customer controllers for proper understanding. To implement and access the same I done some changes in bootstrap as follow:

App::build(array(
      'Model'                     => array('/Model/', '/Model/Products/'),
     
      'Controller'                => array('/Controller/', '/Controller/Products/'),
     
      'View'                      => array('/View/', '/View/Products/'),
  
  ));

It worked well.

But when i tried to add the entries for Customers controllers also it will get overwritten by the other one: 

App::build(array(
      'Model'                     => array('/Model/', '/Model/Customers/'),
      'Model'                     => array('/Model/', '/Model/Products/'),
      'Controller'                => array('/Controller/', '/Controller/Customers/'),
      'Controller'                => array('/Controller/', '/Controller/Products/'),
      'View'                      => array('/View/', '/View/Customers/'),
      'View'                      => array('/View/', '/View/Products/'),
  
  ));

It's not working proper. Only Products section is working fine not Customers one because keys are same and it's getting overwritten. How I can fix this problem?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Re: CakePHP 2.6 Controllers with New Folder Structure

You are trying to create an array that contains two entries with the same index - only the last entry with the same index will be used.

Change your array to look like this - showing only the Model entry as an example:
'Model' => array('/Model/', '/Model/Customers/', '/Model/Products/'),

Do the same for Controller and View entries.

Enjoy, John

On Thursday, 5 February 2015 12:24:41 UTC+2, Shiv Modi wrote:
Hi,

I am using CakePHP 2.6 and want to make two sub-folders, Products and Customers in app/Controller , Model and View folders. So that I can categories my product and customer controllers for proper understanding. To implement and access the same I done some changes in bootstrap as follow:

App::build(array(
      'Model'                     => array('/Model/', '/Model/Products/'),
     
      'Controller'                => array('/Controller/', '/Controller/Products/'),
     
      'View'                      => array('/View/', '/View/Products/'),
  
  ));

It worked well.

But when i tried to add the entries for Customers controllers also it will get overwritten by the other one: 

App::build(array(
      'Model'                     => array('/Model/', '/Model/Customers/'),
      'Model'                     => array('/Model/', '/Model/Products/'),
      'Controller'                => array('/Controller/', '/Controller/Customers/'),
      'Controller'                => array('/Controller/', '/Controller/Products/'),
      'View'                      => array('/View/', '/View/Customers/'),
      'View'                      => array('/View/', '/View/Products/'),
  
  ));

It's not working proper. Only Products section is working fine not Customers one because keys are same and it's getting overwritten. How I can fix this problem?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Re: 3.0 change order by a weight column

Thanks Dieter!

On Thursday, February 5, 2015 at 9:45:30 AM UTC-4:30, Dieter Gribnitz wrote:
Thanks,
I will create a behavior to handle this.
Didn't want to create it if it already existed.
Will share it on github when I am done.


On Thursday, February 5, 2015 at 3:08:53 PM UTC+2, José Lorenzo wrote:
That sounds like the ListBehavior. This is a version of it for cake 2 https://github.com/CakeDC/utils/blob/master/Model/Behavior/ListBehavior.php

It will need to be updated for the new ORM

On Thursday, February 5, 2015 at 4:55:20 AM UTC-4:30, Dieter Gribnitz wrote:
Are there any built in behaviors to deal with reordering entries by a weight column?

Lets say I want to move an entry from 5 to 3.
3 should update to a weight key of 4 and 4 should update to a weight key of 5

In addition, how do you set the default field to witch results should be sorted by.

Scanned through the docs and could not find anything relating to this.
Any links to relevant documentation on this matter would be greatly helpful.


Thanks.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Re: 3.0 change order by a weight column

Thanks,
I will create a behavior to handle this.
Didn't want to create it if it already existed.
Will share it on github when I am done.


On Thursday, February 5, 2015 at 3:08:53 PM UTC+2, José Lorenzo wrote:
That sounds like the ListBehavior. This is a version of it for cake 2 https://github.com/CakeDC/utils/blob/master/Model/Behavior/ListBehavior.php

It will need to be updated for the new ORM

On Thursday, February 5, 2015 at 4:55:20 AM UTC-4:30, Dieter Gribnitz wrote:
Are there any built in behaviors to deal with reordering entries by a weight column?

Lets say I want to move an entry from 5 to 3.
3 should update to a weight key of 4 and 4 should update to a weight key of 5

In addition, how do you set the default field to witch results should be sorted by.

Scanned through the docs and could not find anything relating to this.
Any links to relevant documentation on this matter would be greatly helpful.


Thanks.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

Re: 3.0 change order by a weight column

That sounds like the ListBehavior. This is a version of it for cake 2 https://github.com/CakeDC/utils/blob/master/Model/Behavior/ListBehavior.php

It will need to be updated for the new ORM

On Thursday, February 5, 2015 at 4:55:20 AM UTC-4:30, Dieter Gribnitz wrote:
Are there any built in behaviors to deal with reordering entries by a weight column?

Lets say I want to move an entry from 5 to 3.
3 should update to a weight key of 4 and 4 should update to a weight key of 5

In addition, how do you set the default field to witch results should be sorted by.

Scanned through the docs and could not find anything relating to this.
Any links to relevant documentation on this matter would be greatly helpful.


Thanks.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

PAGINATION


as I do to separate pages for a particular word (XXXX) so every time aparececer the words (XXXX) break the page automatically and save the database ... using the paging cakephp

--

como eu faço para separar páginas para uma determinada palavra (XXXX) para que cada vez aparececer as palavras (XXXX) quebram a página automaticamente e salvar o banco de dados ... usando o cakephp paginação

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.