What is a way to use @mentions on a website using PHP, JavaScript, or jQuery?
-
I am in the process of creating a website, and I'm wondering how can I use @mentions using PHP or JavaScript or jQuery? jQuery would be preferable, since it's fast and easy to use. But if there is no way of implementing it using jQuery or JavaScript I wouldn't mind using PHP.
-
Answer:
You should use JavaScript (with or without jQuery) and PHP. 1) In JS you identify the "@" and displays suggestions typed according to the users available is displayed. You can use the jQuery autocomplete: http://docs.jquery.com/Plugins/autocomplete 2) The suggestion, of course, must come from the database, so you'll need to use PHP to serve a page. You choose: either to request that list when the page loads, or order by AJAX when the user enters the "@".
Shankar Cabus at Quora Visit the source
Other answers
You might want to take a look at the official "Twitter text" libraries if you would like to match the familiar use in Twitter status messages. https://github.com/mzsanford/twitter-text-php
Niall Kennedy
Describing your intended functionality would be helpful. If you just want to display tweets that mention your site, you can use the Twitter Search Widget. In that case "@mysite" would be the search query. http://twitter.com/about/resources/widgets/widget_search If you want to get mentions for names users enter (or you supply dynamically), that can easily be done entirely with jQuery and the Twitter Search API. http://search.twitter.com/api/ Here's an example. $( function () { var username = 'mashable'; $.getJSON( 'http://search.twitter.com/search.json?q=%40' + username + '&callback=?', function ( response ) { $( response.results ).each( function ( i, result ) { var html = '<div>' + '<a href="http://twitter.com/' + result.from_user + '"><b>' + result.from_user + '</b></a> ' + result.text + ' ' + '<a href="http://twitter.com/' + result.from_user + '/status/' + result.id_str + '">' + result.created_at + '</a>' + '</div>'; $( 'body' ).append( html ); } ); } ); } ); To store the results, or anything else, you'd need to get PHP involved.
Todd Iceton
Related Q & A:
- What is a good way to break in a snowboard?Best solution by answers.yahoo.com
- What are the pros and cons of buying a house using an FHA loan?Best solution by Personal Finance and Money
- What is a good camcorder to use as a webcam?Best solution by tomshardware.com
- What is a inexpensive way to advertise for a small business?It is handyman work?Best solution by Yahoo! Answers
- What is a good topic to use for a research paper?Best solution by wiki.answers.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.