Tickle-me Elmo tickles URL parameters right back with a vengeance to improve.
To kick off the Symphony 2 preview series in motion, we start by looking at the last piece of the system’s puzzle.
A Quick Primer
In Symphony 1.7, the way to send information from your front-end to your XSLT and data source is via “URL Parameters”. The example below is a typical URL:
http://chaoticpattern.com/archive/2007/09/21/symphony-2-is-great/
The system breaks down the URL into 3 identifiers:
- Document Root -
www.chaoticpattern.com
- Page -
/archive
- URL Parameters -
/2007/09/21/symphony-2-is-great
The values 2007
, 09
, 21
and symphony-2-is-great
are all parameter values. These are values that are accessible by XSLT and data sources.
Before values can be accessed by XSLT and data sources, the /archive
page needs to first define the parameters:
/year/month/day/article
Setting the above on the /archive
page allows the values from the URL to be mapped to the parameter names. With our above example, year is 2007
, month is 09
and so forth.
With the URL parameters on hand, Symphony can send the values to XSLT so the developer can write dynamic code based on the values. Data sources can also take advantage of the parameters and filter results based on these values.
Symphony 1.7 limitations
The below are 2 very noticable limitations that we wanted to solve in Symphony 2. The system cannot:
- filter by a date range.
- allow a growing undefined list of parameter values.
Wouldn’t it be cool
Wouldn’t it be cool if you could filter the data source by today? Even bettr, it would be great if it could filter entries between July and September or from today up until the latest entry saved. Personally, date range filtering alone is worth waiting for Symphony 2.
Early in our development, we encountered a limitation that we didn’t have a solution for. Only recently when trying to solve the date range problem did we realise we’ve also solve an age-old problem of multiple parameter filtering. Take this scenario for instance:
You have an entry that is saved in 2 categories: Latex
and Fetish
. In Symphony 1.7, to filter an entry by 2 category values you need to declare 2 parameters: /category1/category2
. But what happens if you want to filter by 3 categories? What if you want to filter by 10 or more? In Symphony 2 you can filter values by an arbitrary amount from 0
to n
where n
is the number of values you want to filter by. Better still, n
can be an unknown number.
How it’s done: Date range filtering
To solve both the date range problem and the multiple paramameter problem, the data source editor now treat parameters in a literal format.
In Symphony 1.7 putting $year
in the year field and $month
in the month field filters the value of $year
followed by the value of $month
. From Symphony’s perspective, each portion of the date are discreet and defined by the position laid out on the interface.
In Symphony 2, the way you construct date filtering is as follows:
{$year}-{$month}-{$day}
Date filtering is now done by a single input field and it now accepts any valid kind of date format. The above will render as 2007-08-22
, which is a valid ISO date. The curly brace syntax will be familiar to XSLT coders. Curly braces allow the system to identify between values that need to be processed and literal characters.
Mixing of literal characters and parameters are now possible:
2006-{$month}-{$day}
The above will render as 2006-08-22
(assuming of course, 08
and 22
are the values passed).
The date filter, being a single input field allow date range filtering:
{$today}, 2007-12-12
The above will return entries between today and 12 of December 2007.
The flexibility doesn’t stop there. Because parameters are treated literally, it’s now possible to have your URL parameter structured as such:
http://www.chaoticpattern.com/archive/2007-12-12/symphony-2-is-great
Or even:
http://www.chaoticpattern.com/archive/2007/december/12/symphony-2-is-great
How it’s done: Multiple parameters
In addition to treating parameters literally, data sources now also inherently understand the use of delimiters. For example:
http://www.chaoticpattern.com/tags/latex+fetish/
latex+fetish
is a single parameter but the data source will interpret it as 2 values delimited by a plus symbol
. Alternatively, you can use the comma symbol
to delimit the values:
http://www.chaoticpattern.com/tags/latex,fetish/
Because the values are grouped inside a single parameter, there is no limit to the number of delimited values:
http://www.chaoticpattern.com/tags/sexy+pink+latex+fetish/
Multiple filtering allows Symphony 2 to create truly powerful websites.
Discussion
What I’ve described today are just 2 of the long list of fetures found in Symphony 2. Just thought of a killer idea involving multiple parameter and date range filtering? The world need to hear it!
Comments
No comments made yet.
Create an account or sign in to comment.