Hello =)
Jcow -> Documentation -> Customize your homepage
or click this link now: [url]http://www.jcow.net/docs/?s=custom_home[/url]
[quote]echo '<div class="block">
<div class="block_title">'.t('Photo albums').'</div>
<div class="block_content">'.get_list('photos','thumb').'</div>
</div>';
echo '<div class="block">
<div class="block_title">'.t('Blogs').'</div>
<div class="block_content">'.get_list('blogs').'</div>
</div>';
echo '<div class="block">
<div class="block_title">'.t('Videos').'</div>
<div class="block_content">'.get_list('videos','thumb').'</div>
</div>';
function get_list($app, $type = '') {
global $apps;
if ($type == 'thumb') {
$num = 4;
}
else {
$num = 10;
}
// 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 s.id DESC 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;
}[/quote]
|