What version of umbraco are you using? Also I take it the keywords are on the media item itself in the media section or are you creating a page then adding to that?
Are you trying to display a list of Media Item as you would be doing with nodes? ... i once did something like creating a new mediaType and to this added 2 different upload files one for the image and the other one for attaching a pdf file and textbox to display a summary of the file.
Hi Ismail, I'm using Umbraco 4.9. The images are uploaded to the Media section, then using Media Picker to select them for the page in the Content. The keywords are on the content page. Each image has a page created for it.
You could make use of Examine to do a related search. So for current image get the keywords then do a search to find all content with those keywords and list out the images.
<!-- Select all the relevant pages --> <xsl:variablename="galleryPages"select="$siteRoot//DocTypeAlias"/>
<!-- Create an XPath searchable variable of keywords on the current page --> <xsl:variablename="keywordsForPage"select="umbraco.library:Split($currentPage/keywords, ',')"/>
<!-- Grab all pages that share a keyword with the current page --> <xsl:variablename="relatedPages"select="$galleryPages[umbraco.library:Split(keywords, ',')//value = $keywordsForPage//value)]"/>
Related pages based on keywords in textbox multiple
I'm building an image gallery, and each image has a set of keywords seperated by a comman in a textbox.
I want something that allows "related images" to display as a list on the page, using the matched keywords in the textbox.
Is this possilbe, and if so has anyone got any examples?
Cheers, JV
JV,
What version of umbraco are you using? Also I take it the keywords are on the media item itself in the media section or are you creating a page then adding to that?
Regards
Ismail
JV,
Are you trying to display a list of Media Item as you would be doing with nodes? ... i once did something like creating a new mediaType and to this added 2 different upload files one for the image and the other one for attaching a pdf file and textbox to display a summary of the file.
//fuji
Hi Ismail, I'm using Umbraco 4.9. The images are uploaded to the Media section, then using Media Picker to select them for the page in the Content. The keywords are on the content page. Each image has a page created for it.
Jv,
You could make use of Examine to do a related search. So for current image get the keywords then do a search to find all content with those keywords and list out the images.
Regards
Ismail
Hi JV,
You could try something like this - may need a little tweaking if you're not consistent with whitespace and/or casing in the keywords property:
/Chriztian
The above had a closing </p> instead of a closing </a> - tried to edit the post but that effed up the formatting - lets try a new one:
/Chriztian
Thanks Chriztian, that works perfectly!
I just had to make one change to the following, there was an extra " ) ":
Also to omit the current page being displayed in the relatePages results, use the following:
And to sort them in order of most related "keywords" to least, use the following:
Hope this helps someone!
Cheers, JV
is working on a reply...