I have been trying to advance myself, I am a 3d graphics major but I would love to be able to do websites etc as well. So Last year I took on the task to learn HTML etc. I am having a blast, and have been working on 2 hobbies at once. I created a website for my team on the video game World of Warcraft. It has been pretty basic up until the developer announced that it's releasing its "Community API" using JSON and PHP etc.
So I have spent last week trying to get familiar with the AP
http://www.judgement-firetree.com/test/index_test.php
I am stuck now with one problem, and its very minor....here is the code.
Code: Select all
<?php
// your Guild Activity feed goes here
$json = file_get_contents('http://wowfeeds.wipeitau.com/GuildActivity.php?location=US&rn=Firetree&gn=Judgement&callback=?');
// strip the return json of unneeded characters
$json = str_replace(')', '', $json);
$json = str_replace('(', '', $json);
$json = str_replace('Achievement', 'achievement', $json);
$json = str_replace('Item', 'item', $json);
$json = substr($json, 1);
// decode the json into objects
$data = json_decode($json);
echo '<p>';
// guildactivity is a collection of objects
// properties list
// name -> name of the character who is tied with the activity
// type -> what kind activity is this
// numId -> numId attached to the activity (you need this if you want to link to the WoW API)
// achText -> the text which typically follows the character to describe the activity
// achObjective -> the objective reached
// achImage -> the full URL fo the achievement image
// achTime -> when the achievement occured
// this loop outputs each achievement as a line
foreach ($data->guildActivity as $activity)
{
echo '<img src="' . $activity->achImage . '">' .
'<a target="_new" href="http://us.battle.net/wow/en/character/' . $data->realmName . '/' . $activity->name . '/simple">' . $activity->name . '</a> ' .
$activity->achText . ' ' .
'<a href="http://www.wowhead.com/' . $activity->type . '=' . $activity->numId . '">' . $activity->achObjective . '</a>' .
' (' . $activity->achTime . ') ' .
'<br />'
;
}
echo '</p>';
?>
Code: Select all
'<a href="http://www.wowhead.com/' . $activity->type . '=' . $activity->numId . '">' . $activity->achObjective . '</a>' .<a href="http://www.wowhead.com/achievement=
<a href="http://www.wowhead.com/item=
Now here is my question...
Is there any possible...SIMPLE...way to have the links that come from:
<a href="http://www.wowhead.com/achievement= to be styled as a yellow color
AND
<a href="http://www.wowhead.com/item= to be styled as a purple color
when printed as links?