Combining entries with Action Stream data

Richard Benson13 May 2010MT Tipscomments
First off, credit where credit is due; this method is entirely the property of Yves Luther, I am merely providing it in English in an instructional capacity.

So, you can see on my home page that my blog posts are nicely mixed in with my action stream entries, which for blogs with infrequent updates or personal sites, means you have a collection that summarises (most of) your activity on the web as a whole.  The beuty of Yves solution is it's simplicity and flexibility.  Once set up, the choice of exactly how to display your home page is completely up to you.

Also on my home page are variations on styling and content based on the service providing the action, this is something I will detail in a later post.
These instructions are presented in a much more 'instructional' way than Yves original entry, who provides additional commentary on the subject.

  1. Open your "Feed - Recent Entries" template and after the line "<id><$MTEntryAtomID{?D:PageBody?}gt;</id>" add the following:
    <entryid><mt:EntryID /></entryid>
  2. Open the file plugins/ActionStreams/lib/ActionStreams/Event/
  3. Add after line 18:
    Meaning that section of code looks like this:
        columns => [ qw(
        ) ],
  4. Change line 27 to:
            map { MT::Util::encode_html($event-> Combining entries with Action Stream data - IT Support in Surrey from Surrey Business IT
    comments powered by Disqus
    clever girl ()) } qw( url title source_url source_title entry_id ));
  5. Add after line 51:
                    entry_id     => 'entryid/child::text()',
    Meaning that section looks like this:
                get => {
                    identifier   => 'id/child::text()',
                    entry_id     => 'entryid/child::text()',
                    title        => 'title/child::text()',
                    summary      => 'summary/child::text()',
                    url          => q(link[@rel='alternate']/@href),
                    source_title => 'ancestor::feed/title/child::text()',
                    source_url   => q(ancestor::feed/link[@rel='alternate']/@href),
                    created_on   => 'published/child::text()',
                    modified_on  => 'updated/child::text()',
  6. Save, close and upload
  7. Add a "Website Profile" to your other profiles, and set it to your website url
  8. Open your action stream template (presuming you have an index template, NOT a widget)
  9. Add this line after the "<mt:actionstreams>" tag:
    <mt:setvarblock name="entry_id"></mt:setvarblock>
    (this resets the entry id so that you don't end up duplicating)
  10. Add this block after that:
    <mt:if name="service_type" eq="website">
        <mt:setvarblock name="entry_id"><$MTStreamActionVar name="entry_id"{?D:PageBody?}gt;</mt:setvarblock>
  11. After "<li class="hentry service-icon service-<mt:var name="service_type">">" add the following:
                <mt:if name="entry_id">
                    <MTEntries id="$entry_id">
                        <$MTInclude module="Entry Summary"{?D:PageBody?}gt;
    Then add an "</mt:if>" before the "</li>".
That should be it!  Publish all, wait for your run-periodic-tasks to execute and your posts should appear inside your action stream.

Next I will show you how to set up different styles and layouts for different action stream services.
comments powered by Disqus
Support Ticket
Remote Support
clever girl