Only Show Page Numbers If Posts on Prev Page Are w/in X Days Ago

king8084

Well-known member
I'm working to create a native chat-room-like section to my site, where only chat messages (posts) from the last 48 hours are visible to members, with the rest being "gone forever" from the user's perspective... i won't get into the "why" behind this, but I have a pretty good concept for "how", but I've ran into a snag:

template 'page_nav' doesn't seem to house the vars I need to identify if the previous page has any posts from within the past 48 hours, or if the current page is the last of them within that range. I believe I would need $thread and $posts to be available to accomplish this.

here's the code on how I'm preventing the posts from displaying (i just need to then visually limit the page count from also showing):
Code:
thread_view:

<xen:foreach loop="$posts" value="$post">
            <xen:if is="{$post.message_state} == 'deleted'">
                <xen:include template="post_deleted_placeholder" />
            <xen:else />
                <xen:if is="{$post.thread_id} != '60154'">
                    <xen:include template="post" />
                <xen:else />
                    <xen:if is="{$post.post_date} >= {xen:calc '{$serverTime} - 172800'}">
                        <xen:include template="post" />
                    <xen:else />
                        <xen:if is="{$visitor.is_admin}">
                            <xen:include template="post" />
                        <xen:else />
                            <xen:comment>show nothing for non-admins</xen:comment>
                        </xen:if>
                    </xen:if>                   
                </xen:if>
            </xen:if>
        </xen:foreach>
 
Hello,

Why not just avoiding them from being fetch on php controller side ?

Clément
 
Top Bottom