Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Shannon 148 posts 171 karma points
    Feb 19, 2011 @ 01:24
    Shannon
    0

    Using Position() in a blog roll to work on every page.

     

    Currently I am using the following xslt code:

     

    <xsl:if test="position() = 3">
          <div>
            <object data="/frontpage_blogroll_center_top_728x90" type="text/html" width="735" height="95" style="overflow:hidden; width: 738px; height: 100px"><xsl:comment /></object>
          </div>
        </xsl:if

     

    I'm using "position() = 3" to position an ad in a blog roll, it works for the first page but not for the subsequent pages. Is there anyway to get it to work for all pages?

  • Josh Reid 182 posts 258 karma points
    Feb 19, 2011 @ 02:22
    Josh Reid
    0

    Hi Shannon

    Please elaborate...

    What is your 'first page' and the structure of 'subsequent page' nodes?
    Is the blog roll outputting the other links on 'subsequent pages' successfully?
    What's the entire xslt?

    That should help sort it ;)

    Cheers
    J

  • Shannon 148 posts 171 karma points
    Feb 19, 2011 @ 02:31
    Shannon
    0

    This is the entire XSLT file that I moded from Blog4Umbraco to show blog posts on a page.

    http://www.pastie.org/private/z9rvhbjhv2gdmlmbsrncsq

    On page 1, it works fine by showing ads under post 3 and 12. I would like the same to happen on page 2, 3, etc.

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 19, 2011 @ 02:39
    Tom Fulton
    0

    Hi,

    I haven't used Blog4Umbraco before, but I imagine on the second page the position() you want is actually 18, since it appears to be showing 15 records per page

    So something like this might work:

    <xsl:if test="position() = (($numberOfPosts * number($pageNumber)) + 3)">
    ...show your ad...
    </xsl:if>

    -Tom

  • Josh Reid 182 posts 258 karma points
    Feb 19, 2011 @ 02:43
    Josh Reid
    1

    aha...

    <xsl:if test="position() = 3 + ($numberOfPosts * number($pageNumber - 1))">
    <!-- YOUR #3 AD -->
    </xsl:if>
    <xsl:if test="position() = 12 + ($numberOfPosts * number($pageNumber - 1))">
    <!-- YOUR #12 AD -->
    </xsl:if>

    Hope that helps ;)

  • Shannon 148 posts 171 karma points
    Feb 19, 2011 @ 02:45
    Shannon
    0

    I added a couple of spaces in the PageNumber item but it works perfectly. Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft