Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hello all....
I have one news list page .....which shows the list of news aticles written ....
i am able to show each article in the list in news list page ....this is my code ....
<?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" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:umbraco.contour="urn:umbraco.contour" xmlns:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets umbraco.contour tagsLib BlogLibrary "><xsl:output method="xml" omit-xml-declaration="yes"/><xsl:param name="currentPage"/><xsl:template match="/"><!-- The fun starts here --><xsl:for-each select="$currentPage/* [@isDoc and string(umbracoNaviHide) != '1']"> <xsl:sort select="@updateDate" order="descending" /> <!-- <h3 class="headline"> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/> </a> </h3> --> <div id="newsArticle"> <!-- <div id="newsImage"><xsl:value-of select="umbraco.library:ReplaceLineBreaks(image)" disable-output-escaping="yes"/></div> --> <div id="newsImage"><img src="{./image}" alt="" /></div> <div id="newscontentArea"> <div id="newscontentHeader"><xsl:value-of select="umbraco.library:ReplaceLineBreaks(contentHeader)" disable-output-escaping="yes"/></div> <div id="newscontentDate"><xsl:value-of select="umbraco.library:ShortDate(@updateDate, true(), ' - ')"/></div> <div><xsl:value-of select="umbraco.library:ReplaceLineBreaks(article)" disable-output-escaping="yes"/></div> /* this is content */ </div> </div></xsl:for-each></xsl:template></xsl:stylesheet>
Now want to show the content up to some extend only ie. say up to 50 characters only .....
how to do this with the above code ...?
i want to do some thing like this ....
<xsl:value-of select="umbraco.library:TruncateString($currentPage/article,60,' >>')"/>
but i am not able to do this in above code .....
I also want to add link to ">>" so that i can route user to full length article.
Hi,
You could try something like this:
<div> <xsl:value-of select="umbraco.library:TruncateString(umbraco.library:ReplaceLineBreaks(article), 60, '')" disable-output-escaping="yes"/> <xsl:if test="string-length(umbraco.library:ReplaceLineBreaks(article)) > 60)"> <!-- only show the link if truncated? --> <a href="{umbraco.library:NiceUrl(@id)}"> >> </a> </xsl:if></div> /* this is content */
Hope this helps,Tom
Thanx dude ,
It all worked for me ....
I just want to ask that can i enter property insted of "@id" in the link?
As I know umbraco.library:NiceUrl(@id) only gives you result of given page id's url. So what you can do is
<a href="{./propertyname}"> >> </a>
and if you are redirecting to other site then do like this
<a href="{concat('http://',./propertyname)}"> >> </a>
Thanks
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
applying link to string after truncating....
Hello all....
I have one news list page .....which shows the list of news aticles written ....
i am able to show each article in the list in news list page ....this is my code ....
Now want to show the content up to some extend only ie. say up to 50 characters only .....
how to do this with the above code ...?
i want to do some thing like this ....
<xsl:value-of select="umbraco.library:TruncateString($currentPage/article,60,' >>')"/>
but i am not able to do this in above code .....
I also want to add link to ">>" so that i can route user to full length article.
Hi,
Hope this helps,
Tom
Thanx dude ,
It all worked for me ....
I just want to ask that can i enter property insted of "@id" in the link?
Hi,
As I know umbraco.library:NiceUrl(@id) only gives you result of given page id's url. So what you can do is
and if you are redirecting to other site then do like this
Thanks
is working on a reply...