Installation
- install entry_reference.zip via sobipro application manager .
- Choose sobipro section where you want to use the field.
Creating the field for choosing entries
- Create a new field ( field type -> special -> entry reference ) then click "forward" button
- Choose sobipro section where you want the entries to be chosen from.
Showing entries in details view
- edit file : YOUR_TEMPLATE/entry/details.xsl
-
add this code
<xsl:include href="../../front/entryref/entries.xsl" />
below the part where other templates are included like this for example :
<xsl:include href="../common/topmenu.xsl" /> <xsl:include href="../common/manage.xsl" /> <xsl:include href="../common/alphamenu.xsl" /> <xsl:include href="../../front/entryref/entries.xsl" />Note: front/entryref/entries.xsl is a simple template showing the entries title with links to their details page. you can edit the file yourself for adding more fields ( fields available in v-card view)
-
file : entry/details.xsl ( Default Sobipro template )
use this code :<xsl:choose> <xsl:when test="count(data/*) and @type != 'entryref'"> <xsl:copy-of select="data/*"/> </xsl:when> <xsl:when test="@type = 'entryref'"> <xsl:apply-templates select="." name="entryref"/> </xsl:when> <xsl:otherwise> <xsl:if test="string-length(data)"> <xsl:value-of select="data" disable-output-escaping="yes" /> </xsl:if> </xsl:otherwise> </xsl:choose>instead of :
<xsl:choose> <xsl:when test="count(data/*) > <xsl:copy-of select="data/*"/> </xsl:when> <xsl:otherwise> <xsl:if test="string-length(data)"> <xsl:value-of select="data" disable-output-escaping="yes" /> </xsl:if> </xsl:otherwise> </xsl:choose> -
put this code where you want to show the entries list
<xsl:apply-templates select="entry/fields/field_xxx" name="entryref"/>
where field_xxx is your field id
-
you can exclude the field from the "for-each" loop for the fields in the details template like this
file : entry/details.xsl
use this code :<xsl:for-each select="entry/fields/*[not(@type = 'entryref')]">
instead of :
<xsl:for-each select="entry/fields/*">
Method #1 [ Call the field within the fields loop ]
Method #2 [ call the field separately ]
Category:
