Single Page Controller in package not recognized
Permalink 1 user found helpful
Hi everybody!
I've got a little problem with single pages in a package. It is no problem to install the single page. And it is possible to browse to the page.
But the controller is not recognized by concrete5.
My environment:
Package XYZ (Folder)
-- single_pages (Folder)
---- newsletter (Folder)
------ view.php (File)
-- controller (Folder)
---- single_pages (Folder)
------newsletter.php (File for controller)
controller.php
view.php
The installation is done via an install.xml-file.
I've got a little problem with single pages in a package. It is no problem to install the single page. And it is possible to browse to the page.
But the controller is not recognized by concrete5.
My environment:
Package XYZ (Folder)
-- single_pages (Folder)
---- newsletter (Folder)
------ view.php (File)
-- controller (Folder)
---- single_pages (Folder)
------newsletter.php (File for controller)
controller.php
view.php
The installation is done via an install.xml-file.
So, it took a long time but I was able now to try your suggestion. But without any success.
Please find a structure of my package directory.
controller.php (nak_newsletter)
newsletter.php (nak_newsletter/controller/single_page/)
I've got the, when installing, the following error message: "Class 'Concrete\Package\NakNewsletter\SinglePage' not found"
I do not know where my mistake is.
I've used the documentation of concrete5 as template.
I tried it with different cominations but without any positive result.
Please find a structure of my package directory.
controller.php (nak_newsletter)
<?php namespace Concrete\Package\NakNewsletter; use Package; defined('C5_EXECUTE') or die('Access Denied.'); class Controller extends Package { protected $pkgHandle = 'nak_newsletter'; protected $appVersionRequired = '5.7.1'; protected $pkgVersion = '0.0.1'; public function getPackageName() { return t("NAK Newsletter"); } public function getPackageDescription() {
Viewing 15 lines of 36 lines. View entire code block.
newsletter.php (nak_newsletter/controller/single_page/)
<?php namespace Concrete\Package\NakNewsletter\Controller\SinglePage; defined('C5_EXECUTE') or die('Access Denied.'); use Concrete\Core\Page\Controller\PageController; class Newsletter extends PageController { public function on_start() { } public function on_before_render() { } public function view() { $this->set('first','value');
Viewing 15 lines of 41 lines. View entire code block.
I've got the, when installing, the following error message: "Class 'Concrete\Package\NakNewsletter\SinglePage' not found"
I do not know where my mistake is.
I've used the documentation of concrete5 as template.
I tried it with different cominations but without any positive result.
nak_newsletter/controller/single_page/ should be
nak_newsletter/controllers/single_page/
nak_newsletter/controllers/single_page/
Thanks for your reply but i does not fixed the problem. The problem is still the same.
I renamed the sub dir "controller" to "controllers". I also have taken a look into the single pages dir of the concrete dir, and in the controllers dir of the concrete dir to have a template. But it didn't helped me!
I renamed the sub dir "controller" to "controllers". I also have taken a look into the single pages dir of the concrete dir, and in the controllers dir of the concrete dir to have a template. But it didn't helped me!
I got a positive result using a xml-file as installation resource.
After correcting my stupid "s"-mistake, the controller is recognized. The value set in the view function is called and displayed in the file that renders the content.
Many thanks for your help!!!!!!!
After correcting my stupid "s"-mistake, the controller is recognized. The value set in the view function is called and displayed in the file that renders the content.
Many thanks for your help!!!!!!!
You are welcome.
Note without the "S".
When I create a single page I install it via the package controller like this
You can find the documentation here:
https://www.concrete5.org/documentation/developers/5.7/working-with-...