Single Page Controller not firing...

Permalink
single page located here:
application/single_pages/responsive_video/view.php
controller located here:
application/controllers/responsive_video/controller.php

Controller file:
<?php
class responsiveVideoController extends Controller {
  public function view() {
    $this->set('test', 'The controller is linked.');
  }
}


Single page:
<span>Result: <?php echo $test; ?></span>



No dice. Tried naming the single page something like "test.php" and the controller to match but nothing.

Any help is greatly appreciated.

Thanks.

binomonkey
View Replies: View Best Answer
binomonkey replied on at Permalink Reply
binomonkey
and yes, I did change the code in the controller proper camel case and still not working...
<?php
class ResponsiveVideoController extends Controller {
  public function view() {
    $this->set('test', 'The controller is linked.');
  }
}
hutman replied on at Permalink Reply
hutman
You're going to want the controller structure to be this instead

application/controllers/single_page/responsive_video.php

You also might need to refresh the Single Page and Clear Cache for it to get hit.
binomonkey replied on at Permalink Reply
binomonkey
hey thanks for the reply hutman. You know I did try this as I was looking into the /concrete folder structure to see how the controllers were done there and saw this /single_page folder so I did try this with variations like this:
/controllers/single_page/responsive_video/controller.php,
/controllers/single_page/responsive_video/responsive_video.php,
/controllers/responsive_video/controller.php,
/controllers/responsive_video/responsive_video.php
Inside of the controller that extends controller I also went through the gambit of names as well.
Page caching is turned off for the single page and I did manually delete cash.
Cashing is all off for dev too.
Also "refreshed the single_page from the dashboard and still nothing.

Further reading, I saw some documentation that says controllers now need namespacing... however I don't think that is needed for a simple single_page/controller setup.

I have advanced permissions set to "on" and that is just about the only change I have made besides copying the theme and making a few edits in the "page_theme.php" file to make it work.

Further thoughts?
hutman replied on at Permalink Reply
hutman
I think this post will help you out, they have exactly how this page should be setup listed in the answer to the original question.

http://www.concrete5.org/community/forums/customizing_c5/5.7-single...
binomonkey replied on at Permalink Reply
binomonkey
thanks for the link there.
You know it did help me out somewhat as I further researched "namespacing"
However, I get an exception every time I try to use it:
Whoops\Exception\ErrorException thrown with message "Class 'Application\Controller\SinglePage\Controller' not found"

&
Whoops \ Exception \ ErrorException (E_ERROR) 
Class 'Application\Controller\SinglePage\PageController' not found

..this second error happens when I try to extend "PageController" instead of "Controller". I honestly don't know what the difference is there.
Also to note, both in the Concrete and Application directory the folder is "Controllers" and not "Controller" but it seems the namespacing even in the Concrete root is "Concrete\Controller" and not "Concrete\Controllers"
...so, all in all this is sort of not as logical as I thought it would be and I'm not really sure how to debug. To note, I used to use controllers all the time in the 5.6 and earlier releases of Concrete5. I'm too stubborn to move on from this seemingly easy problem..
hutman replied on at Permalink Best Answer Reply
hutman
Do you have all of these elements as part of your controller?

namespace Application\Controller\SinglePage;
use PageController;
class ResponsiveVideo extends PageController {
binomonkey replied on at Permalink Reply
binomonkey
Thanks so much as it worked. I had put use Page in there and must not have switched the extension. Again, thanks for your continuing support.
Cheers
ntisithoj replied on at Permalink Reply
ntisithoj
this is a related answer, and new problems, with the same issue you posted here

http://www.concrete5.org/community/forums/5-7-discussion/5.7-contro...