CONTACT US
Jcow Documentation>>

Customize your Homepage

Guest Homepage

When a guest or a not-logged-in member visit you Network, they will see this page.

You can customize this page by editing your "/themes/YOUR_ACTIVED_THEME_FOLDER/page.tpl.php".

Sample Codes
Display recent photos albums, blogs, and videos:
Show/Hide Codes
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;
	}
Display the latest 10 streams from all members:
Show/Hide Codes
$res = sql_query("select s.*,u.username,u.avatar from ".tb()."streams as s left join ".tb()."accounts as u on u.id=s.uid order by id desc limit 10");
		while($row = sql_fetch_array($res)) {
			$row['attachment'] = unserialize($row['attachment']);
			c(stream_display($row,'simple'));
		}
Display recent threads:
Show/Hide Codes
echo '<table class="stories">
			<tr class="table_line2">
			<td colspan="2"></td>
			<td>'.t('Title').'</td> 
			<td width="60">'.t('Views').'</td>
			<td width="60">'.t('Replies').'</td>
			</tr>';
		$res = sql_query("SELECT * FROM ".tb()."forum_threads ORDER by id DESC LIMIT 10");
		while ($row = sql_fetch_array($res)) {
			if (!$row['lastreply']) {
				$row['lastreply'] = $row['created'];
				$row['lastreplyuid'] = $row['uid'];
				$row['lastreplyuname'] = $row['username'];
			}
			if ($row['got_poll']) $row['type'] = t('Poll').': ';
			$icon = 'topic_standard.gif';
			if ($row['posts'] >= 12) {
				$icon = 'topic_hot.gif';
			}
			if ($row['thread_lock']) {
				$icon = 'topic_lock.gif';
			}
			if ($row['thread_type'] == 1) {
				$icon = 'topic_sticky.gif';
			}
			if ($row['thread_type'] == 2) {
				$icon = 'topic_global.gif';
			}
			$attach = $row['got_attach'] ? ' <img src="'.uhome().'/files/icons/forums/topic_attach.gif" alt="got attachments" />' : '';
			$uicon = $row['icon'] ? '<img src="'.uhome().'/files/icons/forums/icon'.$row['icon'].'.png" />' : ' ';
			echo '<tr class="row1">
			<td width="20" align="center"><img src="'.uhome().'/files/icons/forums/'.$icon.'" /></td>
			<td width="16" align="center">'.$uicon.'</td>
			<td><span class="forum_title">'.$row['type'].url('forums/viewthread/'.$row['id'],h($row['topic'])).$attach.'</span><br /><span class="sub">by '.url('u/'.$row['username'],$row['username']).', '.get_date($row['created']).'</span></td>
			<td align="center">'.$row['views'].'</td>
			<td align="center">'.($row['posts']-1).'</td>
			</tr>';
		}
		echo '</table>
		'.url('forums',t('More...'))
		);

Member Homepage

When a member logged in, he/she will see this page, which is called "Dashboard".

You can customize the Dashboard page by editing your "/applications/dashboard/dashboard.php"


Return to menu