-
25 Jul 2010 11:59 PM #11
Works good now, just replace with a non greedy match
Code:tweets[i].text = tweets[i].text.replace(/(http:\/\/)(.*?)\s/gi, '<a href="$1$2">$1$2</a>');
Dan Vega
http://www.danvega.org
-
19 Jun 2011 9:34 AM #12
Successfully used with Ext.List
Successfully used with Ext.List
Hey guys,
thanks for the advice, prepareData also works with Ext.List in the way described.
This is what works for me:
Code:var list = new Ext.List({ prepareData : function(data) { data.text = data.text.replace(/(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim, '<a href="$1" target="_blank">$1</a>') data.text = data.text.replace(/(@)([A-Za-z0-9_-]*)/gi, '<a href="http://twitter.com/$2" target="_blank">$1$2</a>') data.text = data.text.replace(/(#)([A-Za-z0-9_-]*)/gi, '<a href="http://twitter.com/#!/search/%23$2" target="_blank">$1$2</a>') return data; }, store: app.stores.tweets, plugins: [{ ptype: 'pullrefresh', autoPaging: true, loadingText: 'Lade...', pullRefreshText: 'Aktualisiert', releaseRefreshText: 'Loslassen...', snappingAnimationDuration: 1000 }], itemTpl: [ '<div class="tweet">', '<div class="tweet-lcol">', '<img src="{profile_img}" />', '<p class="tweet-date">{created_at:date("d.m.Y")}</p>', '</div>', '<p class="tweet-text tweet-rcol">{text}</p>', '</div>' ] })
Similar Threads
-
How do I create a a simple list of links?
By kohalza in forum Ext 2.x: Help & DiscussionReplies: 4Last Post: 9 Aug 2012, 2:12 AM -
How to create links in templates?
By Dumas in forum Ext 3.x: Help & DiscussionReplies: 8Last Post: 19 Jul 2010, 6:38 AM -
How to create add links on tree's child nodes generated from databases using php
By junjua in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 15 Jul 2009, 12:46 AM -
howto create a tabpanel with links dynamically
By Mario Minati in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 21 Jul 2008, 7:42 AM -
How to create menu items like the "Quick Links" above?
By pnfsjp in forum Ext 1.x: Help & DiscussionReplies: 0Last Post: 25 Sep 2007, 8:18 PM


Reply With Quote