Single page controller for subpage, really can't figure it out, sorry.

Permalink
Hi,

I've tried every possible combination of controller folders and naming conventions, and all the examples i can find are single pages, with a single controller and 1 view.php thats full of ifs and switches.

What i got right now is 2 single pages who share a root 'region', so right now it shows:

Region
---------
IndexA
IndexB

I've added them, i can reach them, but i really got NO CLUE how to get the controllers working.

What i've tried:

controllers/dashboard/region/controller.php : function indexa()
controllers/dashboard/regionindexa/controller.php : function view()
controllers/dashboard/regionindexa/controller.php : function view()
controllers/dashboard/regionindexa.php : function view()

The interface obviously shows its possible, any1 know what im doing wrong? I really dont want everything in 1 view.php like the faq example

 
hutman replied on at Permalink Reply
hutman
Your controller structure should be hree seperate controllers one for each Region, IndexA and IndexB

So it would look like this in the file structure

Concrete 5.6

/controllers/dashboard/region/controller.php
/controllers/dashboard/region/indexa.php
/controllers/dashboard/region/indexb.php

Concrete 5.7

/application/controllers/single_page/dashboard/region.php
/application/controllers/single_page/dashboard/region/indexa.php
/application/controllers/single_page/dashboard/region/indexb.php
melat0nin replied on at Permalink Reply
melat0nin
Did you manage to fix this?

I'm having the same problem. I think there is a bug in 5.6 where the single page is located as a sub-page rather than directly underneath the homepage.
btnguden replied on at Permalink Reply
yes i did:

lets say you want this in the dashboard:

region
-------
viewa
viewb

/dashboard/region/viewa/

single_pages/dashboard/region/viewa.php (view)
controllers/dashboard/region/viewa.php and a function viewa() {} for the index

then a deeper action would simply mean another function in the same controller, or a controller in a deeper folder with a controller resembling that name and again the function with that same name.
melat0nin replied on at Permalink Reply
melat0nin
I still don't understand. Can you post your code please, or at least its outline?
melat0nin replied on at Permalink Reply
melat0nin
Did you manage to fix this?

I'm having the same problem. I think there is a bug in 5.6 where the single page is located as a sub-page rather than directly underneath the homepage.
iggypoop replied on at Permalink Reply
iggypoop
Hey dude,

I had the same problem and just figured it out. I looked at the controller names in the existing dashboard controllers and figured it out.

Here's my controller path
/controllers/dashboard/backend_stuff/investors/register.php
and my view path
/single_pages/dashboard/backend_stuff/investors/register.php

Now here's what made it start working for me.

I made a dashboard.php file in
/controllers/dashboard
<?php 
defined('C5_EXECUTE') or die(_("Access Denied."));
class Dashboard extends Controller {
      public function view() {
      }
}
?>

and I named the register controller class relevant to it's path
<?php 
defined('C5_EXECUTE') or die(_("Access Denied."));
class DashboardBackendStuffInvestorsRegisterController extends Controller {
}
?>


I'm now able to get view() in register controller to fire on page view and access the other function with $this->action(''); in the view.

I hope this helps.
It drove me crazy!