PDA

View Full Version : How do I convert this Mod for vBadvvanced Homepage to CMPS?


Sidewindr
07-27-2004, 10:52 PM
I have just upgraded to CMPS from homepage and am having some difficulty in porting this "Top 5 Times" adon to a CMPS Module. Can anyone help me please! ? :) Any help would be greatly appreciated...


##### Top Five 1/4 Mile ETs vB Advanced Homepage Add-on -By EvilLS1 #####


###### Instructions

###### In your vbadvanced index.php find:

'postbit_attachment',


###### Replace it with:

'postbit_attachment',
'times',
'toptimes',


###### Find:

// All done!


###### Above it add:

// Top Times add-on
$pos = 0;
$users=$DB_site->query("SELECT *
FROM " . TABLE_PREFIX . "user AS user, " . TABLE_PREFIX . "userfield AS userfield
WHERE user.userid = userfield.userid
AND userfield.field55>0
ORDER BY userfield.field55 ASC
LIMIT 5");

// Set up vars
while ($userinfo=$DB_site->fetch_array($users)) {
$pos++;
$rank= number_format($pos);
$TDusername= $userinfo[username];
$ride= $userinfo[field50];
if ($userinfo[field52]>0){
$sixty= $userinfo[field52];
}else{
$sixty="";
}
if ($userinfo[field55]>0){
$quarter= $userinfo[field55];
}else{
$quarter="";
}
if ($userinfo[field56]>0){
$atmph2="@";
}else{
$atmph2="";
}
if ($userinfo[field56]>0){
$quartermph= $userinfo[field56];
}else{
$quartermph="";
}
eval('$times .= "' . fetch_template('times') . '";');
} // end while
eval('$toptimes .= "' . fetch_template('toptimes') . '";');



###### Create a new template named "toptimes" and add the HTML below:

<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr id="cat">
<td colspan="5" class="tcat" width="100%"><span class="smallfont"><b>»Top Five 1/4 Mile ETs</b></span></td>
</tr>
<tr>
<td class="alt2" align="center"><span class="smallfont"><b>#</b></span></td>
<td class="alt2" align="center"><span class="smallfont"><b>Username</b></span></td>
<td class="alt2" align="center"><span class="smallfont"><b>Ride</b></span></td>
<td class="alt2" align="center"><span class="smallfont"><b>60'</b></span></td>
<td class="alt2" align="center"><span class="smallfont"><b>1/4 Mile ET &MPH </b></span></td>
</tr>
$times
</tr>
<td class="tcat" colspan="5"><span class="smallfont"><CENTER>[<a href=$vboptions[bburl]/timeslips.php>Click here to view the complete list</a>]</CENTER></span></td>
</tr>
</table>
<br />



###### Create a new template named "times" and add the HTML below:

<tr>
<td class="alt1" align="center"><span class="smallfont">$rank</span></td>
<td class="alt1" align="center"><span class="smallfont"><a href="$vboptions[bburl]/member.php?$session[sessionurl]u=$userinfo[userid]">$TDusername</a></span></td>
<td class="alt1" align="center"><span class="smallfont">$ride</span></td>
<td class="alt1" align="center"><span class="smallfont">$sixty</span></td>
<td class="alt1" align="center"><span class="smallfont">$quarter$atmph2$quartermph</span></td>


###### In your vB Advanced index template put $toptimes where ever you want the Top Five ETs module to show up.


###### Done! You can alter the userfield ID #s to show or order by other fields if you'd like.

apokalupsis
07-28-2004, 12:42 AM
Not sure how far you've gotten, but remember these basics:

Name your template: adv_portal_toptimes. Just "toptimes" won't work.

Create a module that refers to it (named: Top 5 Times).
Create a page, or edit a page, that refers to the above module you just created.

Our Sponsors
 

Sidewindr
07-28-2004, 01:56 AM
I did that and I got the header and footer for the times .. however I could not get the top 5 times to display. They are generated in the .php file and the times template is used to display them.