search
top

PivotX Sticky Post

Adaptation using dedicated Page entry

Unbeknownst to me until yesterday, PivotX evidently limits results on queries for entries such that the system for identifying and displaying one dedicated post as a permanent sticky (upper left summary entry in the Bold theme, otherwise known as slider position 0) failed following my 21st post. 

This has been solved with a better long-term solution using a Page entry in lieu of a standard (Blog) entry.

In my original implementation, a new PivotX custom field was set in the standard (Blog) entry input template to identify the entry as Sticky.  A modification in _sub_slider.tpl identified this entry and called into the template _sub_showsticky.tpl.  This approach was taken as a least-intrusive means to the end.

Given the limitation encountered (sticky entry falls to 21st oldest blog entry, and falls out of the query range), and not wanting to tamper with core functionality, or re-posting what was intended as a permanent sticky entry ever 20 articles, I went back to the design board to re-think the approach.

What we end up with is minimal customization, touching only two of the theme templates, and the creation of a page chapter named "Sticky" under which a single sticky (Page) entry will be created for display in the standard sticky position.  Risks/Unknowns: without further research, it is unknown to me if Page entries face the same last-20-item query limit that standard blog entries are bound to.  Logically, this would not appear to be the case given the explicit means by which the target page is identified (fetch all pages, of which there will ever only be one, in chapter "sticky").

Two template pages were modified as such - examples represent the complete content of each file...

_sub_slider.tpl

<div class="featured-block">
    { include file="`$templatedir`/_sub_showsticky.tpl" }
    { capture name="count" } { $smarty.capture.count+1 } { /capture }
</div> { capture name="count" }0{ /capture }
{ subweblog name="slider" }{ literal }
    { if $entry.extrafields.slider }
        { if ($smarty.capture.count<1) }
            <div class="featured-block" { if $entry.extrafields.slider } style="float:right;" { /if }>
                { include file="`$templatedir`/_sub_showentry.tpl" } 
                { capture name="count" } { $smarty.capture.count+1 } { /capture }
            </div>
        { /if }
    { /if }
{ /literal }{ /subweblog }

_sub_showsticky.tpl

{ getpagelist var="pagelist" onlychapter="sticky" }
{ foreach from=$pagelist item="pageuri" }
    <div class="featured-block-inside">
        { getpage uri=$pageuri }
        { include file="`$templatedir`/_sub_show_image.tpl" }
            <div class="entry-content">
                {introduction}
            </div>
    </div>
    <div class="featured-date">
        <span class="featured-date-left"></span>
        <span class="featured-date-inside"><a class="blog-title" href="{ link page=$pageuri hrefonly=1 }" title="Read article{ commcount text0='' text1=' & %n% comment' textmore=' & %n% comments' }: { title }.">{title}</a></span>
    </div>
    { resetpage }
{ /foreach }

Take note, in PivotX, Smarty template engine tags are delineated using double square brackets "[[ tag ]]".  Here, I have used curly brackets as a means of preventing the template tags from being interpreted within the body of the code snippets...easier than escaping all tempate tags.

search ~ No comments | Used tags: ,
~ In category Technology by Adam

(optional field)
(optional field)
Due to 3,000+ spam comments posted on this site each month, I am forced to take measures to at least cull out the machine-generated comments and those who cannot solve basic math problems.
*All comments are moderated to prevent comment spamming.
Remember name, email, and URL?


top