TinyPortal

Development => Block Codes => Topic started by: iGate on June 27, 2008, 04:16:35 PM

Title: Awards mod sumary table.
Post by: iGate on June 27, 2008, 04:16:35 PM
hey all.

i love this mod.
http://custom.simplemachines.org/mods/index.php?mod=475

i was wondering if someone could make me a summary page of all the awards plus who has them for use in an article. i know this takes effort so ive tried to help (in non-coding ways).

i want the article to have (in this format):
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fi123.photobucket.com%2Falbums%2Fo293%2FiGate%2Fformat.jpg&hash=f489cdfb20872d743af22ad786e4f7314aa72e0c)
-----------
i understand that this takes effort, but im hoping it may become easier by copying and pasting some of the code used to produced the page screenshotted below.
http://i123.photobucket.com/albums/o293/iGate/awards.jpg (http://i123.photobucket.com/albums/o293/iGate/awards.jpg)
(i linked to it save bandwidth on forums :D )

okay thanks in advance guys.

PS: if u need more info or anything just post here and ill check back soon.
Title: Re: Awards mod sumary table.
Post by: Dragooon on June 27, 2008, 05:59:35 PM
Try this
// Lists all the awards and shows who have them
global $db_prefix, $modSettings, $boardurl, $scripturl;
// First get all the awards
$request = db_query("
SELECT ID_AWARD, gameName, awardName, filename
FROM {$db_prefix}awards",__FILE__,__LINE__);
$awards = array();
while($row = mysql_fetch_assoc($request))
{
$awards[$row['ID_AWARD']] = array(
'id' => $row['ID_AWARD'],
'name' => $row['awardName'],
'desc' => parse_bbc($row['gameName']),
'image' => $boardurl.'/'.$modSettings['pa_awardsDir'].'/'.$row['filename'],
'members' => array(),
);
$request_mem = db_query("
SELECT mem.ID_MEMBER, mem.realName
FROM {$db_prefix}members AS mem
INNER JOIN {$db_prefix}awards_members AS am ON (am.ID_MEMBER = mem.ID_MEMBER AND am.ID_AWARD = $row[ID_AWARD])",__FILE__,__LINE__);
while($row_mem = mysql_fetch_assoc($request_mem))
$awards[$row['ID_AWARD']]['members'][] = '<a href="'.$scripturl.'?action=profile;u='.$row_mem['ID_MEMBER'].'">'.$row_mem['realName'].'</a>';
mysql_free_result($request_mem);
}
mysql_free_result($request);

// Output it!
echo '
<table cellpadding="6" cellspacing="0" width="100%" border="0" class="bordercolor">';
foreach($awards as $award)
echo '
<tr>
<td colspan="3" class="titlebg">',$award['name'],'</td>
</tr>
<tr>
<td class="windowbg" width="25%"><img src="',$award['image'],'" /></td>
<td class="windowbg" width="25%">',$award['desc'],'</td>
<td class="windowbg">',implode(', ',$award['members']),'</td>
</tr>';
echo '</table>';
Title: Re: Awards mod sumary table.
Post by: iGate on June 28, 2008, 02:48:58 AM
wow dragoon...u are truly awesome.
thanks.

for anyone who wants to see it in action: http://ihf.lp.pl/index.php?page=39
*i did modify the table widths a bit, and centered the images.

A BIG THANKYOU.

one question.
How do u add a header which says "=IHF= Medals" and is centered. ( ihave disbaled "use the theme frame" option in the tp admin to make more space for it.
i tried doing this but it kept coming up for each individual medal, and i wanted it just at the top.
Title: Re: Awards mod sumary table.
Post by: Ken. on June 28, 2008, 02:55:48 AM
Looks great.  :up:

Good job Dragooon & iGate.  :up:
Title: Re: Awards mod sumary table.
Post by: IchBin on June 28, 2008, 03:47:24 AM
Add your table or div etc before this line to make it above the output.
<table cellpadding="6" cellspacing="0" width="100%" border="0" class="bordercolor">';
Title: Re: Awards mod sumary table.
Post by: Dragooon on June 28, 2008, 05:16:38 AM
Glad you liked it :D
Title: Re: Awards mod sumary table.
Post by: pauls_uk on August 12, 2008, 02:54:13 AM
Thank you so much this is great.Yesterday i made a list of all my members names then u had to click on there name to see what awards they have this is brilliant thank you so much  ;)
Title: Re: Awards mod sumary table.
Post by: pauls_uk on August 17, 2008, 04:52:49 AM
Is there a way this can be edited so when we click on a members name from the awards it shows all there awards rather than there profile?
Title: Re: Awards mod sumary table.
Post by: pauls_uk on August 21, 2008, 10:51:37 PM
I guess there is not a way of doing the above then  ;)
Title: Re: Awards mod sumary table.
Post by: pauls_uk on August 22, 2008, 02:22:17 PM
Sorted this out thanks for getting back to me everyone  :2funny:
Title: Re: Awards mod sumary table.
Post by: Ghostwriter on October 07, 2008, 03:37:35 PM
I was wondering if this could be adjusted to show one or two awards or even a random award with those who have it?