Page 1 of 1

Archive Script

PostPosted: Fri Jan 03, 2014 10:53 pm
by Justin
Hi all,

Is there a script which can show the archive in years then in months for the current year?

E.g.

Archive

2011
2012
2013
2014

2014 Monthly Archive

January 2014
February 2014


I've been playing around with the code but don't seem to be able to script current year and month archive.

Many thanks,

Justin

Re: Archive Script

PostPosted: Fri Jan 03, 2014 11:04 pm
by Justin
Worked out Yearly...

<ul>
[[archive_list
unit='year'
order='asc'
format='<li id="%st_year%"><a href="%url%">%st_year%</a></li>'
]]

</ul>

But would like Monthly for current year to work alongside.

Re: Archive Script

PostPosted: Fri Jan 03, 2014 11:06 pm
by Harm10
Currently there isn't but this seems like a logical expansion of the existing code.
But then someone has to find the time to create it....... I see what I can come up with.

Re: Archive Script

PostPosted: Fri Jan 03, 2014 11:13 pm
by Justin
Thanks again Harm10!
Over the last few days you have been great!

Re: Archive Script

PostPosted: Fri Jan 03, 2014 11:43 pm
by hansfn
No, we shouldn't extend the archive_list tag for this - just use the subweblog tag. To get some ideas, see the Archives examples on http://book.pivotx.net/page/app-c (You can limit the example to the current year by using the date argument.) If you don't get it on your own, Harm can help you.

Re: Archive Script

PostPosted: Sat Jan 04, 2014 10:46 am
by Harm10
I wasn't thinking of something too complicated....... Just something like a starting and an ending date so anyone can limit the output of the archive_list.
What Justin wants is only the links to monthly archive pages of the current year. It seems to me that using a subweblog structure is a bit too complicated for users that have less experience just for this topic.
Adding such extra params would give users the possibility to output links to months until an ending date. They would have to use the archive_list tag again for the output of the year links. So no complex things in one go.
Is this still a no go?

Re: Archive Script

PostPosted: Sat Jan 04, 2014 3:53 pm
by Justin
Harm10, I don't want to get you into trouble, but thank you for trying to help.

I will manually edit each month, if not just have a yearly archive.

Re: Archive Script

PostPosted: Sat Jan 04, 2014 4:29 pm
by hansfn
Is this still a no go?

No, adding date, start and end arguments to the archive_list tag, similar to the the subweblog tag makes very much sense. I was objecting to making archive_list produces both yearly and monthly archives in one go.

It seems to me that using a subweblog structure is a bit too complicated ...

I agree in general, but the idea was that you made a solution once and then added it to the PivotX book (like the other examples).

Re: Archive Script

PostPosted: Sat Jan 04, 2014 7:30 pm
by Harm10
I will continue trying to introduce a start and end date for the archive_list.

Re: Archive Script

PostPosted: Wed Jan 08, 2014 6:59 pm
by Harm10
Hans and I made some changes to the code so your suggestion is now possible.
You can either wait on the next release or get the changes from svn: https://sourceforge.net/p/pivot-weblog/code/HEAD/tree/branches/2.3.x/pivotx/
You need to pick up the latest version of lib.php and modules/module_smarty.php.
The parms are documented on the template page http://book.pivotx.net/index.php?page=app-b and an example can be seen on http://book.pivotx.net/page/app-c#anchor-mixing-month-and-year-links

If you need more help please feel free to ask.