Search

Is there anyway to create a news archive navigation then filtering based on month/year?

Like this:

alt text

I've done param navigation for categories and subcategories. http://www.getsymphony.com/download/xslt-utilities/view/100951/ I do not know how your setup is, but it possible helps.

@ischemic

This is a simple grouping problem achievable from the Datasource Editor.

In your Events datasource, under Group BY select your date field. Returned entries will be then grouped by month and year.

as @vladG says it should be wasy. only possible problem would be having a Lot of articles. as I think the current data-source would still pull up all the entries that you have. If you notice this slows your website you could possibly optimize the datasource manually. however this should be your first option.

but, when grouping datasource in such way, how the navigation will be changed to access news entries via navigation links?

Navigation you could use filters on the date field. setting them as {$year}-{$month} if not mistaken; I've set it up various times it shouldn't be that complex.

but navigation is a fixed datasource given from system. or am I complet wrong in that point?

You're both wrong and right at the same time. The navigation datasource provided by the default symphony installation will not change. It's your Symphony page which will have additional parameters to handle the pagination.

The navigation datasource is also not a requirement

ok. the navigation datasource is quite cool. I tried to patch it with my tool. If this makes no sense at all, please tell me. I'm new at programming, new at symphony and new at xslt. I'd like to learn each of this topics.

doesn't really make sense to patch the navigation datasource... The navigation datasource is there to give a mapping of all the pages you created in Symphony. If you are using url-parameters to go deeper; you will have to use other datasources to navigate/build urls.

I'm not sure if there's a complete guide; but as a basic step for most things you will not need to edit/customize a datasource; by adding datasources & changing filters you can get all the data you need. Then you can structure this to HTML with xslt.

thanks gunglien, but one point I dont understand, really: "If you are using url-parameters to go deeper; you will have to use other datasources to navigate/build urls."

I know how to filter datasources. I know how to make datasource chaining. but I dont know what you mean with "other datasources to navigate/build urls."

I though about how to navigate through paramters given to pages, as there where subpages. and the only thing I found was building a union datasource with unchained datasources, map them in xml and build a navigation with navigation ds and the unchained one - in case your url paramaters gives you pages with filtered or chained datasources.

Is this what you mean?

I don't think you really need a union datasource. I've never needed one for navigation.

What you would do for the entry you want to link to. You build first part of url using navigation. {$root}/{$root-page}/{$current-page} then the next part you would use your datasources. Example {/data/article/category} and {/data/article/title}.

Nowadays I hardly use the Symphony Navigation any-more as all/most of my website structures are built on top of Symphony Entries. Which gives me a lot of flexibility in my designs.

What you need to do is create a normal section datasource for the section in question, and group it by the date field you want to use. Also remember to not output any fields for this datasource to keep the query count down. This will output a datasource, grouped by year and month, and will contain lots of entry nodes that only have the ID attribute. You can use these entry nodes to count the amount of entries in each group if you so wish.

Once that's done, you need another datasource that filters the date field by {$year}-{$month} (these params being set in the page).

Your xslt will need to use templates to match the year, and then the month to build the hierarchy you want. You can also use whatever $year param is set in the url to limit which years show their months.

If I had some more time, I could show you the xslt, but sadly I am busy today. Maybe someone else could who has this structure laying around somewhere?

Also, to note, the described structure by the original poster has no use of the navigation datasource whatsoever.

Navigation DS is for pages not section based data.

Something like this in xslt:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <ul class="years">
            <xsl:apply-templates select="datasource/year" mode="years"/>
        </ul>
    </xsl:template>

    <xsl:template match="*" mode="years">
        <li class="year">
            <a href="{$root}/{@value}/"><xsl:value-of select="@value"/></a>
            <xsl:if test="./month and ($year = @value)">
                <ul class="months">
                    <xsl:apply-templates select="./month" mode="months"/>
                </ul>
            </xsl:if>
        </li>
    </xsl:template>

    <xsl:template match="*" mode="months">
        <li class="month">
            <a href="{$root}/{../@value}/{@value}/"><xsl:value-of select="@value"/> (contains <xsl:value-of select="count(./entry)"/> entries)</a>
        </li>
    </xsl:template>
</xsl:stylesheet>

maybe becaus eIm new in webdesing to, I don't understand gunglien with "Nowadays I hardly use the Symphony Navigation any-more as all/most of my website structures are built on top of Symphony Entries."

@designermonkey: That I understand complete: "Navigation DS is for pages not section based data". but why don't mix it up?

Thanx for your explanetions anywhy, time will come and i will get the point - hopefully.

but why don't mix it up?

We all do mix it up; however to build a Menu including dynamic Items; you do not need to touch the navigation datasource.

We mix it up by adding another datasource representative of the section we require. Have a read through this article; and the one which it links to at the end, this article shows how to build website navigation without the normal navigation datasource.

thx gunglien: one point nerves me at symphony, articles are not that easy to found.

now I'm hope understanding what section navigation is for. cool way for sure. But, it seeems not to fit my need.

Thanks for all the replies. I've been on holiday but I'm going to give this a go tonight.

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