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???
I'm going crazy with this and have nearly taken a club to my computer on more than one occasion because of it!!
