Getting Page url-parameter on 'FrontendPrePageResolve' delegate
This is an open discussion with 6 replies, filed under Troubleshooting.
Search
No it's not possible without extra queries. In fact that's what the FrontendPage::resolvePage()
does after that delegate is called.
The earliest you will have this information is the FrontendPageResolved
delegate.
hehe, well, thats far to late :)
What are you attempting to do?
I'm building a url router that would automatically map ajax-pagerequests to a specified shadow-pagetree structure. You could specify a root-pagetree for ajax-calls and pages that would map to its corresponding subpages, e.g. articles
would map to xhr/articles
. The routing is only done if the page request has a HTTP_X_REQUESTED_WITH
header-attribute. This all works fine, but what if I have a request for article/my-article
where my-article
is a page-url-param and so on. I could just evaluate the first url-fragment present in $context['page']
against the the specified pages but of course this won't work for nested pages.
The longer I'm over thinking this, the more I'm convinced that xhr routing should be exclusively done client-side.
Right ok, that's a pretty neat idea for an extension.
So you need to be able to insert a 'variable' in the URL before that page. So if the URL mysite.com/articles/
was requested by AJAX, that'd be mysite.com/xhr/articles/
(and map to a corresponding 'xhr/articles' page in Symphony).
The problem you have if that if it was mysite.com/articles/view/my-article-title
, you don't know where to add the /xhr
/ because you don't know if /view/
or /my-article-title
are pages or params. So mysite.com/articles/xhr/view/my-article-title
or mysite.com/xhr/articles/view/my-article-title
or mysite.com/articles/view/xhr/my-article-title
could all be 'correct'.
I think you'll have to replicate some of this logic so that you can determine where the params start and the pages stop.
Similar-ish idea, I wrote a quick extension for content negotiation of RDF resources, so that the site author could upload RDF files (file names matching URL schema of Symphony pages) which would be served to clients sending an Accepts
header of application/rdf+xml
. Might be useful in your quest.
Create an account or sign in to comment.
I need to know if a page has url-parameters attached to it,. e.g. on the
FrontendPrePageResolve
delegate, if$context[page]
is/page/subpage/
, I want to know ifsubpage
is an actual page or an url-parameter ofpage
.Is this possible without having an extra database query?