September 18, 2018, 07:36:22 PM

1,529,740 Posts in 45,885 Topics by 1,011 Members
› View the most recent posts on the forum.


Last.fm thing

Started by Khadafi, July 27, 2009, 07:43:34 PM

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

Go Down

Petro

This is basically what it loooks like with album art, and there's a link to the song if you click on the picture/text.



Just my opinion, but it doesn't seem that much more obtrusive.

Khadafi

Quote from: Petro on July 28, 2009, 12:28:43 PM
This is basically what it loooks like with album art, and there's a link to the song if you click on the picture/text.



Just my opinion, but it doesn't seem that much more obtrusive.
What if there is no image baddood;

Also what is the line lol

Petro

Quote from: Prowling Kewn on July 28, 2009, 12:35:41 PM
What if there is no image baddood;

Also what is the line lol
It's the signature line.

It displays this if there's no image:


Only smaller. baddood;

Khadafi

Quote from: Petro on July 28, 2009, 12:40:18 PM
It's the signature line.

It displays this if there's no image:


Only smaller. baddood;
No i meant the line of code lol

Petro

July 28, 2009, 04:17:08 PM #34 Last Edit: July 28, 2009, 05:27:03 PM by Placebo Headwound
Quote from: Prowling Kewn on July 28, 2009, 01:27:50 PM
No i meant the line of code lol

Place this in Display.template.php
[spoiler]
Code Select
//Last.fm listening mod

// We need to determine what their last.fm username is
$lastuser = @mysql_result(mysql_query("SELECT value FROM smf_themes WHERE variable='last' AND id_member='" .  $message['member']['id'] . "'"),0);
// Do they have a last.fm username?
$emptyornot = empty($lastuser);

// And now to display what the user is listening to.
if( $emptyornot != 1)
{
// The last.fm username you want to get data for.
$username = $lastuser;

// Your Last.fm API Key.
$apikey = 'YOURAPIKEYGOESHERE'
// This tells the script what method to use to get the data from last.fm.
// Different methods and examples are documented under "methods" below.
$method = 'RecentTracks';

// Custom Formatting. In the example below, [url] is converted into the track
// URL on last.fm, [name] into the track name and [artist] into the track's artist.
// Refer to the documentation for that method below for formatting options.
$formatting = '<a href="[url]"><img align="right" src="[medium]" height="50px" width="50px">[name] - [artist]</a><br>';

// Number of recent tracks you want to show. (Leave blank for maximum)
$number = '1';

// URL for image if no album/track art. (Leave blank for last.fm default)
$defaultart = '';

// GMT hour offset. (0 or blank means keep the time at GMT, -5 makes the time EST etc.)
$offset = '-5';

include('lfmfuncs.php');
lastfmdata($method,$username,$apikey,$formatting,$number,$defaultart,$offset);
}
[/spoiler]
And put this in the root of your forum.
http://source.aelabs.net/downloads/lfmfuncs.php

Daphnia


Khadafi

Quote from: Petro on July 28, 2009, 04:17:08 PM
Place this in Display.template.php
[spoiler]
Code Select
//Last.fm listening mod

// We need to determine what their last.fm username is
$lastuser = @mysql_result(mysql_query("SELECT value FROM smf_themes WHERE variable='last' AND id_member='" .  $message['member']['id'] . "'"),0);
// Do they have a last.fm username?
$emptyornot = empty($lastuser);

// And now to display what the user is listening to.
if( $emptyornot != 1)
{
// The last.fm username you want to get data for.
$username = $lastuser;

// Your Last.fm API Key.
$apikey = 'YOURAPIKEYGOESHERE'
// This tells the script what method to use to get the data from last.fm.
// Different methods and examples are documented under "methods" below.
$method = 'RecentTracks';

// Custom Formatting. In the example below, [url] is converted into the track
// URL on last.fm, [name] into the track name and [artist] into the track's artist.
// Refer to the documentation for that method below for formatting options.
$formatting = '<a href="[url]"><img align="right" src="[medium]" height="50px" width="50px">[name] - [artist]</a><br>';

// Number of recent tracks you want to show. (Leave blank for maximum)
$number = '1';

// URL for image if no album/track art. (Leave blank for last.fm default)
$defaultart = '';

// GMT hour offset. (0 or blank means keep the time at GMT, -5 makes the time EST etc.)
$offset = '-5';

include('lfmfuncs.php');
lastfmdata($method,$username,$apikey,$formatting,$number,$defaultart,$offset);
}
[/spoiler]
And put this in the root of your forum.
http://source.aelabs.net/downloads/lfmfuncs.php

That seems really convoluted lol.

What about index.php?

Petro

Quote from: Prowling Kewn on July 28, 2009, 11:17:05 PM
That seems really convoluted lol.

What about index.php?
It's no longer necessary in index.template.php or index.php if you do what I did above.

Go Up