Controller not possible when page name contains hyphen?
Permalink
As far as I can tell it is impossible to have a controller for pages with hyphens in the name.
For example: if we have a single page called 'my-page' there doesn't seem to be a way to correctly name the controller. The documentation still refers to underscores, and during experimentation I have not been able to find a way to make the controller work with a hyphened page.
Given that hyphens are the correct way to name pages (and I think recent c5 versions add hyphens instead of underscores when page names have spaces) this seems to be a serious problem.
Using rewrites/redirects is not the answer because it will cause confusion for the client, who uses the C5 dashboard - and it is an unsatisfactory solution anyway.
Can someone show me the answer?
Have I missed something obvious?
Surely we aren't in the situation where controllers are not possible in this case...are we?
For example: if we have a single page called 'my-page' there doesn't seem to be a way to correctly name the controller. The documentation still refers to underscores, and during experimentation I have not been able to find a way to make the controller work with a hyphened page.
Given that hyphens are the correct way to name pages (and I think recent c5 versions add hyphens instead of underscores when page names have spaces) this seems to be a serious problem.
Using rewrites/redirects is not the answer because it will cause confusion for the client, who uses the C5 dashboard - and it is an unsatisfactory solution anyway.
Can someone show me the answer?
Have I missed something obvious?
Surely we aren't in the situation where controllers are not possible in this case...are we?
This sounds like it could be a bug. Are you able to accesshttp://www.concrete5.org/developers/bugs/5-4-1-1/... ?
I'll do some checking into this and if you can't submit it as a bug I can do so for you.
I'll do some checking into this and if you can't submit it as a bug I can do so for you.
I'm guessing it's a regular expression issue. Does the controller work if you user and underscore instead?
We're aware of this and it's been addressed in the latest development version up on github right now.
is there a work around for this until the next release? or could someone point me at which files to look for the fix in on github?
I know I could just change the name of the page, or create it without the hyphens but I'd rather not.
I know I could just change the name of the page, or create it without the hyphens but I'd rather not.
Is this fixed in 5.5? I can't get it to work...
Yeah it should be fixed in 5.5
Figured it out! Thanks!
Which was.. ? I'm running into the same issue on 5.6.0.2. I had originally created the single page as "request_a_quote.php", and the controller was being picked up properly. I renamed it to "request-a-quote.php", and now nada!
Currently getting the same issue did you fix it?
edit: classic case,
pull hair out, post, go back solve within a couple of minutes.
For me I had a single page with the dash in ie single-page.php
my controller was single_page.php, I renamed this to single-page.php and everthing works again.
One thing to note is I believe the dash is still treated as separator as within my controller the class name is SinglePageController, and the block SinglePageBlock
Thanks for the tips
pull hair out, post, go back solve within a couple of minutes.
For me I had a single page with the dash in ie single-page.php
my controller was single_page.php, I renamed this to single-page.php and everthing works again.
One thing to note is I believe the dash is still treated as separator as within my controller the class name is SinglePageController, and the block SinglePageBlock
Thanks for the tips
If we are missing something it would be nice to know.