3 users online. Create an account or sign in to join them.Users

Search

Hello,

I have another idea how to make my website. Can I have that Symphony counts the characters on a post and after a certain amount of charachters make a read more link where someone can read the whole article ?

Roelof

To nicely add a link with "read more", you will want to use this modified version of the HTML Truncate Advanced utility. I made a few internal tweaks to support hyperlinks as suffix. Use like this:

<xsl:call-template name="truncate">
    <xsl:with-param name="node" select="__your_text_node_here__" />
    <xsl:with-param name="limit" select="250" />
    <xsl:with-param name="suffix">
        <a href="link-to-details-page">
            <xsl:text>... read more</xsl:text>
        </a>
    </xsl:with-param>
</xsl:call-template>

Ahh that's great stuff vladG, I noticed it in the search but didn't look into the details... looks very useful though!

Thanks to @buzzomatic. It's his work ;)

Ah Rowan, the silent genius :)

Everyone thanks for the solution. I will try it. For me now case closed.

Is it possible to arbitrarily limit the excerpt by adding a tag? Something similar to wordpress where you add a <!--more--> tag?

Yeah, you can, using the Ninja HTML utility. Pick any tag, for example <more />. Then create one more (empty) template:

<xsl:template match="*[preceding-sibling::more]" mode="html" priority="1" />

If you were using the Ninja utility elsewhere you'd have to either

  • If only used on one page and not using Ninja there: not implement that that empty template in the utility-file but only on the page you're using it on
  • If only one DS is being excerpted: be more specific in the match expression (i.e. excerpt-ds//*[preceding-sibling::more]) or
  • If all else fails: create a new set of Ninja templates using a different mode

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details