Thursday, October 3, 2013

noobie- help with cake blog tutorial - Error PostsController could not be found

I am running WAMP server on my windows 8 laptop.
I have cake installed and the test screen shows up as OK.
There is more detail on that on my personal blog here

I am trying to follow the blog tutorial from the cake web site
here:
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html

The problem I get is that when I try

http://localhost/cake_2_0/posts/index  
I get and get a page full of errors (see below)
Error: PostsController could not be found.
Error: Create the class PostsController below in file: app\controller\PostsController.php


I believe that I have followed the tutorial accurately.  Again I have documented it step by step on my blog.
Here:
http://frankstech.blogspot.com.au/2013/10/cakephp-blog-tutorial.html

Any suggestions on what I can do to track this issue down.

Thanks in advance.
Frank

--
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/groups/opt_out.

Re: Accessing things in $this->request->data

Hello, 

When your used action add, after Item->save, the Model is updated the  $this->Item->id, with the last id inserted.

Try

 $this->Item->id

I think, the Model is updated after your save.

Regards


2013/10/3 Paul Willis <paul.willis@me.com>
In my ItemsController I'm editing an item and then want to redirect back to the category that the item is in but I'm not sure how to access the category_id that is in $this->request->data

My controller function (edited down to the relevant lines only) is...


        public function admin_edit($id = null) {
                if ($this->request->is('post') || $this->request->is('put')) {
                        if ($this-> Item->save($this->request->data)) {
                                $this->Session->setFlash(__('The Item has been saved'));
                                $this->redirect(array('controller' => 'categories', 'action' => 'view', *********));
                        }
                }
        }


Where I have ******* I need something like…

$this->request-> Item->category_id

...to pull the category_id out but I can't get the correct syntax to use

The category_id is in there as it is being saved with all the other item data.

I'm on CakePHP 2.3.x if that is relevant.

Regards

Paul

--
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/groups/opt_out.



--
***Se você pretende redirecionar este e-mail, por favor, apague todos os endereços que aparecem nele. Outra dica de segurança é endereçá-lo no Cco. Desta forma você estará protegendo a mim, seus amigos e a você mesmo. Eu e a Campanha Contra o SPAM agradecemos.Não envie correntes.***

--
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/groups/opt_out.

Accessing things in $this->request->data

In my ItemsController I'm editing an item and then want to redirect back to the category that the item is in but I'm not sure how to access the category_id that is in $this->request->data

My controller function (edited down to the relevant lines only) is...


public function admin_edit($id = null) {
if ($this->request->is('post') || $this->request->is('put')) {
if ($this-> Item->save($this->request->data)) {
$this->Session->setFlash(__('The Item has been saved'));
$this->redirect(array('controller' => 'categories', 'action' => 'view', *********));
}
}
}


Where I have ******* I need something like…

$this->request-> Item->category_id

...to pull the category_id out but I can't get the correct syntax to use

The category_id is in there as it is being saved with all the other item data.

I'm on CakePHP 2.3.x if that is relevant.

Regards

Paul

--
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/groups/opt_out.

Re: Upload Plugin 2.0

If it helps I can tell you how I do it using the Uploader plugin. 

In the model using Uploader create a  function to generate the new name for you.

public function generateFilename(){
        
        return md5(rand(0000, 9999)); 
    }

In the model using the Uploader attachment behavior attach the new name to uploaded file by referencing your function.

public $actsAs = array( 
    'Uploader.Attachment' => array(
        'fileName' => array(
            'name'      => 'generateFilename'

In the metaColumns section of the behavior make sure you map the name to the correct database field.

'metaColumns'   => array(      
                'name' => 'name'

That's it. I'm using an older version of Uploader. Pay attention to what version you are using because things are slightly different in the newest version but the end result is exactly the same. 

HTH

On Wednesday, October 2, 2013 1:17:45 PM UTC-4, Hugo Fabricio wrote:
How to rename the name of a file to send by Upload plugin 2.0?

grateful

--
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/groups/opt_out.

Bake doesn't work

When I go to the app directory using the terminal and type *cake bake* ,
nothing happens other than a 'command not found' error. I tried going to the
Console directory. This did not work.

I'm using MAMP on Snow Leopard .



--
View this message in context: http://cakephp.1045679.n5.nabble.com/Bake-doesn-t-work-tp5716768.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
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/groups/opt_out.

Wednesday, October 2, 2013

Duplicate records in database

Hi,
I have application written in cakephp 1.3. I'm experiencing this wired
situation where by some tables are populated with dummy data without user
action. I mean to say, data is been automatically inserted to few tables
like posts, reviews table through there hasn't been action to add the data.
Every day I could see like more than 1k records being inserted with all
empty values.

Is anybody experiencing this wired issue?

:-) would appreciate if your suggestions

Thank you



--
View this message in context: http://cakephp.1045679.n5.nabble.com/Duplicate-records-in-database-tp5716767.html
Sent from the CakePHP mailing list archive at Nabble.com.

--
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/groups/opt_out.

Re: Paginator and multilingual routes

You would need something else to differentiate the language used for the reverse routing.

Router::connect('/blog/search/*', array('controller' => 'blog_categories', 'action' => 'search', 'lang' => 'en'));
Router::connect('/blog/suche/*', array('controller' => 'blog_categories', 'action' => 'search', 'lang' => 'de'));

That's just a really rough stab at the kind of thing you would need to do.  Whether or not you can actually have lang in there (perhaps as a registered segment), is something you'd need to work out.

Regards
Reuben Helms

On Wednesday, 2 October 2013 21:13:35 UTC+10, Anna P wrote:
Hello.

I have a problem with paginator helper.

I'm developing an app in 2 language versions.

The app conatains among others blog, which is paginated.

Now, the url's in routes.php look for exmaple like this:

Router::connect('/blog/search/*', array('controller' => 'blog_categories', 'action' => 'search'));
Router::connect('/blog/suche/*', array('controller' => 'blog_categories', 'action' => 'search'));

This is the route for blog search option.

Now, when I'm on a blog search results page, and I'm on the English version of website - everything works fine.
The URLs of pages look like "/blog/search/2", "/blog/search/3" etc.

But when I switch to German version, the paginator URLs are the same... and I want them to also be "translated" and look like: "/blog/suche/2", "/blog/suche/3", etc.

I guess it is because the '/blog/search/*' is defined first. When I remove that line from routes.php - the "/blog/suche/" links are in pagination.

How to fix this? In such way that in the german version, paginated links will also be german?

Regards and many thanks for help.
Anna

--
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/groups/opt_out.