Search

As I mentioned in another thread, I'm building a forum and right now I'm having difficulty pulling user data the correct way.

My intention is to distinguis users by their roles. With topics it was easy; it's the topic replies I have issuess with.

Since I can only pull the author's name of the topic reply in question, I have a datasource that gets all registered users and their data (their role, in this case) and use it to compare the reply author with the corresponding user. It works, I can display the author's role, but it outputs all the authors that have participated in the discussion in every single reply (see attachment).

I have the following variables in my master.xsl utility:

<xsl:variable name="user-list" select="/data/user-list/entry"/>
<xsl:variable name="reply-author" select="/data/topic-replies/entry/author/item"/>

And this is the template that outputs the replies (only the importand bit):

<xsl:template match="topic-replies/entry">
    (header would be here)

    <div class="comment"><xsl:copy-of select="body/*" /></div>

    (tools would be here)

    <ul class="profile">
        <xsl:for-each select="$user-list">
            <xsl:if test="display-name = $reply-author">
                <li><a class="{role/name/@handle}" href="{$root}/user/{display-name/@handle}"><xsl:value-of select="display-name"/></a></li>
                <li><xsl:value-of select="role/name"/></li>
            </xsl:if>
        </xsl:for-each>
    </ul>
</xsl:template>

If you look at the attached image (names pixelated), you will see three authors for one reply, which is the problem I'm having. It displays their role and outputs different colours depending on that, but I don't know how to limit each author to their corresponding reply.

I hope that made sense... Is there actually a way to do this?

Attachments:
temp.png

Have you looked at output parameters and data source chaining as a way to filter your second data source?

Have you looked at output parameters and data source chaining as a way to filter your second data source?

Do you mean topic-replies? If so, I thought I had to work with user-list.

I've been testing with the output parameters to no avail. Maybe I'm not visualising it properly. Right now I'm filtering the user-list by System ID with $ds-topic-replies = Author (reply author), and it's obviously not working. I'm not sure how I'm supposed to filter the data.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details