New "sticky" concepts?

Discussion corner for Developers of Serendipity.
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

New "sticky" concepts?

Post by Don Chambers »

I'm thinking out loud here, but wondering if anyone else thinks these ideas are worth considering. These are in addition to the extended property of "sticky post".

1) Announcement - entries marked "Announcement" would have an even higher priority than just sticky (just like this forum has).

2) Previously sticky - I'm thinking of this with respect to using the sticky option to mean "featured post". A frontpage could then show all "featured posts", but could also then contain an area for "previously featured.

3) A text box that allows overriding $CONST.STICKY_POSTINGS so someone could modify the value for their blog without modifying their language file, and having that change lost due to a s9y version upgrade.

If any/all of these are incorporated into s9y, I would hope to see them in the current 1.2 branch, not just 1.3
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: New "sticky" concepts?

Post by garvinhicking »

Hi!

Performance impacts of "sticky" attributes are already high. Adding new types for this would make SQL even more complex and laggy. I'm quite against it, and would actually better recommend to change the date of more important entries to rank them higher in their "sticky" order.
2) Previously sticky - I'm thinking of this with respect to using the sticky option to mean "featured post". A frontpage could then show all "featured posts", but could also then contain an area for "previously featured.
That's a nice idea. I'm thinking if this could be solved with custom entryproperties instead, by giving a field "was_Sticky" a value. However I'm note sure if there's already some means to filter display by a custom property, I suppose not. So a plugin would need to be developed to fetch a unique page showing those postings. Maybe it could somehow be integrated into the serendipity_fetchPrintEntries smarty function at some point.
3) A text box that allows overriding $CONST.STICKY_POSTINGS so someone could modify the value for their blog without modifying their language file, and having that change lost due to a s9y version upgrade.
That could be done as a template option...?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

OK - forget about the "announcement" for now.....

But I do think this notion of "was_sticky" could be sweet! A user could simply uncheck "mark as sticky" and instead check "mark as previously sticky".... then, of course, we need a way to fetch those just as we can fetch or ignore sticky entries.

But, if I cannot do that, how can I fetch just a list of entries with {$entry.properties.ep_MyCustomField=="was_sticky"}??
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!
But, if I cannot do that, how can I fetch just a list of entries with {$entry.properties.ep_MyCustomField=="was_sticky"}??
That's the thing. Currently, you'd need to write your own plugin for that.

I'd like to enhance the smarty function to support that. Currently, my schedule is swamped. If you could remind me around December 16th about it (that's where my "time off" starts), I'd love to have a look! (You can quote that to me *g*)

Regards.,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Garvin - I'm pulling my hair out because I am not sure whether I should be using a {serendipity_fetchPrintEntries} to get what I want, or if I should be developing a custom entries.tpl.

I am doing this because I want a start page to look more like a portal, and less like a traditional blog.

The first container of info will be sticky posts.
The next container will be the most recent posts that are not sticky. I want to display that as links, not entries.

These first 2 chunks of info can be accomplished by slightly modifying the code in the Hemingway port as follows, but perhaps I should be fetching each of these "chunks" of entries from index.tpl when my current page is the startpage. Anyway, here is the first 2 pieces working in a modified entries_home.tpl:

Code: Select all

{foreach name="loop1" from=$entries item="dategroup"}
    {foreach name="loop2" from=$dategroup.entries item="entry"}
        {if $smarty.foreach.loop1.index ==0} <!-- first dategroup, which will be stickies -->
            <div class="story first">
                <h3><a href="{$entry.link}">{$entry.title}</a></h3>
                <div class="entry_body">{$entry.body}</div>
                <div class="details">
<!-- posted by, etc blah blah -->
                </div><!-- details -->
            </div><!--story first -->

            {if $smarty.foreach.loop1.index ==0 && $smarty.foreach.loop2.last} <!-- begin the recent entry list following last entry in first dategroup -->
                <div class="story">
                    <h4>{$CONST.RECENTENTRIES}</h4>
                    <ul class="dates">
            {/if}
        {else}
            <li><span class="date">{$entry.timestamp|@formatTime:$HEMINGWAY_DATE}</span>
                <a href="{$entry.link}">{$entry.title|@default:$entry.id}</a> 
                {if $entry.categories} {$CONST.IN} {foreach from=$entry.categories item="entry_category" name="categories"}<a href="{$entry_category.category_link}">{$entry_category.category_name|@escape}</a>{if not $smarty.foreach.categories.last}, {/if}{/foreach}{/if}
            </li>
        {/if}
    {/foreach}
{/foreach}
                    </ul>
After this, I want to list entries with a custom field1 value =="yes" and then create another list of entries with a custom field2 value =="yes". This means that an entry COULD be listed in 3 separate areas - as either a sticky/recent post, and/or in the custom field 1 list and/or custom field 2 list.

I'm wondering if I am going to encounter a problem here with a custom entries_startpage.tpl.... That will only return entries up to whatever the limit that has been set for entries/page. Let's assume I have my entries per page set to 10. On these last 2 lists, I want to supply a list limit of the first, say 10 entries, but since not every entry will use these custom fields, I need to be fetching from the entire table of entries until I have 10.

So, what I want is:

All sticky posts (up to the limit as defined for the page, but likely never more than 4-6).
All recent posts not sticky (making up the difference between #/page, and sticky posts).
The 10 most recent entries where {$entry.properties.ep_MyCustomField1=="yes"}
The 10 most recent entries where {$entry.properties.ep_MyCustomField2=="yes"}

On a side note, would it be possible for the custom fields to have different types, like radio, checkbox, etc? You can see that my example above would be easier by checking a box than having to type "yes" in the field.

I need to find a way to get this operational in the next few days..... even if the method I use some time later is better. Can you guide me to the right approach????????? Buy you a beer or 2? or 3??? :lol:

I'm going crazy with this and have nearly taken a club to my computer on more than one occasion because of it!! :lol:
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!
After this, I want to list entries with a custom field1 value =="yes" and then create another list of entries with a custom field2 value =="yes". This means that an entry COULD be listed in 3 separate areas - as either a sticky/recent post, and/or in the custom field 1 list and/or custom field 2 list.
Maybe you didn't yet hear me: This is not possible yet, you would need to create your own PHP plugin to achieve that. I will look into this thing, but mid-december earliest.
I'm wondering if I am going to encounter a problem here with a custom entries_startpage.tpl.... That will only return entries up to whatever the limit that has been set for entries/page. Let's assume I have my entries per page set to 10. On these last 2 lists, I want to supply a list limit of the first, say 10 entries, but since not every entry will use these custom fields, I need to be fetching from the entire table of entries until I have 10.
Exactly, that would not be very feasible because it kills performance.
All sticky posts (up to the limit as defined for the page, but likely never more than 4-6).
All recent posts not sticky (making up the difference between #/page, and sticky posts).
Those two you should be able to fetch through serendipity_fetchPrintEntries function with the "noSticky" parameter.
On a side note, would it be possible for the custom fields to have different types, like radio, checkbox, etc? You can see that my example above would be easier by checking a box than having to type "yes" in the field.
That would require updating the entryproperties field and instead of specifying a commaseparated ifeldlist, they would need other properties just like the contactform plugin. That's quite complex, and introduces overhead when filling the fields, but I wanted to keep that EP-configuration field syntax as easy as possible.
I need to find a way to get this operational in the next few days..... even if the method I use some time later is better. Can you guide me to the right approach????????? Buy you a beer or 2? or 3??? :lol:
If you'd like to buy the thing for custom-printing before december 16th, I can offer commercial contract work (roundabout 75 Euro an hour).

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Those two you should be able to fetch through serendipity_fetchPrintEntries function with the "noSticky" parameter.
Hmmm..... not working as expected. I want the first 10 NON-sticky entries. This is what I have, but it returns both sticky and non-sticky:

Code: Select all

{serendipity_fetchPrintEntries full=false limit="0,10" use_hooks=0 use_footer=false skip_smarty_hooks=true noSticky=true template="entries_recent_tab.tpl"}
My tpl is just a simple listing of entry, date, author and categories:

Code: Select all

    {foreach from=$entries item="dategroup"}
        {foreach from=$dategroup.entries item="entry"}
        <h4 class="entry-title serendipity_title"><a href="{$entry.link}" rel="bookmark">{$entry.title}</a></h4>
            <span>{$entry.timestamp|@formatTime:'%b. %e, %Y'}</span>
            {$CONST.POSTED_BY} <span><address class="author"><a href="{$entry.link_author}">{$entry.author}</a></address></span>
            {if $entry.categories}<span> {$CONST.IN} {foreach from=$entry.categories item="entry_category" name="categories"}<a href="{$entry_category.category_link}">{$entry_category.category_name|@escape}</a>{if not $smarty.foreach.categories.last}, {/if}{/foreach}{/if}</span>
        {/foreach}
    {/foreach}
1) Is something wrong with that fetch?
2) When I finally have fetching non-stickies working, how do I fetch ONLY sticky entries (or do I need to use a custom tpl to limit output to the first dategroup)?

The other issue regarding custom user fields will have to wait until you have the time.. I'll still buy ya some beers, just cannot afford the hourly rate - especially with the holidays approaching and 3 little kids that expect Santa to leave some goodies! :lol:
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Does it work with:

Code: Select all

{serendipity_fetchPrintEntries full=false limit="0,10" use_hooks=0 use_footer="false" skip_smarty_hooks="true" noSticky="true" template="entries_recent_tab.tpl"}
The quotes around true/false might be important.
2) When I finally have fetching non-stickies working, how do I fetch ONLY sticky entries (or do I need to use a custom tpl to limit output to the first dategroup)?
That's not supported. You'd have to fetch entries inclidung stickies, and then discard all entries that do not have the sticky attribute from within your entries.tpl.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

garvinhicking wrote:Does it work with:

Code: Select all

{serendipity_fetchPrintEntries full=false limit="0,10" use_hooks=0 use_footer="false" skip_smarty_hooks="true" noSticky="true" template="entries_recent_tab.tpl"}
The quotes around true/false might be important.
No - it does not work with this:

Code: Select all

        {serendipity_fetchPrintEntries full="false" limit="0,10" use_hooks="false" use_footer="false" skip_smarty_hooks="true" noSticky="true" template="entries_recent_tab.tpl"}
2) When I finally have fetching non-stickies working, how do I fetch ONLY sticky entries (or do I need to use a custom tpl to limit output to the first dategroup)?
That's not supported. You'd have to fetch entries inclidung stickies, and then discard all entries that do not have the sticky attribute from within your entries.tpl.

Best regards,
Garvin
Perhaps fetching just stickies is another thing to add when you find the time to fetch by custom field???
=Don=
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

I have tried every combination of quotes, no quotes, 0/1, true/false, even noSticky, NoSticky and nosticky. No matter what I am trying, it still returns with sticky entries. :? Any other ideas?
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi Don!

You are trying with s9y 1.3-alpha, right?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

garvinhicking wrote:Hi Don!

You are trying with s9y 1.3-alpha, right?

Regards,
Garvin
No... 1.2 branch, although, I have not updated it in awhile. I would prefer not to switch to 1.3 alpha just yet, since I need this sandbox to work for my bulletproof development... unless we are not likely to be coding anything into BP that is 1.3 specific, then I guess it would not matter.

EDIT: I upgraded to the latest 1.2 branch snapshot a moment ago - no change in behavior. Sticky entries are still being fetched.
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi Don!

Please use 1.3-alpha, I believe there was a bug with sticky things in 1.2.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Forget the 1.3-alpha thing, it doesn't work here either. I'll check into this the next time.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Just committed to 1.3 SVN.

You can now do this:

Code: Select all

        <h3>REDUCED</h3>
        <div>
        {serendipity_fetchPrintEntries 
            full=false 
            limit="0,10" 
            use_hooks=0 
            use_footer="false" 
            skip_smarty_hooks="true" 
            entryprops="ep_is_sticky=true"
            template="entries_reduced.tpl"}
        </div>

        <h3>REDUCED2</h3>
        <div>
        {serendipity_fetchPrintEntries 
            full=false 
            limit="0,10" 
            use_hooks=0 
            use_footer="false" 
            skip_smarty_hooks="true" 
            entryprops="ep_Youtube=17"
            template="entries_reduced.tpl"}
        </div>

        <h3>REDUCED3</h3>
        <div>
        {serendipity_fetchPrintEntries 
            full=false 
            limit="0,10" 
            use_hooks=0 
            use_footer="false" 
            skip_smarty_hooks="true" 
            entryprops="ep_Youtube!=17"
            template="entries_reduced.tpl"}
        </div>
Regards,
Garvin

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply