
тоже модификация от 2-ой ветки
1.создаем фаил _percentage.php в корне
содержимое
<?
/*
-------------------------------------------------------------------------------
| id: _percentage.php
| version: 1.0
| begin: 23.04.2008
| modified: 23.04.2008 10:55 by Passtor - moded by shog
| copyright: 2008 Passtor
| description: Plug-in for SE. Shows percentage of complition of profile info
===============================================================================
*/
function show_percent($t_uid = 0)
{
global $database;
$t_total_rows = 20;
$t_row_ids = array();
// Check total profile rows.
for($i = 1; $i <= $t_total_rows; $i++)
{
$result = $database -> database_query("SELECT `profilevalue_$i` FROM `se_profilevalues`");
if($result != FALSE)
{
$t_row_ids[] = $i;
}
}
// Check filled rows
foreach($t_row_ids as $t_row)
{
$result = $database -> database_query("SELECT `profilevalue_$t_row` FROM `se_profilevalues` WHERE `profilevalue_user_id` = '$t_uid'");
if($result != FALSE)
{
list($t_value) = $database -> database_fetch_array($result);
}
else
{
$t_value = '';
}
if($t_value != '')
{
if(is_numeric($t_value))
{
if($t_value > 0)
{
$t_filled++;
}
}
else
{
$t_filled++;
}
}
}
// Calculating percentage
$t_amount = count($t_row_ids) / 100;
$out = round($t_filled / $t_amount, 1);
return $out;
}
?>
2.в profile.php находим
// ASSIGN VARIABLES AND INCLUDE FOOTER
перед ним вставляем
код:
// PROFILE PERCENT
include '_percentage.php';
$profile_percent = show_percent($owner->user_info[user_id]);
// END OF PERCENT
также после
// ASSIGN VARIABLES AND INCLUDE FOOTER
ставим
$smarty->assign('p_percent', $profile_percent);
3.в profile.tpl находим
код:
</table>
<table class='profile_menu' cellpadding='0' cellspacing='0' width='100%'>
{* SHOW PHOTOS OF THIS PERSON *}
перед ним вставляем PHP код:
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:10px;">
<tr>
<td style="border-top:1px solid #769C25; background-color: #eeeeee;" height="22px" valign="middle" align="left"><div style="position:absolute; float:right; overflow:visible; color: #769C25; font-weight:bold; width:200px; text-align:center; line-height:22px">{$p_percent}%</div><table width="{$p_percent}%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="background-color: #C7E38A; color: #769C25; font-weight:bold;" height="22px" valign="middle" align="right"></td>
</tr>
</table>
Комментарии (3)
RSS свернуть / развернутьMrGregord
MrGregord
russager
Только зарегистрированные и авторизованные пользователи могут оставлять комментарии.