I am needing some help with a feature on my website. I will be needing a pretty much, exact replica of the "LATEST" news rotation no the BBC news page seen here:
I'm not very experienced with umbraco, but I would understand this would be some kind of jquery and combination of xslt.
If anyone could help me out with any information regarding the content ideas behind this and how to display it in such a manner would be great!
I was thinking that it would be a content node in the backoffice, with a parent folder then inside, the items themselves. But I am stuck on how to get them to display in such a way.
maybe I did understand you wrong, did you mean something like http://timeblockr.com/mogelijkheden on the top? you can add in the backend new things to that news rotator...
For that you create a sort of folder document type and a ITEMTYPE document type with a property URL and a media picker MEDIAPROPERTYALIAS , include the jquery extension, and fill in the id in the xslt (or some other way) where the folder variable is declared, use the macro somewhere and it would would work (I think)
Thanks for your help so far, I am just a little stuck with the XSLT part though. About making it so I can put the content in there. I just want some text, not media so I guess we can strip that bit out.
Ideally, I just want to be able to input 1 line (x5 for example) of text such as:
"Nunc eros nisi purus habitasse habitasse eu dapibus sagittis! Lorem et purus magna magnis odio sagittis enim penatibus rhoncus velit lacus. Velit ridiculus rhoncus platea augue!"
within a foreach <li></li>
How could I go about selecting this from a folder?
Getting an error when I try to save that when I replace it with the other line
System.Xml.XmlException: The '=' character, hexadecimal value 0x3D, cannot be included in a name. Line 37, position 18. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper() at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling() at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags) at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl stylesheetNsList) at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet() at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
<xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments']/* [@isDoc and string(umbracoNaviHide) != '1']"/>
with:
<xsl:variablename="items"select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments' and string(umbracoNaviHide) != '1']" />
is there meant to be a space between "variable name" ? just a thought looking at the old one you suggested
System.Xml.XmlException: The '=' character, hexadecimal value 0x3D, cannot be included in a name. Line 36, position 20. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseElement() at System.Xml.XmlTextReaderImpl.ParseElementContent() at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper() at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling() at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags) at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl stylesheetNsList) at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet() at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument() at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
Text on a rotation
Hi all,
I am needing some help with a feature on my website. I will be needing a pretty much, exact replica of the "LATEST" news rotation no the BBC news page seen here:
http://www.bbc.co.uk/news/
I'm not very experienced with umbraco, but I would understand this would be some kind of jquery and combination of xslt.
If anyone could help me out with any information regarding the content ideas behind this and how to display it in such a manner would be great!
I was thinking that it would be a content node in the backoffice, with a parent folder then inside, the items themselves. But I am stuck on how to get them to display in such a way.
Cheers!
Shameless bump!
Maybe you can take a look at : http://stackoverflow.com/questions/6184589/jquery-text-rotation They are doing it there with CSS, Just place it in a div and add CSS to it.
Hope it helps, Jan-Willem
I'll have a look into it, I just need to think from my clients POV - I wonder how he will add the comments into the back office from this himself.
Thanks Jan.
maybe I did understand you wrong, did you mean something like http://timeblockr.com/mogelijkheden on the top? you can add in the backend new things to that news rotator...
Exactly like that, how would I go about doing that?
Thanks Jan :)
I made that one in Umbraco 5 (so cshtml) but it's easy to convert to xslt i'd think. the jquery is the jquery.elastislide from http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/ ;
maybe something like this for the xslt?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="Folder" select="umbraco.library:GetXmlNodeById('ID')" />
<xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'ITEMTYPE']/* [@isDoc and string(umbracoNaviHide) != '1']"/>
<xsl:if test="count($items) > 0">
<div id="carousel">
<div class="es-carousel">
<ul>
<xsl:for-each select="$items">
<li>
<a href="{URL}">
<img src="{umbraco.library:GetMedia(MEDIAPROPERTYALIAS, 0)/data [@alias = 'umbracoFile']}" alt=""></img>
</a>
</li>
</xsl:for-each>
</ul>
</div>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
For that you create a sort of folder document type and a ITEMTYPE document type with a property URL and a media picker MEDIAPROPERTYALIAS , include the jquery extension, and fill in the id in the xslt (or some other way) where the folder variable is declared, use the macro somewhere and it would would work (I think)
Greetings Jan-Willem
Hi Jan,
Thanks for the hlep thus far, the jquery link you provided wasn't found though.
Cheers
erm yea, there was something wrong with the url: http://tympanus.net/codrops/2011/09/12/elastislide-responsive-carousel/ is the correct one, does this one work?
I forgot something to add, you also need to setup the plugin by
$(function(){
$('#carousel').elastislide({
imageW: 133,
minItems: 2,
easing: '',
margin: 50,
border: 0
});
});
in your page (this is javascript)
Hi Jan,
Thanks for your help so far, I am just a little stuck with the XSLT part though. About making it so I can put the content in there. I just want some text, not media so I guess we can strip that bit out.
Ideally, I just want to be able to input 1 line (x5 for example) of text such as:
"Nunc eros nisi purus habitasse habitasse eu dapibus sagittis! Lorem et purus magna magnis odio sagittis enim penatibus rhoncus velit lacus. Velit ridiculus rhoncus platea augue!"
within a foreach <li></li>
How could I go about selecting this from a folder?
Thanks Jan :)
Bump :(
You can add a textstring to a umbraco document and then use something like this
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="Folder" select="umbraco.library:GetXmlNodeById('ID')" />
<xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'ITEMTYPE']/* [@isDoc and string(umbracoNaviHide) != '1']"/>
<xsl:if test="count($items) > 0">
<div id="carousel">
<div class="es-carousel">
<ul>
<xsl:for-each select="$items">
<li>
<xsl:value-of select="TEXTSTRINGALIAS" />
</li>
</xsl:for-each>
</ul>
</div>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi Jan, thanks for your help so far.
Below is how my content is structured. A parent folder which is just a "placeholder" for the items.
Here is my macro:
My XSLT, edited to which you provided:
But for some reason, it is not displaying anything. Even if I hard code some stuff into the XSLT between the <li>.
Stumped!
I think it's because it checks if you items variable is higher then 0 so the problem could be in your
<xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments']/* [@isDoc and string(umbracoNaviHide) != '1']"/>
I think it's becouse you're are getting the childs of the childs... maybe try this:
<xsl:variable name="items" select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments' and string(umbracoNaviHide) != '1']]"/>
Getting an error when I try to save that when I replace it with the other line
System.Xml.XmlException: The '=' character, hexadecimal value 0x3D, cannot be included in a name. Line 37, position 18.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()
at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags)
at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl stylesheetNsList)
at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet()
at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument()
at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
my mistake, try this
<xsl:variablename="items"select="$Folder/ancestor-or-self::* [@isDoc and @contentTypeAlias = 'recent-comments' and string(umbracoNaviHide) != '1']" />
still get an error;
replacing:
with:
is there meant to be a space between "variable name" ? just a thought looking at the old one you suggested
System.Xml.XmlException: The '=' character, hexadecimal value 0x3D, cannot be included in a name. Line 36, position 20.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSiblingHelper()
at System.Xml.Xsl.Xslt.XsltInput.ReadNextSibling()
at System.Xml.Xsl.Xslt.XsltLoader.LoadInstructions(List`1 content, InstructionFlags flags)
at System.Xml.Xsl.Xslt.XsltLoader.LoadTemplate(NsDecl stylesheetNsList)
at System.Xml.Xsl.Xslt.XsltLoader.LoadRealStylesheet()
at System.Xml.Xsl.Xslt.XsltLoader.LoadDocument()
at System.Xml.Xsl.Xslt.XsltLoader.LoadStylesheet(XmlReader reader, Boolean include)
May I ask, what umbraco version are you using? and is recent-comments your document type alias? then it should be
and yes, there should be spaces in them
umbraco v 4.0.0 (Assembly version: 1.0.3317.32692)
Should the document type alias be the parent folder or child alias?
Thanks
Looks like I found the problem, you are using the legacy xslt scheme and I gave you the code for the new one...
I'm not very familliar with it but maybo something like this?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp " ">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:variable name="Folder" select="umbraco.library:GetXmlNodeById('1955')" />
<xsl:variable name="items" select="$Folder/ancestor-or-self::node [string(./data [@alias='contentTypeAlias']) = 'recent-comments']"/>
<xsl:if test="count($items) > 0">
<div id="carousel">
<div class="es-carousel">
<ul>
<xsl:for-each select="$items">
<li>
<xsl:value-of select="recent-comment-item" />
</li>
</xsl:for-each>
</ul>
</div>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Hi Jan,
Having a nightmare with this, could I get you on skype? my skype address is nick.rowe.sd1
Thanks!
is working on a reply...