Single page view and controller dont work fine
Permalink
I dont know how to connect the controller to the view. No error or something like this but the code dont work. I dont find any docs for this issue in Concrete 5.7
I start from very simple example:
Application/single_pages/example.php
Application/controllers/example.php
Last step i Add this single page succsefully inside C5 admin:
dashboard/pages/single/single_page_added
I start from very simple example:
Application/single_pages/example.php
<?php echo $myColor;
Application/controllers/example.php
<?php namespace Application\Controller\SinglePage; use Concrete\Core\Page\Controller\PageController; class ExampleController extends Controller { public function view(){ $color=red; $this->set('myColor',$color); } }
Last step i Add this single page succsefully inside C5 admin:
dashboard/pages/single/single_page_added
Ok thanks. This is not working but it seems the system dont know the controller even exist.
Example: Why i dont get any error with code like this?
Application/controllers/example.php
Example: Why i dont get any error with code like this?
Application/controllers/example.php
<?php ///bad code example namespaceeeeeee Application\Controller\SinglePageeeeeeeeeee; useeeeee PageControllerrrrrrrrr; clllllllllllllass Example extendssssss PageController { public function vieeeeeeeeeeeeeeeew(){ $color=red; $ttthis->set('myColor',$colorrrrrrrrr; } }
your controller should be in Application/controllers/single_page/example.php not Application/controllers/example.php (you forgot the single_page sub-folder
Thanks. This is was my problem, now its work.
How to delete forever unused single pages from this list?
/dashboard/pages/single
I delete some pages from site map and now i see this path:
/!trash/example
How to delete forever unused single pages from this list?
/dashboard/pages/single
I delete some pages from site map and now i see this path:
/!trash/example
empty the trash?
if you correct your code like below it should work:
1- you can simply reference "PageController" instead of the whole path (not an error, just better)
2- Your file is example.php so the class name should be Example, not ExampleController
3- the class should extend PageController, not Controller