skip to main
|
skip to sidebar
home
Blog Tricks
Blogger Tricks
download template
contact us
edit link
edit link2
How to display photos, notes, and video on the sidebar Dashboard
open the
dashboard.module.php
in includes / libs /
find this code:
Code
block(
friends_birthday()
);
and then add this after that :
Code
block(
fotovideoblogs()
);
add this function
on the last line
Code
function fotovideoblogs() {
$content .= '<div class="block">
<div class="block_title">'.t('Blogs').'</div>
<br/><div class="block_content">'.get_lists('blogs').'</div>
</div><br />
<div class="block">
<div class="block_title">'.t('Photo albums').'</div>
<br/><div class="block_content">'.get_lists('photos','thumb').'</div>
</div><br />
<div class="block">
<div class="block_title">'.t('Videos').'</div>
<br/><div class="block_content">'.get_lists('videos','thumb').'</div>
</div>
';
return array(''=>t('Photos, Videos, Blogs'), 'content' => $content);
}
add this function on dashboard.module.php
Code
function get_lists($app, $type = '') {
global $apps;
if ($type == 'thumb') {
$num = 1;
}
else {
$num = 8;
}
// total
$res = sql_query("select count(*) as total from `".tb()."stories` where app='$app'");
$row = sql_fetch_array($res);
$total = $row['total'];
$res = sql_query("SELECT s.*,u.username FROM `".tb()."stories` as s LEFT JOIN `".tb()."accounts` as u ON u.id=s.uid where s.app='$app' ORDER BY RAND() limit $num");
if ($type == 'thumb') {
$content .= '<table width="100%"><tr>';
while ($row = sql_fetch_array($res)) {
if (!$row['thumbnail']) {
if ($app == 'music') {
$row['thumbnail'] = 'uploads/userfiles/undefined_song.gif';
}
else {
$row['thumbnail'] = 'uploads/userfiles/undefined.jpg';
}
}
$content .= '<td align="center">'.url($row['app'].'/viewstory/'.$row['id'],htmlspecialchars(utf8_substr($row['title'],20))).'<br />
<a href="'.url($row['app'].'/viewstory/'.$row['id']).'"><img class="thumb" src="'.uhome().'/'.$row['thumbnail'].'" /></a></td>';
}
$content .= '</tr></table>';
}
else {
$content .= '<ul class="simple_list">';
while ($row = sql_fetch_array($res)) {
$row['content'] = preg_replace("/\[\w+](.*)\[\/\w+]/isU","\1",$row['content']);
$row['content'] = strip_tags(utf8_substr($row['content'],90));
$content .= '<li><strong>'.url($row['app'].'/viewstory/'.$row['id'],htmlspecialchars(utf8_substr($row['title'],60))).'</strong>
<span class="sub">'.get_date($row['created']).', by '.url('u/'.$row['username'],$row['username']).'</span><br />
<span class="sub">'.$row['content'].'</span></li>';
}
$content .= '</ul>';
}
return $content;
}
place on the last line
0 komentar:
Posting Komentar
Posting Lebih Baru
Posting Lama
Beranda
Langganan:
Posting Komentar (Atom)
Labels
Asal Nulis
(1)
bacaan menarik
(4)
Dunia Maya
(3)
Jcow
(1)
Mitos
(4)
Situs Jejaring Sosial
(1)
Rank
Friends Link
Recent post
©
Grunge Theme
Copyright by
rizky rionaldy
| Template by
Blogger Templates
| Blog Trick at
Blog-HowToTricks
0 komentar:
Posting Komentar