Page 1 of 1

Archive summary alternative template

Posted: Wed Mar 04, 2015 7:59 pm
by Don Chambers
So, in archives, we often have an option to display all entries (using entries.tpl) for a specific month:

Code: Select all

{if $month.entry_count}<a href="{$month.link}">{/if}{$CONST.VIEW_FULL}{if $month.entry_count}</a>{/if}
or build a simple list of entries (using entries_summary.tpl) for a specific month:

Code: Select all

{if $month.entry_count}<a href="{$month.link_summary}">{/if}{$CONST.VIEW_TOPICS}{if $month.entry_count}</a>{/if}
I would like to do something similar to entries_summary. I do want to iterate through all entries for a specific month, but I want the output to be more than what entries_summary.tpl typically contains, but much less than what entries.tpl is used for. Essentially, a hybrid between the two.

We have a number of features that allow us to specify a specific tpl to use when formatting output, such as serendipity_fetchPrintEntries, serendipity_printSidebar, as well as a number of plugins whose output can be altered when using a custom, predetermined tpl file in a template folder.

I do not think I can use serendipity_fetchPrintEntries because I am not trying to include the output within an existing page - I am trying to generate unique page content formatted via a custom tpl.

Anyone know if this can be done?

Re: Archive summary alternative template

Posted: Wed Mar 04, 2015 9:02 pm
by yellowled
Not sure if I get what you mean, but I think I did something like that for the archives page of the German s9y podcast. http://www.s9ycamp.info/archives/

But that simply uses serendipity_showPlugin to emit the output of the recententries plugin, which is not very flexible.

YL

Re: Archive summary alternative template

Posted: Wed Mar 04, 2015 9:50 pm
by Don Chambers
Thanks. Emitting the results of a plugin is something I already know how to do. What I want the ability to have a monthly summary, but specify a smarty template other than entries_summary.tpl, so I could have one version that is a list of entries, but perhaps a second version that would use an extended property (an image) that becomes a link to the entry instead of a just a text list of entry titles.

If I didn't want both, I would just modify entries_summary.tpl to be this alternate version, but I want both.... one that is a text list, and one that is more of a graphical list.

Re: Archive summary alternative template

Posted: Thu Mar 05, 2015 1:47 pm
by garvinhicking
Hi!

Yeah...this view does not query the usual entries database table, so most data is not accessible.

You can't really mix and match the queries needed for usual entries.tpl and the summary view, because it doesn't fetch individual articles.

I don't see how this could be done. I would either suggest

a.) Creating a plugin for this with its own view like /plugin/MyMonthView (external_plugin hook), and that uses distinct, custom SQL queries to exactly fetch what is needed. Obviously, this is the complicated (but custom) route. ;)

b.) Inside the loops, use the fetchPrintries function with specific date ranges (of the month that is being iterated) to create a list of entries and display those specifically. Or, maybe even better, create a custom Smarty function that you can call at this place, and let the config.inc.php handle the specific custom SQL query of the data you want to fetch. Obviously, this is also a bit complicated. ;-)