Single page controller not working

Permalink 1 user found helpful
Hi,
I need some help in new version of concrete5.

I have create simple single page on front end
but after creating controller for single page it not working.

When i call method of controller it show page not found .
I have created :
/application/single_pages/media.php
and
application/controllers/single_pages/media.php

Please help me out .
I also try to find any solution but not get any help.

rishabht
View Replies: View Best Answer
daenu replied on at Permalink Reply
daenu
Hi
The path for the single page is
/application/single_pages/media.php

The path for the controller is
/application/controllers/single_page/media.php

*For the controller, the folder name "single_page" has to be singular. *

The namespace for the controller is
namespace Application\Controller\SinglePage
rishabht replied on at Permalink Reply
rishabht
Yes, this is the code i used on files
<?php
namespace Application\Controller\SinglePage;
use \PageController;
class Media extends PageController
{
    public function view() {
        $selectedtitle = 'Test';
        $this->set('selectedtitle', $selectedtitle);
    }
}


But still not working when i print variable on view page
daenu replied on at Permalink Reply
daenu
Can you post the pathes of the page and the controller?
rishabht replied on at Permalink Reply
rishabht
path already mention on first question
The path for the controller is
/application/controllers/single_pages/media.php


/application/single_pages/media.php
daenu replied on at Permalink Best Answer Reply
daenu
As said in my Post, the path for the controller is:
/application/controllers/single_page/media.php
"single_page" not "single_pages"
rishabht replied on at Permalink Reply
rishabht
Got it !!!
Thanks Daenu

also please can you tell me how i become good developer in concrete5
Any link or way we will learn easliy
rishabht replied on at Permalink Reply
rishabht
And i have used code on view page
<?php 
defined('C5_EXECUTE') or die("Access Denied.");
echo '<h3>Hello This My single page </h3>';
 echo $selectedtitle; 
?>
daenu replied on at Permalink Reply
daenu
still not working? Do you see the single page in the Single Pages section of the dashboard?
Did you create the Single Page in the dashboard after creating the file?

Because when I reproduce your code it works
rishabht replied on at Permalink Reply
rishabht
Yes working

Thanks Daenu

also please can you tell me how i become good developer in concrete5
Any link or way we will learn easliy
daenu replied on at Permalink Reply
daenu
Cool Glad I could help.
Do you know MVC Programming?
c5 5.7 is based on the Laravel Framework, so it's good to know about. Unfortunately the developer docs aren't complete as the time of writing this, but there is already some docs to start with.http://documentation.concrete5.org/developers...