Conditional Page - URL Parameter ?
This is an open discussion with 8 replies, filed under General.
Search
In which case consider using GET parameters such as:
/your-page/?parameter1=foo¶meter2=bar
Which will create two parameters: $url-parameter1
and $url-parameter2
. GET parameters are beneficial because they can be optional and their order does not matter.
I don't know of anything like that off hand. I've often struggled with the intricacies of parameters myself, since I don't particularly like "dummy" parameters (like thread
in this forum). This is how I would probably do it.
You shouldn't have to create a new page for each tag, just one page for all tags. Suppose your parent page is called articles
. You can have articles
take one parameter, page
, to tell it which page of articles to display.
Create a second page, tags
, with articles
as its parent. This would have parameters tag/page
and a data source that filters on $tag
and paginates on $page
. If no value for $tag
is provided, I would display a list of all the tags, a tag cloud, articles from the most popular tags, or something like that.
So you have two pages: articles
and articles/tags
. If you want to display articles in exactly the same way on both pages, put your article XSLT template into a utility and include it on both.
Edit: I like Nick's suggestion of GET parameters too. Personally, I think pagination works better as a GET parameter, because ?page=2
seems more explicit to me than a dangling /2/
on the end of a URL. But it's up to you. :)
Agreed. Cool URIs don't change. So I tend to use GET params for values that act as filters, and page URL params for the actual URL of a "thing".
@nick but how I use this correctly:
my page name is "/portfolio/"
I the page "URL Parameter" I add:
/portfolio/?parameter1=tag¶meter2=pagenumber
In my DS I have two parameter: filter by {?tag}
and Return Page {?pagenumber}
My Page Template
<xsl:with-param name="url" select="concat('portfolio/$/',$url-tag,'/$')"/>
<xsl:with-param name="pagination" select="projektliste/pagination" />
I get this error message:
Line 23
loadXML(): ParsePI: PI parameter1 space expected in Entity, line: 23
Line 240
loadXML(): ParsePI: PI parameter1 never end ... in Entity, line: 240
Line 240
loadXML(): Premature end of data in tag params line 3 in Entity, line: 240
Line 240
loadXML(): Premature end of data in tag data line 2 in Entity, line: 240
@tachyondecay: I will use your solution if I fail with the first one
No, you would also pass the value for your parameters there too. Your URL would look like:
/portfolio/?tag=cars&pagenumber=3
You would reference these with {$url-tag}
and {$url-pagenumber}
respectively. The error you are getting it probably because {?something}
is not valid syntax.
I'm going crazy, it's does not work. can you make my a small step by step description what a must enter correctly in this fields if I want use the GET parameter:
Page
url parameter:
DS
filter by:
Return Page:
Template
xsl:with-param name="url" select:
If you read the section on this site under Learn, on how to filter datasources, you'll understand what Nick has suggested.
quma, here's an excellent guide about url parameters, specifically the section titled "get parameters"
Create an account or sign in to comment.
Hi,
is that possible to enter in Pages - URL Parameter something like this:
"parameter1" "or" "parameter2/parameter1"
My problem is I want add tags filter an pagination to the same page without creating for every tag a new page.