Issue
I am working on a CakePHP3 project. I want a static homepage
that will be loaded on www.mysite.com
.
For this I have created a PagesController
which will handle all the static pages in the website like about
,contact
,etc.
I am having display.ctp
view in Template/Pages/display.ctp
to load on www.mysite.com
.
But, for testing (routes are not configured yet), I'm using www.mysite.com/pages
and www.mysite.com/pages/display
to show the view but it gives error as
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mysite.pages' doesn't exist
Do I need to create Table
for this ?
Solution
It is much, much easier than that
For this I have created a PagesController
There is already a pages controller for serving static content, and a static template for the home page, there is no need to create/overwrite the default pages controller, to replace it with the same (or less) functionality. This is also mentioned in the documentation
The steps to modify static pages (with default routes) are:
- edit
src/Template/Pages/home.ctp
- look at the url/
- create/edit
src/Template/Pages/something.ctp
- look at the url/pages/something
Answered By - AD7six
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.