• 0

Twitter On My Website


Question

8 answers to this question

Recommended Posts

  • 0

Okay so here is my code

<script src="https://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
  version: 2,
  type: 'profile',
  rpp: 1,
  interval: 4000,
  width: 250,
  height: 100,
  theme: {
    shell: {
      background: '#ffffff',
      color: '#ffffff'
    },
    tweets: {
      background: '#ffffff',
      color: '#000000',
      links: '#f7b900'
    }
  },
  features: {
    scrollbar: false,
    loop: false,
    live: false,
    hashtags: true,
    timestamp: true,
    avatars: false,
    behavior: 'default'
  }
}).render().setUser('richardmhowell').start();
</script>

how do remove the twitter logo and my own avatar from the top :angry:

Link to comment
Share on other sites

  • 0

You can use Javascript and/or CSS to adjust the layout.

Alternatively, you can use your Twitter RSS feed and display it with PHP. That way you're in control of what is

displayed, and how it is displayed.

Link to comment
Share on other sites

  • 0

You can use Javascript and/or CSS to adjust the layout.

Alternatively, you can use your Twitter RSS feed and display it with PHP. That way you're in control of what is

displayed, and how it is displayed.

Now we are talking, do you know how to do such a thing?

Link to comment
Share on other sites

  • 0

Using PHP is a bad idea as it will slow down your site slightly, use jQuery instead.

For example, in my site I use

$.getJSON to parse the tweets.

$(document).ready(function(){
 $.getJSON( "http://twitter.com/status/user_timeline/YOURUSERNAME.json?count=5&callback=?", function(data){ $('#tweets ul').html(''); $.each( data, function(i, item) { var tweet = item.text .replace(/(https?:\/\/[-a-z0-9._~:\/?#@!{:content:}amp;\'()*+,;=%]+)/ig,'<a href="$1">$1</a>') .replace(/@+([_A-Za-z0-9-]+)/ig, '<a href="http://twitter.com/$1">@$1</a>') .replace(/#+([_A-Za-z0-9-]+)/ig, '<a href="http://search.twitter.com/search?q=$1">#$1</a>') ; $('<li></li>').html(tweet).appendTo('#tweets ul'); $('#tweets span').removeClass('true').addClass('false'); $('#tweets p').hide(); } ); } ); });

but you need to modify it to work well with your site. :)

If you want to get it fast, like I did last time. Use this: http://coda.co.za/bl...gin-for-twitter

It works great!

EDIT: sorry about the code, I don't know what happened.

View my whole script here instead:

http://manmohanjit.com/template/default/files/script.js

Link to comment
Share on other sites

  • 0

EDIT: sorry about the code, I don't know what happened.

View my whole script here instead:

http://manmohanjit.com/template/default/files/script.js

im no expert, so please educate me if im speaking incorrectly, but how is JQuery faster than PHP, which is rendered server side rather than client side? i would think it would be the other way around. also, wouldn't it make more sense to code something in PHP rather than javascript of any kind because not all users will have javascript enabled? at least thats the way ive always thought of things...

to the original poster: ive been messing around with some of the twitter api's lately and its very simple stuff if you ever wanted to sit down a day and code your own script for showing your twitter feed.

Link to comment
Share on other sites

  • 0

im no expert, so please educate me if im speaking incorrectly, but how is JQuery faster than PHP, which is rendered server side rather than client side? i would think it would be the other way around. also, wouldn't it make more sense to code something in PHP rather than javascript of any kind because not all users will have javascript enabled? at least thats the way ive always thought of things...

to the original poster: ive been messing around with some of the twitter api's lately and its very simple stuff if you ever wanted to sit down a day and code your own script for showing your twitter feed.

Using PHP:

First, it will get the content data. Then it will get the tweets(probably using file_get_contents_, then you will need to format the json/xml. After that, the page will load.

Using Javascript:

First, the content will load(server side). The page is then displayed. Then once the browser loads the Javascript file. Using jQuery's engine, you can easily parse the tweets and append it to a DIV.

This will speed up the loading of the site but not the loading of the tweets.

There is nothing wrong doing it using PHP.

I don't know but I prefer Javascript more, I focus more towards the content.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.