How do I change the layout used in a plugin?


#1

Just started with plugins trying out the cakedc/users plugin. I was able to override the views by adding files to the correct path in template.

Now how do i change the layout used by the plugin controller? It used the default.ctp layout. Do i have to extend it or is there an easier way?


#2

nevermind i figured it out, you can just set it in the view $this->layout -

now how do i delete this question…


#3

You don’t, you leave it here so others with the same problem can see how you fixed it! Thanks for coming back and telling us btw. :slight_smile:

I don’t suppose you’ve any experience changing the URL CakeDC uses do you? Just now mine keeps directing to http://mysite.com/users/users/login where I’d really prefer it to just be /users/login or even just /login. A bit stumped on how to do so.

EDIT - Nevermind, was me being daft. I’d hardcoded the users/users part in my templates and static pages until I learnt how to do it properly, now that I do I had updated in the templates but forgot about the static pages.

Now to work out why the rest of my links are ending up with /users/ added in there (http://mysite.com/users/actual_page/ instead of http://mysite.com/actual_page/) when on the login page!

EDIT 2 - Because I wasn’t using ‘_full’ => true and I don’t have any other locations on the site that have subpages (it just looks like it but it is of course action calls). Man, it’s amazing how much just typing up the issue you are having helps you to go solve it.