Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include a view in another view in cakephp

Tags:

cakephp

I have an add.ctp file, which will enable the user to add new entries, there is another view.ctp file which will list all the existing entries from the database. How would I include these existing entries within the add view page, So that user should be able to view the existing entries at the bottom of the page when he is making a new entry from add page?

Thanking you

like image 405
cake Avatar asked Nov 25 '25 00:11

cake


2 Answers

You could extract the view code you want to use in both views into an element.

like image 144
dhofstet Avatar answered Nov 28 '25 05:11

dhofstet


or load the view underneath through an ajax call when an entry is clicked.

like image 25
Harris Avatar answered Nov 28 '25 07:11

Harris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!