Parameters with Normal Page (not Single Page)

I feel like this problem is as old as concrete5.

I need - often - to create pages with subpages that don’t need to create physical pages in the sitemap. The content just comes from the database and is managed in the backend, so a physical site in the sitemap would just overly complicate things.

So far I used single pages to solve this. Because no matter what I tried, single pages seemed to be the only thing that was able to have a parameter added in the url and being interpreted in the controller. Like /my-single-page/my-parameter

That worked fine. But now I have the situation, that I have multiple pages, that all do in essence the same. And I think it makes not much sense to create for each a copy of the single page. Just tedious to maintain it when changes come.

My question: How to best approach this?

Can registering route help that I can use parameters from a block? If yes, how can I make sure the content still shows up in the search?

I think there’s a way to use templates for single pages, but I don’t need a template, I just need to have multiple url’s point to the same controller.

Look at how the core page list works with filter blocks, such as on the default elemental blog. That is the solution for doing what you need with blocks on any page, no single pages or special controllers.

1 Like

Hi John and thanks for trying to help me.

Your suggestion brought me to this: How To - Using topics and the topic list block in concrete5 5.7

That brought me to that: Example: Passing Data from a custom URL into a Block's View Layer

And in there that little piece of code is exactly what I was looking for:

public function action_custom_foo($param1 = null, $param2 = null, $param3 = null)
    // Custom Logic


I might have been a tad to fast. Because unlike in a single page I still need to have the name of the action as a url element:

example singlepage: my-page/my-parameter

example action: my-page/call-to-action/my-parameter

Is there a way for a wildcard? so that in blocks I can check a subpage like in a single page?

Do you mean more than one block’s parameters in the path, or one block with multiple parameters in the path? Or am I completely misunderstanding what you are asking?

I have an overview page. Let’s call it “destination”. Now I have in the DB multiple entries for it, like “Rome”, “Paris”, “New York”.

Now I’d love to create an overview page in the sitemap. Regular page with just one block inside that displays the overview. That’s easy. But I want the blocks controller and view to then also display the unique destinations.

Like so: /destination/rome or /destination/paris

I can do this with a single page. But with a block and the mentioned solution trough actions I think I could only do something like

/destination/dest/rome or /destination/dest/paris

How can I achieve with blocks the same short url like with single pages? Without creating for every action in the controller this:

action_paris(), action_rome(), …

In a single page it’s so easy, because every input is given as a parameter automatically. Yet single pages have a lot of other downsides and I’m kinda sick & tired of those.

So /destination/dest/rome or /destination/dest/paris works, but you need to remove /dest/ from the path?

I have not tried this, at a guess you could declare a route that mapped from /destination/{param} to /destination/dest/{param} . That is just a guess, I don’t know if it will work that simply or would need a lot of further code.

Another workaround would be to pick a more useful name for ‘action_dest’ such as ‘action_city’. You would then have /destination/city/rome or /destination/city/paris. Of course, that only works if all your destinations are cities.

Or you could take it up one level. Make the parent page /travel/ and the method
‘action_destination’ to get /travel/destination/rome or /travel/destination/paris

Or do that anyway, and try and implement the route as well, so each location would respond to both /destination/paris and /travel/destination/paris

Thank you John

I think I solved all problems now more or less. I had to use a trigger like /city and was able to solve other problems with the help of a global variable and an additional template.

It works and allows me to shield users - not perfectly - a bit from the complexities of the cms while having more freedom than with the single pages.