Page 1 of 1
Annual Repeats of entries, or No Year in Entry date?
Posted: Sun Dec 25, 2005 3:11 pm
by Sweeny
We want to make our Today in History blog automatically repeat every year. Can this be done?
Or is there a way to post an entry without a year - only with a Month and day?
Can this be done by changing defaults? I mean with no day of the week or year in the entry date?
Here's an example:
http://www.tmach.com/timelog/index.php
Merry Christmas everybody.
Serendipity is the greatest.
Alastair
Re: Annual Repeats of entries, or No Year in Entry date?
Posted: Mon Dec 26, 2005 8:59 pm
by garvinhicking
This could be done, but it would require (a lot) of patching in some places. Especially the serendipity_fetchEntries() function.
So the easiest thing would be to create your own plugin which executes a SQL query to fetch the articles from a specific month/day without paying attention to the year. MySQL has many DATE_FORMAT functions to achieve this.
You could then register your own custom Smarty function within the plugin to put it in your template file!
Best regards,
Garvin
Other Options
Posted: Tue Dec 27, 2005 1:31 pm
by Sweeny
Garvin:
Understood, but I am not a programmer. Is it possible simply to post in Serendipity without any date attached, and then use Javascript in an HTML nugget in the margin to create a calendar that links to stories? (rough sample below)
I realize this goes against the philosophy of Weblogs, but let's think outslde the blog - without hardwired dates, Serendipity could also become a VERY serviceable plain publishing platform that could be used to host books and other non time related content.
Serendipity has great features, and I think this kind of option would help propel it higher into the mainstream.
Alastair
<table border="0" width="120" cellspacing="0">
<th bgcolor=black align=center colspan=7><font size=2 face=arial color="#ffffff">Pick Your Month Below</font></th>
</tr>
<tr>
<th bgcolor="#666633" width=10><font color="#ffffff" face=arial size=1>S</font></th>
<th bgcolor="#666633" width=10><font color="#ffffff" face=arial size=1>M</font></th>
<th bgcolor="#666633" width=10><font color="#ffffff" face=arial size=1>T</font></th>
<th bgcolor="#666633" width=10><font color="#ffffff" face=arial size=1>W</font></th>
<th bgcolor="#666633" width=10><font color="#ffffff" face=arial size=1>T</font></th>
<th bgcolor="#666633" width=10><font color="#ffffff" face=arial size=1>F</font></th>
<th bgcolor="#666633" width=10><font color="#ffffff" face=arial size=1>S</font></th>
</tr>
<tr>
<td bgcolor="#cedaf3"> </td>
<td bgcolor="#cedaf3"> </td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug01.php">1</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug02.php">2</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug03.php">3</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug04.php">4</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug05.php">5</a></font></td>
</tr>
<tr>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug06.php">6</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug07.php">7</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug08.php">8</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug09.php">9</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug10.php">10</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug11.php">11</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug12.php">12</a></font></td>
</tr>
<tr>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug13.php">13</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug14.php">14</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug15.php">15</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug16.php">16</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug17.php">17</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug18.php">18</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug19.php">19</a></font></td>
</tr>
<tr>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug20.php">20</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug21.php">21</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug22.php">22</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug23.php">23</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug24.php">24</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug25.php">25</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug26.php">26</a></font></td>
</tr>
<tr>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug27.php">27</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug28.php">28</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug29.php">29</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug30.php">30</a></font></td>
<td bgcolor="#cedaf3" align=center><font size=1 face=arial><a href="biraug31.php">31</a></font></td>
<td bgcolor="#cedaf3"> </td>
<td bgcolor="#cedaf3"> </td>
</tr></table>
<table><tr><td width=80 bgcolor="#cedaf3"><font size=1 face=arial><center>
<a href="../01jan/birjan.php">January</a><br><a href="../02feb/birfeb.php">February</a><br><a href="../03mar/birmar.php">March</a><br><a href="../04apr/birapr.php">April</a><br><a href="../05may/birmay.php">May</a><br><a href="../06jun/birjun.php">June</a><br><a href="../07jul/birjul.php">July</a><br>AUGUST<br><a href="../09sep/birsep.php">September</a><br><a href="../10oct/biroct.php">October</a><br><a href="../11nov/birnov.php">November</a><br><a href="../12dec/birdec.php">December</a><br></center></a></font></td></tr></table>
Re: Other Options
Posted: Tue Dec 27, 2005 2:47 pm
by garvinhicking
Well, sure - it would all work, but a plugin is the easiest way. Of course you can disregard the year in all fetching functions.
But it would require a programmer to code this. Since you already mention that it's against weblogs, I can only offer to do this coding for $$$. The reason is that my free time is limited, and only focussed at the Blogging part of Serendipity, where such a feature would not be useful.
Regards,
Garvin
Posted: Tue Jan 03, 2006 4:23 pm
by Sweeny
Thanks Garvin, we'll keep that in mind. It just occurred to me that being able to post undated stories would extend the reach of Serendipity and turn it into a publishing platform or CMS.
Another question. Since we produce a today in history site, can we use older dates, such as July 20, 1776? Do you limit the range?
Happy New Year.
Alastair
Posted: Tue Jan 03, 2006 5:13 pm
by garvinhicking
Hi!
Sweeny wrote:Thanks Garvin, we'll keep that in mind. It just occurred to me that being able to post undated stories would extend the reach of Serendipity and turn it into a publishing platform or CMS.
Yes, that's true. Even though Serendipity indeed can be bent into that direction.
BUT, another idea just occured to me.
We could write a SQL query, that is executed once a year, on Silvester for example.
This is no more than a 5 line serendipity plugin with this SQL query:
Code: Select all
$this_year = date('Y');
$that_year = $this_year - 1;
$entries = serendipity_db_query("SELECT id, timestamp, UNIX_TIMESTAMP(DATE_ADD(timestamp, INTERVAL 1 YEAR)) AS newstamp FROM serendipity_entries WHERE timestamp >= UNIX_TIMESTAMP('{$that_year}-01-01 00:00') AND timestamp <= UNIX_TIMESTAMP('{$that_year}-12-31 00:00')");
if (is_array($entries)) {
foreach($entries AS $entry) {
serendipity_db_query("UPDATE serendipity_entires SET timestamp = {$entry['newstamp']} WHERE id = {$entry['id']}");
}
}
This should add one year to all entries of the last year, so that they will show up again in this year.
Another question. Since we produce a today in history site, can we use older dates, such as July 20, 1776? Do you limit the range?
Serendipity relies on the UNIX timestamp, which doesn't go before 1969. So sadly this is not an option.
You can however enter the "real" date you want to use in a Custom Field (from the extended entry properties plugin) and show that field within your smarty template instead of the timestamp.
Best regards,
Garvin