How to Namespace when Hyphens are in the path

Hi guys and girls,

I'm building a front-end Single Page within a Package that needs to sit underneath an exisiting page whose slug name contains a hyphen. Running Concrete5

So I have index.php/get-involved/ and I need a Single Page from an 'Events' Package to display as index.php/get-involved/events

I have the view.php up and working, but the Single Page can't seem to locate the Controller, possibly because the namespacing is wrong?

Current namespacing:
namespace Concrete\Package\Events\Controller\SinglePage\GetInvolved

I've tried camel case, which as I understand it automatically adds underscores?

How do I wire up the controller's namespacing to account for the page's position beneath a URL that includes a hyphen?

Current directories:
Controller: packages/events/controllers/single_page/get-involved/events.php
View: packages/events/single_pages/get-involved/events.php

(I have tried Controller: packages/events/controllers/single_page/get_involved/events.php also...)

Many thanks for your help!

View Replies: View Best Answer
jshannon replied on at Permalink Best Answer Reply
I had this problem when migrating a single page from 5.6 to 5.7. I could have sworn I filed a bug with exactly what I found (code-wise), but I can't find it.

It sounds like you've done everything I'd recommend. Maybe I'm missing something that you've described, though, so he's what works for me:

URL is /membership-checkout/session
Single page is: single_pages/membership-checkout/session.php
Controller is: controllers/single_page/membership_checkout/session.php

namespace Concrete\Package\LertecoMembership\Controller\SinglePage\MembershipCheckout;
class Session extends ... {
goldfox replied on at Permalink Reply
Turns out the namespacing wasn't the problem, but thanks! Of the three or four possibilities for how to manage namespacing hyphenated pages, your reply has confirmed the one method that definitely works. Thank you!
MichaelG replied on at Permalink Reply
I'm coming up on the same issue. But I'm trying to deal with the page specifically with the hyphen

Controller: /packages/pkg_name/controllers/single_page/page_name.php
View: /package/pkg_name/single_pages/page-name.php
namespace: Concrete\Package\PkgName\Controller\SinglePage
class: class PageName extends PageController

not having any luck