In relation to my searchbox, I have made a dropdown-list over some content-nodes that the user can choose from. When a user choosen a node from the dropdown, I send a parameter called root as a querystring. This means that my URL looks like this after a search:
/search.aspx?seach=word&root=1213
The point is, that I want the ID in the root-parameter, as the source to my search.
I thought that I could do I by changing the source-variable in the XSLT from:
I have tried to write out the $source in a textarea, and when I write out the original $source I get a lot of text and numbers. But when I write out "my own" changed $source, I just get the ID from the root-parametre.
1. In the Settings section of umbraco, go to the Macros area and select the XSLTsearch macro
2. Click the Parameters tab and change the 'source' field from 'Content Tree' to 'Content Picker'
3. Save the XSLTsearch macro
4. In the Settings section of umbraco, go to the XSLT Files area and select the XSLTsearch.xslt file
5. Update the source variable as you've done and shown above
6. In the <template match="/"> section, change the <xsl:otherwise> code to the following...
<!-- search only within the SOURCE node specified in the macro and all of its children --> <xsl:call-template name="search"> <xsl:with-param name="items" select="umbraco.library:GetXmlNodeById($source)/descendant-or-self::node"/> </xsl:call-template>
Variable source to search from
In relation to my searchbox, I have made a dropdown-list over some content-nodes that the user can choose from. When a user choosen a node from the dropdown, I send a parameter called root as a querystring. This means that my URL looks like this after a search:
/search.aspx?seach=word&root=1213
The point is, that I want the ID in the root-parameter, as the source to my search.
I thought that I could do I by changing the source-variable in the XSLT from:
to this:
But this gives me 0 results.
I have tried to write out the $source in a textarea, and when I write out the original $source I get a lot of text and numbers. But when I write out "my own" changed $source, I just get the ID from the root-parametre.
But is it possible to make the source variable?
I hope that you understand my problem :)
Here's how you'd do it...
1. In the Settings section of umbraco, go to the Macros area and select the XSLTsearch macro
2. Click the Parameters tab and change the 'source' field from 'Content Tree' to 'Content Picker'
3. Save the XSLTsearch macro
4. In the Settings section of umbraco, go to the XSLT Files area and select the XSLTsearch.xslt file
5. Update the source variable as you've done and shown above
6. In the <template match="/"> section, change the <xsl:otherwise> code to the following...
That should do it!
cheers,
doug.
Once again Doug - Thank you very much :) This worked just like I wanted it to.
You'e welcome!
Please remember to mark the solution.
cheers,
doug.
is working on a reply...