November 21, 2024, 01:39:41 PM

1,531,352 Posts in 46,734 Topics by 1,523 Members
› View the most recent posts on the forum.


Last.fm thing

Started by Daddy, July 27, 2009, 04: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.

Daddy

Quote from: Petro on July 28, 2009, 09:28:43 AM
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, 09:35:41 AM
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;

Daddy

Quote from: Petro on July 28, 2009, 09:40:18 AM
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, 01:17:08 PM #34 Last Edit: July 28, 2009, 02:27:03 PM by Placebo Headwound
Quote from: Prowling Kewn on July 28, 2009, 10:27:50 AM
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


Daddy

Quote from: Petro on July 28, 2009, 01: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, 08: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