Search

I'm having some trouble with page numeration and single article view.

This is an example URL that I want to have on my page:

http://page.com/news/(page-num)|(article-item-title-handle)

So, if I go to page.com/news/2 I would get to the second page of news which lists ~10 article intros.

And if I go to page.com/news/article-title I would get page that shows single and full article.

I was checking tutorial on this, but it seems a bit out of date. From what I've figured out, I have to set parameters directly in the page settings, but I'm not sure what should be entered in there, since I use same "position" for two different types of arguments.

Any advice on this? :D

The extension Versatile Router is what you need. Routes are defined in PHP and can include conditions such as when_number.':page_num'.

Using two pages, news-list and news-article, routing can be done like this:

get('/news/:page_num/', '/news-list/{:page_num}/', array(when_number.':page_num'));
get('/news/:article/', '/news-article/{:article}/');

Note that parameter names cannot include a hyphen -- there is a technical reason.

Reygoch, if I understand correctly you would simply need two pages for this.

Create a separate one to display the article, for example called "view", in which case the url would become page.com/news/view/article-title. Remember to add a title parameter to this page; keep the page-number only for the "list articles" page.

You'll need to create a separate data source to attach to the new page that will only output one article based on the title parameter.

@ellie yes, but I would like to get rid of "view" part of my url. It would be cool if we would have conditional filters.

Than I could say in my datasource something like isNotNum($attr) and if expression is true than I'd use a filter to filter articles by their alias.

Otherwise I'd use attribute as page number or something.

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