the right way to add twitter - twitter

What is the best and efficient way to add twitter to a website?
There are some scripts in the web with iframes and others don't have a caching/streaming solution (what if twitter is temp. down...). So how should I add tweets to my website the right way?
By the way I just need the last x tweets and the "x minutes ago" (I want to make a custom style).
Thanks!

How about the widget that twitter provides for this very purpose? You can customize it right there on their page, then just copy the code, and paste it into your web page. Then you're ready to go.
No PHP required -- this is all javascript/html. You don't need caching -- if twitter is down, the widget will show a message to that effect. It'll be back up at some point, and your tweets will be shown again.
EDIT: The widget twitter provides has a header and footer, and you said you don't want to show those...
I used Safari's "Web Inspector" to look at the markup that is generated by the twitter widget (Firefox's FireBug would have worked just as well for this purpose). It looks like the header area and footer area use the css classes twtr-hd and twtr-ft respectively.
So you could just add a stylesheet rule to your page to hide those areas. Something like this:
.twtr-hd, .twtr-ft {
display:none !important;
}

Related

Retrieve/process/show wikipedia page in IOS application

I am going to show a mobile version of wikipedia page in my app.
The easiest way is to use UIWebView to show mobile view page, e.g. https://en.m.wikipedia.org/w/index.php?title=White_House
However I want to make certain changes to the page:
Remove the search bar.
remove all external links in the page.
while keep all format/image/layout unchanged.
I did some search. Seems I have to retrieve all contents in json with wikipedia API and reformat everything by myself.
Any easier way?
You can load the HTML, make "Find and replace" and remove whatever you want. (Modify the HTML itself.
After that you can load the HTML into the UIWebView.
Note: This might break when wikipedia will change it's webpage structure...

jquery mobile multi-page internal hyperlinking

This appears to be pretty basic but I can't figure it out.
Using a jqm multipage template, I'm trying to allow users to jump from a link one page (id='page1') directly to an image in another page (id='page2').
FIDDLE
It appears I am constrained, by html hyperlinking rules and jqm, to this:
<a href='#page2'>go to image on p2</a>
... which of course jumps the user to the top of page2.
But that's not what I want. I want the user to jump directly to the IMAGE, which is close to the bottom of page2, tagged like so:
<img id='image-id'>
But tagging the link with the image's id (not the page's id), i.e. tagging it like this
<a href='#image-id'>go to image on p2</a>
doesn't work.
I get the feeling I'm missing something very obvious, but can't figure it out.
Any suggestions? Or is this not possible?
I've got a different problem but found this question in my travels... thought I would add an extract from the jquery mobile page:
http://demos.jquerymobile.com/1.4.5/navigation-linking-pages/
Note: You cannot link to a multipage document with Ajax navigation active because the framework will only load the first page it finds, not the full set of internal pages. In these cases, you must link without Ajax (see next section) for a full page refresh to prevent potential hash collisions. There is currently a subpage plugin that makes it possible to load in multi-page documents.

How to make inline LabelFields

I'm working in a Blackberry app (OS 5.0) and need to show recent tweets of the user.
I'm able to get the data from Twitter's end. Now after parsing the entities (hashtags, urls, user-mentions etc), I need to display them with separate formatting (color, bold etc). So I'm using different LabelFields for different parts of the tweet.
But LabelFields are by default block elements. How do I put those LabelFields inline, so that it looks like how it is shown in Twitter?
like this:
Others have suggested RichTextField but you'd have to write your own text filter to colour the syntax - it's going to be a lot of effort. If having the clickable links inline is a must then personally I'd use a BrowserField but that would mean your logic would have to output a full screens worth of tweets into html (screens don't like having more than one browserfield - it's doable with more than one but there's some hacks) and manage the click events - more complications.
Alternatively you could do something like this: http://devblog.blackberry.com/2009/10/how-to-use-table-view-layout/ You wouldn't have clickable regions within the text body but it'd still be using native fields instead of 'cheating' with markup, probably the best way.
I've found that there's a component in Blackberry SDK called ActiveRichTextField which automatically scans its contents and parses links making them focusable and clickable. Furthur it'll also parse entities if Twitter app is installed in that device. For now it solves my problem. Thanks guys.

how to implement swf address navigation in struts 2

I want to implment swf address navigation in struts 2 like twitter and facebook navigation. I meant to say for each page user navigation header and footer and some common components across the websites will not be loaded for each user navigation. in some sites like twitter and facebook they have done with swf address implementation by concatinating '#' to current url for each user navigation with required pagename.so i want to implement same thing in struts 2. So how can i implement it.
I don't know what you mean by "swf" navigation; I only know swf as Flash, which neither Twitter nor Facebook use for navigation.
Why do you want a "#" in the URL? What do you think it does?
In any case, if what you're asking is really "How do I get only some parts of the UI to update during navigation", the answer is either Ajax, or iframes. (Personally, I think iframes are almost always wrong, especially with what modern JavaScript and CSS allow, but they have their uses.)
First of all I am not sure about the term SWF Address Navigation. Hash Bookmarking is a more common phrase for libraries that actually does this task.
This is a matter of client side programming and it has nothing to do with struts 2. There is a good jQuery plugin for that. It is called jQuery history plugin.
You can find lots of other libraries and the best choice depends on your application requirements.

sIFR in Javascript news rotator?

I'm using sIFR on a website that is database driven and it works great. However, I have a news rotator on the home page and sIFR won't replace the text on the tile below the rotating image, so I have to create images for this each time.
Example of the site is http://www.aucklandcityfc.com. Put home.asp on the end of the URL to see what it looks like trying to run sIFR by default.
What I'd like to be able to do is use sIFR to replace that text as well, and then other people can add stories through the CMS.
Alternatively, if there's a better rotator (or possibly a Flash application) that anyone knows of, please let me know.
Thanks,
Adam
You can insert the new text and then replace the element again; or use the replaceText API method to change the text inside an existing sIFR Flash movie.

Resources