Search

I have an article section. It has a checkbox to say a post is featured. This is fine, I can work with this in most situations.

However, I'm trying to implement this into a masonry setup. So featured articles have a different class applied and appear bigger. Problem is, the masonry wall runs mostly of the get-images template and the featured thing would fall under the get-articles template. What do?

Here are my codes:

Main page.xsl

get-article snippet

get-images snippet

some of my debug

All derived from the Piano Sonata. I get the feeling there's many ways to do this and I'm overlooking a simple option... Originally I was trying a more simply variable and xsl:if but that didn't work either. I'm open to any solution. Ideally I'd like to output it as a mode under the home-images template. If possible...

You can use dynamic templating to acheive this.

Basically, you apply-templates select="/data/data-source/entry" and then have 2 templates

and the other with featured!='Yes'

That way, entry will end up with all the articles in the right order, at the right place, with their respective templates.

Does it solves your issue ? Or I misunderstood it ?

Oh hey, That's an interesting method. I think it's closer to what I was trying to do.. However, I reverted back to the first plan which was fairly straightforward once I fixed up my xpaths. Originally I had got it wrong on the page template.

Here's my solution, goes in the get-articles.xsl:

                    <xsl:if test="(article-images) and (manage-images = 'Yes')">
                        <xsl:choose>
                          <xsl:when test="feature = 'Yes'">
                        <xsl:call-template name="featured-images">
                          <xsl:with-param name="home-image-entry" select="article-images/item[position() &lt; 2]"/>                 
                        </xsl:call-template>
                          </xsl:when><xsl:otherwise>
                        <xsl:call-template name="home-images">
                          <xsl:with-param name="home-image-entry" select="article-images/item[position() &lt; 2]"/>                 
                        </xsl:call-template>
                          </xsl:otherwise>
                        </xsl:choose>
                    </xsl:if>

    </xsl:template>

Now I just need to figure out how to include videos/oembeds in that as well...

Cool! With dynamic templating, is it basically the same thing: the choose is hidden behind the apply (which will do the choose for you by matching the right template for each entry).

As for the videos, I assume you are usign this: http://symphonyextensions.com/extensions/oembed_field/ ?

A simple xsl:copy-of select="video/oembed/html/*" should work. But if you are looking for a more customizable solution, you might want to load the videos with javascript.

I couldn't get my head round how to call my template properly for featured items, so maybe when I've learnt more and redesign/add to this theme I'll work on doing that.

Eventually I'd like to build it into a system a bit like polygon.com, where you can view videos in-page and they have a thumbnail with icon overlaid... For now though just a slider of posts will do.

Either way, I've tried that code in several ways and it isn't working at all :( should probably take this to the official oembed thread.

Thanks for the tips!

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