Search

Hi! I can not understand how to make a very simple hierarchy in Symphony, for example, like this:

/news/ - show all articles

/news/this-is-sample-category/ - displays only the articles in this category

/news/this-is-sample-category/this-is-sample-news-article/ - displayed news article

Category consists of a header and URL. I need a filter on the URL, but the system takes the default title.

alt text

Please help me find a solution to this problem!

Well, I hope this explains it:

This structure that you are trying to create can be very complex to manage in your page template. Think that you have the page News and 2 parameters : category and article. In your news.xsl template you would have to display:

  1. /news - News list
  2. /news/category - News by category when only category is set
  3. /news/category/article - News details when category and article are set.

Check if category is set, check if article is set. What if article is not found? Redirect to 404 ... What if ... you get the point.

In my URL designs I switched form /news/category/article pattern to something like:

  • /news - news list
  • /news/categories/category-title - news for category-title
  • /news/articles/article-title - details for article article-title

It implies News page, Categories page with parent News and Articles page with parent News (or Title instead of Articles => /news/title/article-title).

This way your Datasources will be A LOT cleaner.


You want to get the news for a category?

For page Categories with parent News and parameter title, create a DS on section News with filter Category => {$title}.

Thank you very much for your reply! It is very clear and well describes the solution of the problem. But I would like to simplify my URL.

For SEO purposes it would be better to use the method described by taraknoff. However, I don't have enough knowledge about Symphony to know how to build this one yet.

I do but I'm sat in a cafe on the mobile. I'll do it whence I return home ;)

I've got home now and re-read what you want to achieve and you are already doing this right in datasource terms. Can you elaborate on what you want?

Category consists of a header and URL. I need a filter on the URL, but the system takes the default title.

I don't understand what you mean by this. Can you show us how your sections are put together?

I don't know if I understand correctly. But assumingly your issue would be how to detect what to display right?

I would suggest creating 3 sub-templates one for each then start off with an <xsl:choose> then test for the variables

  1. If $url -> news template

  2. If not($url) and $category -> category template

  3. If not($url) and not($category) -> general template.

Obviously you would have to change the above to the respective XSL. the only problem you might have to cater for is 404 errors. Since you have 2 params if they insert garbage in category your news might still work unless you insert the required checks in your filtering/xsl templates. PS. these would not show as 404 errors as page would still match but that you can tackle later on.

designermonkey This section of the "Category", which contains the fields "CategoryTitle" and "CategoryURL". This section of "News", which contains the fields "NewsTitle", "NewsContent", "NewsDatePublished", "NewsCategory" (a reference to the section "Category") and "NewsURL".

When I want to make your template the way to a news article of this type of "news/category-name/name-news-articles/" I can not do it, because I can not get the "CategoryURL" that belongs to the section "Category".

<entry id="19">
 <url handle="apple-bans-samsung-australia">apple_bans_samsung_australia</url>
 <date time="17:00" weekday="4">2011-10-13</date>
 <body>This is news content...</body>
  <title handle="Apple-has-made-the-ban-tablets-Samsung-in-Australia">Apple has made the ban tablets Samsung in Australia</title>
 <category>
   <item id="21" handle="Social" section-handle="category" section-name="Category">Social</item>
   <!--NOT CATEGORY URL! -->
 </category>

gunglien So I did. But do not think it was good.

You can also build the solution proposed by vladG and use some rewrite rules to create the urls you want.

Ah, ok. I get it now.

It's standard practice to use the handle of the Category Title to build your URL with, and in this case would work how you are already doing it.

To get it to do your use case, you would need to customise your datasource, which can get fiddly. For what you propose though, you can get the whole thing done with one datasource! You would definitely need to use the Category Title though.

designermonkey If the category name will be in Russian or Kazakh, then the default mechanism will not work. So I need to further specify the URL for the category.

I also suspect that you have to manually change the datasource (filters), but so far my knowledge about this system is not enough to do it.

Hi! Thank you for your support!

Thanks to the first answer here, I solved the problem with URL`s. Now, I can even do such ways as /news/society/2011/newvirusduqu/ (/news/category-url/year/news-article-url/).

In this case, if the delete characters on the way to the nearest slash, then we get the logical content (news list for the year, a list of news by category, etc.).

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