CakePHP dynamic element -


I am trying to create a message-board type element in the KPHP app. This element will be displayed on all pages and views which use a special layout. I want to display all the messages in the model, then add a link when showing the form, then return to the updated message list submitted. All this without affecting the current view / page.

My message model / controller / index set up, with a message board element that requests index action, it works fine However, how do I return back to the original page / action? The link was clicked on I could not use $ the-> referer () because it will link with the add () verb;

I am using Ajax on this, and I use an AJAX layout.

Then you will be able to set up a full stack for processing it, and will be able to pass various things in the form of parameters in the controller functions.

Using Ajax, you will not have to worry about passing the Referrer Controller / Action pair by calling MessagesController and also using the Return to update the list. You can. Additionally the bonus is that you can switch layout only to your actual controllers, thus there is no additional code to write.

In your controller, you can check Ajax

  if ($ this-> params ['request']) {$ this- & gt; Layout ('Ajax'); $ Return data; } And {$ this- & gt; Set ('data', $ data); }  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -