0

I am face to a problem and I can not find a solution!!! may not enougn experience with CakePHP :o)

I created a setting pages (Controller+Model+view) On admin_edit action, I created a form to enter the parameter of the web site, as the site of name (to be display on the layout), the status (online or not), the id of the home page, ect.

I may be did it wrong but until I can not use variable on all element.

I tried Configure::write or Set('val',$val) but with both of them, I could not use it eighter on the layout or on a controller.

As I spent almost a day, I would like tp know if someone can provide me an exemple to create an array (or something else) to be able to use it's value, either on a layout, a controller, a view, an element or a compnent, or a Helper. But the main need, would be on a Controller, the layout and the view.

may thank for any tuto or exemples P.

pierrot10
  • 129
  • 4
  • 13

1 Answers1

2

Your question indicates that you need to get a basic understanding of how CakePHP works. To understand how a request is made, take a look at the picture in the section "CakePHP request cycle" in this link: http://book.cakephp.org/2.0/en/cakephp-overview/understanding-model-view-controller.html As you can see, Controller asks Model for data, then sets that data to the View. The View can never send data back to the Controller - that would be a new request.

To understand the use of layouts,elements and how to set variables in views, see the cookbooks description of Views: http://book.cakephp.org/2.0/en/views.html

And of course follow the blog tutorial is a good thing to get a grip of the basic concepts.

Peter
  • 21
  • 2