Latest twitter post on your web page

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
gap_tooth_clan

Latest twitter post on your web page

Post by gap_tooth_clan »

Many web sites I create have a latest twitter feed on them. I also wanted my twitter feed links to work aswell.

I used to use rss2html but it kept erroring so came up with this solution instead.

1. Install XML Made Simple

2. Add your feed http://twitter.com/statuses/user_timeline/example.rss

3. Create a new template called default

Code: Select all

{capture assign="twitterDesc"}{$xml->channel->item->description}{/capture}

‘{makeClickable textConvert=$twitterDesc}’
4. Create a UDT called make clickable

Code: Select all

$text = $params['textConvert'];

$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '<a href="\\1">\\1</a>', $text);

$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)', '\\1<a href="http://\\2">\\2</a>', $text);

$text = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})', '<a href="mailto:\\1">\\1</a>', $text);

return $text;

Credit for this code from here http://www.totallyphp.co.uk/code/conver ... rlinks.htm

5. add your tag to your template

{cms_module module="XMLMadeSimple" feed_id="1" template="default"}
Post Reply

Return to “Tips and Tricks”