0 users online. Create an account or sign in to join them.Users

Search

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 if subpage is an actual page or an url-parameter of page.

Is this possible without having an extra database query?

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.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details