Not signed in ( Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorNoWhereMan
    • CommentTimeJun 27th 2010 edited
     permalink
    Download from SVN

    see the result on my blog






    This plugin reads json from twitter and post your last tweet filing it under a category of choice; this way you can:

    a) tell which post is from twitter and which is not (with {if in_array(category_id, $category)} in your tpl), and theme it in this regard: personally I use the conditional to {include file=entry-twitter.tpl} instead of {include file=entry-default.tpl} (where entry-twitter.tpl is ad-hoc)
    b) exclude it from the main feed letting your users subscribe to /?x=feed:rss2;not:YOUR_CAT_ID

    the post contains the ID of the tweet as $subject and the text as $content; this hack is to avoid problems with the prettyurls plugin, but also lets you link to the actual tweet from your blog

    also, it caches the last post_id and last check time; the timestamps are saved as simple text files under CACHE_DIR (I don't know if it's worth turn them into config prefs, since they are actually cached data)

    the auto-post process hooks the 'shutdown' event instead of 'init', because the twitter server is slow and tends to go down which means long response time, which means your blog will look frozen on loading: using "shutdown" the page should be already be spit out completely, so your visitor shouldn't notice anything

    URLs are captured and turned into [url]myurl[/url] at the moment; a further extension might feed them into a [oembed=myurl] tag (see oembed plugin) and/or auto-recognize+turn into <img> images

    Caveats

    * the first visitor which will trigger the update process won't see your new tweet unless (s)he decides to refresh the page (I don't know if it's worth thinking about a way to fix this)
    * only the LAST tweet is posted, so if you tweet twice in a last_check period, only the last will be posted.
    * in order to keep it simple, PHP5 json functions are used, so, no luck for PHP4 here



    (the custom string to display post time -- which is pulled from twitter as well -- is just a simple function I've found on the web)
    •  
      CommentAuthorkierownik
    • CommentTimeJun 30th 2010 edited
     permalink
    Just downloaded the plugin and get this error after trying to update:

    Fatal error: Call to undefined function plugin_twitter_updatenow() in /home/*****/public_html/fp-plugins/twitter/plugin.twitter.php on line 186

    And it adds a twitter ID at the bottom of my page, see http://kierownik.nl

    It also adds the twitter ID as title of the post, could this be done differently?
    •  
      CommentAuthorNoWhereMan
    • CommentTimeJun 30th 2010 edited
     permalink
    Posted By: kierownikJust downloaded the plugin and get this error after trying to update:

    Fatal error: Call to undefined function plugin_twitter_updatenow() in /home/*****/public_html/fp-plugins/twitter/plugin.twitter.php on line 186


    fixed, thank you

    And it adds a twitter ID at the bottom of my page, seehttp://kierownik.nl


    where? do you mean under "Laatste 10 berichten" ? that's because it's showing the last title

    I left out a debug statement, now it shouldn't show up anymore :)

    It also adds the twitter ID as title of the post, could this be done differently?


    that's because you're not supposed to show that.

    here's what I do in my theme:

    index.tpl:
    {entry}
    {if $categories|@istweet} {* tweet *}
    {include file='entry-tweet.tpl'}
    {else}
    {include file='entry-default.tpl'}
    {/if}
    {/entry}



    (I've added a 'istweet' modifier for convenience)


    and here is my entry-tweet.tpl

    <code>
    {$date|date_format_daily:'<h2 class="date">%A, %B %e</h2>'}
    <div id="{$id}" class="entry twitter">
    {include file=shared:entryadminctrls.tpl}
    {* LOOK MA! NO TITLE *}
    <div class="entry-content">
    {$content|tag:the_content}
    </div> <!-- #entry-content -->

    <div class="footnotes">
    <a class="date" href="http://twitter.com/{$plugin_twitter_userid}/status/{$subject}">{$date|distanceOfTimeInWords} ago</a>
    - <a href="{$id|link:comments_link}#comments">{$comments|tag:comments_number}
    {if $views}(<strong>{$views}</strong> views){/if}</a>
    </div>
    </ul>
    </div>




    and finally, my CSS:



    .twitter p {
    margin:0 !important;
    }


    .twitter .footnotes {
    margin-top: .2em;
    height:18px;
    background: url(../imgs/16-twitter.png) no-repeat;
    display:block;
    }

    .twitter .footnotes .date {
    color:#888;
    padding-left:18px;
    }




    .footnotes {
    font-size: x-small;
    margin-top: 3em;
    border-top: 1px solid #ddd;
    }




    what would you rather do?
    •  
      CommentAuthorsvennid
    • CommentTimeJun 30th 2010
     permalink
    Hi NoWhereMan,

    Again my question is it possible to show all tweets on a static or separate page?

    Cheers

    Svennid
    •  
      CommentAuthorkierownik
    • CommentTimeJun 30th 2010 edited
     permalink
    Thanks NoWhereMan, almost everything worked :)

    I had to change line 197 from
    $this->smarty->assign('success', updatenow()? 2:3);
    to

    $this->smarty->assign('success', $_o->updatenow()? 2:3);
    because it still gave me the error that the function did not exist.

    The rest works like a charm, thanks for that.

    I have also translated it to dutch, how can I send you the file?
    •  
      CommentAuthorNoWhereMan
    • CommentTimeJun 30th 2010
     permalink
    thanks, fixed.

    if you use the template above, please be aware there was an error in entry-twitter.tpl, which is now fixed.

    there was a hardcoded link to my own twitter, now I've fixed the plugin to inject a handy {$plugin_twitter_userid} to your theme :) I've fixed the example accordingly

    bye
    •  
      CommentAuthorNoWhereMan
    • CommentTimeJun 30th 2010
     permalink
    Posted By: svennidHi NoWhereMan,

    Again my question is it possible to show all tweets on a static or separate page?

    Cheers

    Svennid


    it is not the purpose of this plugin. You can use the FrontPage plugin to hide the "tweets" category (i.e. the category you chose for tweets) from the frontpage. Hidden categories work only with the SVN version of FlatPress.
    •  
      CommentAuthorlaborix
    • CommentTimeAug 15th 2010
     permalink
    The german language pack for the Twitter plugin can be get here:

    Das deutsche Sprachpaket für das Twitter Plugin kann hier heruntergeladen werden:

    twitter-lang.de-de.zip