2

Someone named Yoshi Melrose wrote a plugin for EE1 called "onthisday" which I'm using on my EE1.7.1 sites. I'd like to migrate those sites to EE2 and this functionality is a key requirement. I'm trying to locate a replacement plugin or find someone interested in migrating the EE1 plugin.

The plugin is really cool for blogs. It allows you to create a link to posts that were made "on this day" (or a date of your choosing) from previous years. Since I've had a couple of blogs that have been running for about 7 or 8 years, the results can sometimes be very interesting and fun.

Has anyone heard of this plugin? I can't find an EE2 version (or locate Yoshi for help), so a functional replacement would be very much appreciated.

I think migrating it is beyond my skill level since it actually extended the weblog class in EE1 and I can't see how to do that in EE2.

  • Are you talking about an on this date look up based on the date of the entry the user is viewing currently? Or an admin-set date as more of a "feature" item? Just curious. – Jean St-Amand Jan 25 '13 at 21:10
  • 1
    Send the plugin to me and I'll take a look. It can't be too difficult to make functional with EE2. If the license permits, I'll convert it for you. erik@focuslabllc.com – Erik Reagan Jan 25 '13 at 22:00
  • The way the plugin has worked is to show all previous posts submitted on today's month and day from previous years. Or, there is a parameter to ask for posts from previous years on a specified day and month. – Rick Robinson Jan 25 '13 at 22:24
4

You can use a custom query to fetch the titles and url_titles on the channel_titles table. It has a year, month and day column. If you need custom fields too, then you could only fetch the entry_id's and feed those to an embed, for a regular channel:entries tag.

edit (example)

On this day:<hr>

{exp:query sql="
  SELECT 
    title, url_title, year
  FROM 
    exp_channel_titles 
  WHERE 
    channel_id = 1
  AND
    month = {current_time format='%m'} 
  AND 
    day = {current_time format='%d'}
  "}

  <p>{year} - {title} - {url_title}</p>

  {if no_results}
    <p>nothing found</p>
  {/if}
{/exp:query}

Query module:
http://ellislab.com/expressionengine/user-guide/modules/query/index.html
Date formatting:
http://ellislab.com/expressionengine/user-guide/templates/date_variable_formatting.html

If you need full custom fields then only select the entry_id and feed it to an embed with channel entries. The zero in front is a fail-safe (for if no entries are found).

 // Main template (query result something like 0|12|32|44)

{embed="blog/thisday" 
   items="0{exp:query sql="SELECT entry_id FROM exp_channel_titles 
              WHERE channel_id = 1
              AND month = {current_time format='%m'} 
              AND day = {current_time format='%d'}
              "}|{entry_id}{/exp:query}"}

 // embedded template blog/thisday

 {exp:channel:entries channel="blog" entry_id="{embed:items}"}
    <p>{title}</p>
    {!-- {custom_field} --}
    {if no_results}nothing found{/if}
 {/exp:channel:entries}

or without embed, but with parse="inward", and a bit cluttered

 {exp:channel:entries channel="woningaanbod" 
    entry_id="0{exp:query sql='SELECT entry_id FROM exp_channel_titles 
          WHERE channel_id = 1
          AND month = {current_time format='%m'} 
          AND day = {current_time format='%d'}
          '}|{entry_id}{/exp:query}"
    parse="inward"
  }
    <p>{title} - {entry_date format="%Y %m %d"}</p>
    {!-- {custom_field} --}
    {if no_results}ahum, nothing found{/if}
 {/exp:channel:entries}

ps. this (and EE in general) is quite delicate with the double and single quotes nesting inside each other. Anything inside the entry_id="" tag (inside those double quotes), needs to have single quotes if you use tags for a parameter. Luckily the current_time is parsed very early on, so those nested single quotes from the format parameter, inside the query module tag, are replaced first with the values for month and day. After that, the query module runs first, because of the parse inward parameter. the rest is history, "on this day".

| improve this answer | |
  • Are there any global variables in EE that hold the day and month of the current date? Or would I need to parse those from some other variable? The title and a link is all I need, so this would likely work. I could even "hard code" the years into the plugin since it is a limited set (going back to 2005 or so.) – Rick Robinson Jan 28 '13 at 14:38
  • @Rick, yes, you can use current_time – Alex Kendrick Jan 28 '13 at 15:26
  • added an example for query module, you can SELECT other columns if you want. – GDmac Jan 28 '13 at 20:54
  • added another example for custom fields – GDmac Jan 28 '13 at 21:10
  • Wow. That is great support from the community. Thanks GDmac, I'll give it a try. – Rick Robinson Jan 28 '13 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.