Blog package: FilterBy not working (2) Options
Jose Malone
Posted: Monday, April 09, 2007 7:37:56 PM

Rank: Devotee

Joined: 9/8/2006
Posts: 88
Location: Northern California
I'm trying to get the filterBy category to work.

Click on blog link from main menu, you end up here (all good):
www.domain.com/blog.aspx

Click on Category "Filed under: Category Name", you end up here (Not Good):
www.domain.com/?filterBy=Category Name

What I was expecting was:
www.domain.com/blog.aspx?filterBy=Category Name

Here's the code from DisplayCategories.xslt which I think is the culprit. Any ideas what I need to tweak?

Thanks.

[code]
<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>

<msxsl:script implements-prefix="user" language="JavaScript">

function Categorylink(input,url) {
var t = new Array();
t = input.split(",");
var retval = "";
var i = 0;
for (i = 0;i <t.length;i++){
retval += "<a href=\"/" + url + t[i] +"\">" + t[i] + "</a>";
if (i < t.length-1) {
retval += ", ";
}
}

return retval;
}


</msxsl:script>


<!-- Don't change this but create a 'number' element in your -->
<!-- macro with the alias of 'numberOfItems' -->
<xsl:variable name="numberOfItems" select="/macro/numberOfItems"/>

<xsl:template match="/">
<xsl:value-of select="user:Categorylink(string($currentPage/data [@alias = 'categories']),'?filterBy=')" disable-output-escaping="yes"/>


</xsl:template>
</xsl:stylesheet>
Jose Malone
Posted: Monday, April 09, 2007 8:11:36 PM

Rank: Devotee

Joined: 9/8/2006
Posts: 88
Location: Northern California
Also, I've noticed on other blogs, such as Per's (http://objects.dk/) the Latest Post, Archives and Categories (X) seem to auto-generated. Categories even has a count (X)of items. In the blog package I downloaded (which I thought was the latest) all this seems to be static html coded in the tamplate. Any hints on how to get this up to snuff and to appear automagically?
pph
Posted: Monday, April 09, 2007 10:04:24 PM
Rank: Aficionado

Joined: 7/19/2006
Posts: 171
Location: aalleren, Denmark
Hi Jose

Most of the functionality on my own blog is home-brewed xslt, but you can take what you can use from the xslt files if you want to. (some of it is pretty crappy and should be rewritten tho...)

http://objects.dk/xslt/blogcategories.xslt
http://objects.dk/xslt/blogrecentposts.xslt
http://objects.dk/xslt/blogarchieve.xslt
http://objects.dk/xslt/blogposts.xslt

Umbracian Personal blog: Objects.dk
bootnumlock
Posted: Monday, April 09, 2007 10:59:41 PM

Rank: Fanatic

Joined: 10/9/2006
Posts: 458
Location: batavia, IL
Jose...

For my blog... http://www.baty-barr.com

i modifed the xslt you are referencing to include the path /blog.aspx that appeared to help...
i will have to check on my archives... never thought about that one :)



bootnumlock - aka bob baty-barr
My Packages Site: http://packages.maliciousthinktank.com
Business Blog: http://www.maliciousthinktank.com/blog
Personal site: http://www.baty-barr.com
Level 1 Certified!
Jose Malone
Posted: Tuesday, April 10, 2007 5:49:48 PM

Rank: Devotee

Joined: 9/8/2006
Posts: 88
Location: Northern California
Thanks guys, this is increadibly helpful.

Thank you!

Jose
Jose Malone
Posted: Tuesday, April 10, 2007 9:16:51 PM

Rank: Devotee

Joined: 9/8/2006
Posts: 88
Location: Northern California


Per,

Like I could even create crappy code!

Questions: What nodes are 1040 and 1121? I'm assuming root and the blog? Also for alias 'categories' that is for the blog categories, right? I think my alias is called umbracoblog Categories.

Thank you!

Jose

- <ul>
- <xsl:for-each select="umbraco.library:GetPreValues(1040)//preValue">
- <li>
- <a href="/?filterby={current()}">
<xsl:value-of select="current()" />
</a>
(
<xsl:value-of select="count(umbraco.library:GetXmlNodeById(1121)/descendant-or-self::node [@nodeTypeAlias = 'umbracoBlogPost' and string(data [@alias='umbracoNaviHide']) != '1' and contains(./data [@alias='categories'], current())])" />
)
</li>
</xsl:for-each>
</ul>
atremblay
Posted: Tuesday, November 13, 2007 12:23:39 PM

Rank: Devotee

Joined: 2/23/2007
Posts: 92
Location: Simsbury, CT
I implemented your approach and it will suit my need perfectly. Unfortunately I am having trouble getting the results page to display any results. When I click on the tag for crap (http://localhost/?filterby=crap) I get a blank search results page.

Using your blogposts.xslt, I have narrowed it down to the node named "nodes" not returning any records. It seems that if I remove the statement:

"and contains(./data [@alias='categories'], umbraco.library:Request('filterBy')"

from
"xsl:variable name="nodes" select="$currentPage/descendant-or-self::node [@nodeTypeAlias = 'umbracoBlogPost' and string(data [@alias='umbracoNaviHide']) != '1' and contains(./data [@alias='categories'], umbraco.library:Request('filterBy'))]""

I do get results returned, but they are not associated with my tag of crap.

Anyone have any idea how I should code the nodes variable? and possibly where I might have messed up?

thanks!

Al Tremblay
atremblay
Posted: Wednesday, November 14, 2007 2:06:31 AM

Rank: Devotee

Joined: 2/23/2007
Posts: 92
Location: Simsbury, CT
I figured out my problem...This is how I fixed it.

Instead of referencing the querystring Request('filterBy') directly, I setup a variable named $filter then I referenced this in the $nodes variable declaration. Also, my alias was named tags - not categories as Per's example had.

<xsl:variable name="filter" select="umbraco.library:Request('filterBy')"/>

<xsl:variable name="nodes" select="$currentPage/descendant-or-self::node [@nodeTypeAlias = 'umbracoBlogPost' and string(data [@alias='umbracoNaviHide']) != '1' and contains(./data [@alias='tags'], $filter)]"/>

That did the trick!

Al Tremblay
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.