SimplePortal
Support => International Support => Portuguese => Topic started by: Costa on November 01, 2008, 10:21:21 AM
-
Criem um bloco de PHP, e de seguida coloquem o seguinte código PHP
global $context, $scripturl, $boarddir;
require_once($boarddir.'/SSI.php');
if (!smf_loadCalendarInfo() || empty($context['calendar_birthdays']))
return array();
foreach ($context['calendar_birthdays'] as $member)
echo '
<a href="', $scripturl, '?action=profile;u=', $member['id'], '">' . $member['name'] . (isset($member['age']) ? ' (' . $member['age'] . ')' : '') . '</a>' . (!$member['is_last'] ? ', ' : '');
Se houverem aniversariantes, será mostrado no Portal
Farebem
- Costa
-
:D
Obrigada por mais este... tá a funcionar.
Agora uma pergunta...
Ele ta a mostrar aniversariantes do dia 13 Nov e hoje estamos a 7 Nov... Não seria só no proprio dia?
PS: Vai colocando mais uns códigos... são fixe!
-
Ele mostra os aniversários que se passaram na próxima semana, tal como o calendário ;)
Este mostra os avatares e a idade que fazem ;)
$current_date = getdate();
$month_number = sprintf("%02d", $current_date['mon']);
$justify = 'left'; // Valid options: 'left', 'center', or 'right'
$limit = 0; // Integer value for length of list
$avatar_on = true; // Use avatar in output: true or false
$avatar_height = '45'; // Set height of avatar
$avatar_width = '45'; // Set width of avatar
$blank_image = 'http://www.abcdefghijklmnop/images/blank_1x1.gif'; // URL to where you placed the blank avatar file...
$display_age = true; // Display member's age: true or false
// Warranty void if edited past this line! ;)
if(!empty($_GET['justify'])) $justify = $_GET['justify'];
if(!empty($_GET['limit'])) $limit = $_GET['limit'];
if(!empty($_GET['month'])) $month_number = $_GET['month'];
if(!empty($_GET['day'])) $current_date['mday'] = $_GET['day'];
if($limit == 0) $count = -1;
global $db_prefix, $scripturl;
$query = db_query(
"SELECT ID_MEMBER, memberName, birthdate
FROM {$db_prefix}members
WHERE birthdate LIKE '%-%$month_number%-%'
AND birthdate NOT LIKE '0001-01-01'
ORDER BY birthdate ASC", __FILE__, __LINE__);
while (($row = mysql_fetch_array($query)) && ($count < $limit))
{
if($limit != 0) $count++;
if(empty($row['birthdate'])) return;
$dob_year = strtok($row['birthdate'], '-');
$dob_month = strtok('-');
$dob_day = strtok('-');
$age = sprintf("%2d", ($current_date['year'] - $dob_year));
if($current_date['mday'] <= $dob_day)
{
if($current_date['mday'] == $dob_day)
{
$class = 'highlight';
}
else
{
$class = '';
}
$current_ID = $row['ID_MEMBER'];
$avatar = '';
if($avatar_on) // query to retrieve member's avatar # in attachment directory; bypass if avatar_on = false
{
$avatar = '<img src="' . $blank_image . '" height="' . $avatar_height . '" width=" '. $avatar_width . '" border="0" />';
$query2 = db_query(
"SELECT ID_ATTACH
FROM {$db_prefix}attachments
WHERE ID_MEMBER = '$current_ID'", __FILE__, __LINE__);
$result = mysql_fetch_array($query2);
if(!empty($result['ID_ATTACH']))
{
$avatar = '<img src="' . $scripturl . '?action=dlattach;attach=' . $result['ID_ATTACH'] .
';type=avatar" height="' . $avatar_height . '" width=" '. $avatar_width . '" border="0" />';
}
else
{
$query3 = db_query(
"SELECT avatar
FROM {$db_prefix}members
WHERE ID_MEMBER = '$current_ID'", __FILE__, __LINE__);
$result = mysql_fetch_array($query3);
if(!empty($result['avatar']))
{
$avatar = '<img src="' . $modSettings['avatar_url'] . '/' . $result['avatar'] . '" height="' .
$avatar_height . '" width=" '. $avatar_width . '" border="0" />';
}
}
}
$link = '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">';
if($display_age)
{
$age = ' (' . $age . ') ';
}
else
{
$age = ' ';
}
if(strtolower($justify) == 'left')
{
echo'<div class="smalltext" align="left"><span class="'.$class.'">';
echo $link . $avatar . '</a>' . $age . $link . $row['memberName'] . '</a>';
echo '</span></div>';
}
elseif(strtolower($justify) == 'right')
{
echo'<div class="smalltext" align="right"><span class="'.$class.'">';
echo $link . $row['memberName'] . '</a>';
echo $age . $link . $avatar . '</a></span></div>';
}
elseif(strtolower($justify) == 'center')
{
echo'<div class="smalltext" align="center"><span class="'.$class.'">';
echo $link . $avatar . '</a> ' . $link . $row['memberName'] . '</a>';
echo $age . '</span></div>';
}
else
{
echo '<b>Invalid justification specified: ("'.$justify.'")</b><br>';
echo 'Use "left", "center", or "right" for script.<hr>';
die();
}
}
}
-
:D
Obrigada Costa és fantastico
Olha este ultimo é muita loco!
E fiquei esclarecida quanto á informação semanal... thanks
PS: Costa se tiveres mais codigos... novidades e fixes publica!
-
Disponha Mariluz, estamos aí pra isso
E viva o Benfica! hehehe
-
:D
Viva o Benfica sempre!!! He he
Na te esqueças de nos dar novidades.
PS: Olha tou precisando de ajuda... vai lá ver smf
-
mto bom o codigo costa,interessante o de mostrar o avatar,pq não adiciona ele no ZS?
:D
-
Pro Street, Aqui é o fórum de suporte do Simple Portal, não o Fórum Zona Sport.
Favor de não desvirtuar o tópico.
Att