Dashboard Controller/View
Permalink 1 user found helpful
So I have made a dashboard Single Page under:
/application/single_pages/dashboard/newsletter.php
and a view.php in the same folder
And a Controller under:
/application/controllers/single_pages/dashboard/newsletter.php
The Controller looks like:
The /application/single_pages/dashboard/newsletter.php looks like:
The /application/single_pages/dashboard/view.php looks like:
THE PROBLEM:
The doesn't show up in the view. The is showing, so basically the page is up and running.
What am I doing wrong?
Update:
Even when creating a package out of it, it doesn't work
/application/single_pages/dashboard/newsletter.php
and a view.php in the same folder
And a Controller under:
/application/controllers/single_pages/dashboard/newsletter.php
The Controller looks like:
<?php namespace Concrete\Controller\SinglePage\Dashboard; use Concrete\Core\Multilingual\Page\PageList; use \Concrete\Core\Page\Controller\DashboardPageController; class Newsletter extends DashboardPageController { public function view() { $testVar = array( 'one' => 'some', 'two' => 'value', 'three' => 'foo', 'four' => 'bar' ); $this->set('test', $testVar); } }
The /application/single_pages/dashboard/newsletter.php looks like:
The /application/single_pages/dashboard/view.php looks like:
THE PROBLEM:
The
$test
echo 'something';
What am I doing wrong?
Update:
Even when creating a package out of it, it doesn't work
Thx for Replying.
I wrapped everything up in a package now because somewhere in the forums or docs (don't find it anymore ;-() Andrew Embler sais that's a bug in the version 5.7.3.x and one should wrap it all up in a package. The package installs without errors, but stiil the same. Here are the new pathes & namespaces:
Controller-Path:
Controller:
I wrapped everything up in a package now because somewhere in the forums or docs (don't find it anymore ;-() Andrew Embler sais that's a bug in the version 5.7.3.x and one should wrap it all up in a package. The package installs without errors, but stiil the same. Here are the new pathes & namespaces:
Controller-Path:
/packages/daniel_gasser_com_news_letter/controllers/single_pages/dashboard/newsletter.php
Controller:
namespace Concrete\Package\DanielGasserComNewsLetter\SinglePage\Dashboard use \Concrete\Core\Page\Controller\DashboardPageController; class Newsletter extends DashboardPageController { public function view() { $testVar = array( 'one' => 'some', 'two' => 'value', 'three' => 'foo', 'four' => 'bar' ); $this->set('test', $testVar); } }
Sorry, but I decided to test it, and you are totally right. It does not seem to work. But I am quite sure that the namespace should start with Application.
I will think about this and come back if I find the answer!
I will think about this and come back if I find the answer!
In your controller path you have "single_pages" I believe it should be "single_page"
Sent from my iPhone
> On Apr 25, 2015, at 11:05 AM, concrete5 Community <discussions@concretecms.com> wrote:
Sent from my iPhone
> On Apr 25, 2015, at 11:05 AM, concrete5 Community <discussions@concretecms.com> wrote:
Thank you for pointing at. I saw that one too last night, but still the same.
also I installed the package on a fresh & clean c5 installation, but still the same...
I attached the package, maybe someone sees the issue, because I really don't get it.
also I installed the package on a fresh & clean c5 installation, but still the same...
I attached the package, maybe someone sees the issue, because I really don't get it.
The problem is that you have added a single page for the URL 'dashboard/newsletter' but your controller class is named NewsLetter.
A class of NewsLetter (note the camel-case) would correlate to a URL of 'dashboard/news_letter'.
So if you want the URL to remain 'dashboard/newsletter', rename your controller class to Newsletter (title-case), and the controller filename to newsletter.php.
Otherwise if you want the URL to be 'dashboard/news_letter', change the single page setup in your package controller to
and change your single page file to news_letter.php
Uninstall and reinstall your package after you have made your changes.
A class of NewsLetter (note the camel-case) would correlate to a URL of 'dashboard/news_letter'.
So if you want the URL to remain 'dashboard/newsletter', rename your controller class to Newsletter (title-case), and the controller filename to newsletter.php.
Otherwise if you want the URL to be 'dashboard/news_letter', change the single page setup in your package controller to
SinglePage::add('dashboard/news_letter', $pkg);
Uninstall and reinstall your package after you have made your changes.
Thanks Andrew - you are right.
Here is the paths:
For the controller:
/application/controllers/single_page/dashboard/newsletter.php
And the code for the controller:
The path for the single page:
/application/single_pages/dashboard/newsletter.php
And the code for the single page:
It's tested and works as it should
Here is the paths:
For the controller:
/application/controllers/single_page/dashboard/newsletter.php
And the code for the controller:
<?php namespace Application\Controller\SinglePage\Dashboard; use Concrete\Core\Page\Controller\DashboardPageController; class Newsletter extends DashboardPageController { public function view() { $testVar = array( 'one' => 'some', 'two' => 'value', 'three' => 'foo', 'four' => 'bar' ); $this->set('test', $testVar); } }
The path for the single page:
/application/single_pages/dashboard/newsletter.php
And the code for the single page:
It's tested and works as it should
Just to mention...
My solution is for the initial question...To get it to work under "/application"
And to remove the doubt that there is a bug in concrete5 5.7. This is tested in version 5.7.3.1 and 5.7.4RC2
Have a nice Sunday...
My solution is for the initial question...To get it to work under "/application"
And to remove the doubt that there is a bug in concrete5 5.7. This is tested in version 5.7.3.1 and 5.7.4RC2
Have a nice Sunday...
maar, Thank you too!
As there were several issues, I'm not sure now which answer to mark as best... I hope you're not offended that I marked goodnightfirefly's answer as the one.
I wish you a pleasent Sunday too!
As there were several issues, I'm not sure now which answer to mark as best... I hope you're not offended that I marked goodnightfirefly's answer as the one.
I wish you a pleasent Sunday too!
THANK YOU!!
goodnightfirefly, you're the chief, I knew it must be something ridiculous....
For others struggling with that. Ther were several issues.
Conclusion:
1. The controller path for this kind of thing is 'single_page' not 'single_pages' (for the single page itself it must be 'single_pages' though)
2. If the controller file has a 'snake_case_name' the class must have a 'CamelCaseName'
3. In that case the single page url must also be snake_case_name then
goodnightfirefly, you're the chief, I knew it must be something ridiculous....
For others struggling with that. Ther were several issues.
Conclusion:
1. The controller path for this kind of thing is 'single_page' not 'single_pages' (for the single page itself it must be 'single_pages' though)
2. If the controller file has a 'snake_case_name' the class must have a 'CamelCaseName'
3. In that case the single page url must also be snake_case_name then
Update:
Yes you're right: the namespace was wrong!
Uninstalling the package and adding a dashboard single page as I did in the first try, but this time with your suggestion of the namespace did not do the trick either!
I don't get it!
Isn't c5 complaining if the namespace is wrong?
And, echoing something is working, so why this does happen?
BTW: The namespace was wrong again. Instead of it should be but still no luck.
Yes you're right: the namespace was wrong!
Uninstalling the package and adding a dashboard single page as I did in the first try, but this time with your suggestion of the namespace did not do the trick either!
I don't get it!
Isn't c5 complaining if the namespace is wrong?
And, echoing something is working, so why this does happen?
BTW: The namespace was wrong again. Instead of
namespace Concrete\Package\DanielGasserComNewsLetter\SinglePage\Dashboard
namespace Concrete\Package\DanielGasserComNewsLetter\Controller\SinglePage\Dashboard
I just had a short discussion about this with one of my colleagues. And we just tried a few things with no luck. I think I have to sleep on this, might be better to wrap this around my head tomorrow.
Yes, that's what I decided too!
I'll go for a walk now... tomorrow is another day
Thx again for the help.
I'll go for a walk now... tomorrow is another day
Thx again for the help.
namespace Concrete\Controller\SinglePage\Dashboard;
If I'm not totally wrong and because I see that your path for your files is /application, I think that the namespace should be:
namespace Application\Controller\SinglePage\Dashboard;
I'm struggling with namespaces my selves at the moment, and it seem that I am beginning to understand.