Re: prev/next-post-link in blog.xsl?

Christian Stocker <[email protected]>
Newsgroups gmane.comp.cms.bitflux.general
Message-ID <[email protected]>

On 12.6.2005 17:47 Uhr, Christian Stocker wrote:
> 
> On 11.6.2005 11:03 Uhr, Alain Petignat wrote:
> 
>>Hi all
>>
>>Is there an easy way to include a link to the previous/next post when
>>viewing a single post?
>>
>>One could then switch sequentially through all your posts.
>>
>>If you do not know what i mean, see here:
>>http://codeconsult.ch/bertrand/archives/000523.html :
>>
>>« Summer of Code | Main | osx has been running on Intel processors for
>>five years... »
>>
>>Something like that :)
> 
> 
> Mmmh, currently not really implemented.
> 
> I think the best approach would be to use some helper php functions and
> call them, where you want them from the xslt. AFAICS you can't do it,
> without at least one more (most certainly even two) more sql queries to
> get the posts before and after the current post, since we don't know
> nothing about the surrounding posts, when we look at a single one.
> 
> Maybe a subplugin would be the best approach. if you need further help,
> just ask, I really don't know the best solution either right now


I added a little subplugin for doing that. bx_plugins_blog_prevnext.

>From the boilerplate:

/*
* a little subplugin for getting next and previous entry
*
* does not take into account, if a blog is published/has-a-category yet
* it's maybe not very performant, since it has to do 2 full tablescans...
*
* Add the following to blog.xsl, if you want to use it:

    <p>
        <xsl:for-each
select="document(concat('portlet://',$collectionUri,'plugin=prevnext(',substring-after(@id,'entry'),').xml'))/bx/plugin/prevnext">
            <a href="{$blogroot}archive/{prev/uri}"><xsl:value-of
select="prev/title"/></a>
            ||
            <a href="{$blogroot}archive/{next/uri}"><xsl:value-of
select="next/title"/></a>
        </xsl:for-each>
    </p>
*/


If anyone has an idea, how to improve the sql code for getting the next
and previous entry, i'm all ears...

See

http://svnweb.bitflux.ch/horde/chora/co.php/bxcmsng/trunk/inc/bx/plugins/blog/prevnext.php?r=HEAD

for the current implementation

chregu


> 
> chregu
> 
> 
>>Thanks for hints
>>Alain.
> 
> 
-- 
bitflux-cms mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.