How would you create a navigation for your forum ( like a link to every forum or category)
Something like this:
http://www.tinyportal.net/index.php?topic=18318.0
?
you that snippet it is best.
Thanks
Sorry, but when I placed this into the phpbox It came up with :
Parse error: syntax error, unexpected '<' in /home/blizzcra/public_html/roc/Sources/Load.php(1735) : eval()'d code(35) : eval()'d code on line 1
This is for the Navigation box from IchBin : http://www.tinyportal.net/index.php?topic=18318.0
Sorry, here is my forum:
roc.blizzcraft.org
Did you put <php tags in it? Its not supposed to have those if you did. If not, please copy and paste your code here so I can see exactly what you have.
<pre style="margin-top: 0pt; display: inline;"> global $db_prefix, $context, $user_info;<br /><br /> // Find the boards/cateogories they can see.<br /> $request = db_query("<br /> SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.numTopics, b.childLevel<br /> FROM {$db_prefix}boards AS b<br /> LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)<br /> WHERE $user_info[query_see_board]", __FILE__, __LINE__);<br /> $context['jump_to'] = array();<br /> $this_cat = array('id' => -1);<br /> while ($row = mysql_fetch_assoc($request))<br /> {<br /> if ($this_cat['id'] != $row['ID_CAT'])<br /> {<br /> $this_cat = &$context['jump_to'][];<br /> $this_cat['id'] = $row['ID_CAT'];<br /> $this_cat['name'] = $row['catName'];<br /> $this_cat['boards'] = array();<br /> }<br /><br /> $this_cat['boards'][] = array(<br /> 'id' => $row['ID_BOARD'],<br /> 'name' => $row['boardName'],<br /> 'child_level' => $row['childLevel'],<br /> 'is_current' => isset($context['current_board']) && $row['ID_BOARD'] == $context['current_board'],<br /> 'topics' => $row['numTopics']<br /> );<br /> }<br /> mysql_free_result($request);<br /><br /> foreach ($context['jump_to'] as $category){<br /> // edit the following line if you want to change the style of the category text. <br /> echo '<span style="line-height: 10px; font-weight: bold;" class="normaltext" ><b>', strtoupper($category['name']), '</b></span><br />'; <br /> <br /> foreach ($category['boards'] as $board){<br /> if (!$board['child_level']){<br /> //edit the following line for the regular board text<br /> echo '<a href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a><br />';<br /> //this line you can edit for the topics count text<br /> echo '<span class="smalltext" style="margin-left: 10px;">', $board['topics'],' ', $txt[330], '</span><br />';<br /> }<br /> else{<br /> //this line you can edit to change the child board text<br /> echo '<a class="normaltext" style="margin-left: 20px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'],'</a><br />';<br /> }<br /> <br /> }<br /> }</pre>
You have so many things wrong with that code that I can't even begin to tell you what to do. Make sure you are putting it in a phpbox block. Copy and paste the code exactly from the post, into your phpbox and it should work.
Thanks, it works now. One fast question, is there a way for the Categories to have a little more space? The code is amazing but they seem clustered. Roc.blizzcraft.org
You can insert line breaks.. this is the code from my site:
global $db_prefix, $context, $user_info;
echo ' <div style="padding: 5px;" class="smalltext" align="center"><TABLE BORDER=0 WIDTH="500" HEIGHT="500" CELLPADDING=0 CELLSPACING=0>
<TR ALIGN=left>
<TH ALIGN=left>';
// Find the boards/cateogories they can see.
$request = db_query("
SELECT c.name AS catName, c.ID_CAT, b.ID_BOARD, b.name AS boardName, b.numTopics, b.childLevel
FROM {$db_prefix}boards AS b
LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
WHERE $user_info[query_see_board]", __FILE__, __LINE__);
$context['jump_to'] = array();
$this_cat = array('id' => -1);
while ($row = mysql_fetch_assoc($request))
{
if ($this_cat['id'] != $row['ID_CAT'])
{
$this_cat = &$context['jump_to'][];
$this_cat['id'] = $row['ID_CAT'];
$this_cat['name'] = $row['catName'];
$this_cat['boards'] = array();
}
$this_cat['boards'][] = array(
'id' => $row['ID_BOARD'],
'name' => $row['boardName'],
'child_level' => $row['childLevel'],
'is_current' => isset($context['current_board']) && $row['ID_BOARD'] == $context['current_board'],
// 'topics' => $row['numTopics']
);
}
mysql_free_result($request);
foreach ($context['jump_to'] as $category){
// edit the following line if you want to change the style of the category text.
echo '<br><span style="line-height: 10px; font-weight: bold;" class="normaltext" ><b>', strtoupper($category['name']), '</b></span><br />';
foreach ($category['boards'] as $board){
if (!$board['child_level']){
//edit the following line for the regular board text
echo '<a href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a><br />';
//this line you can edit for the topics count text
/* echo '<span class="smalltext" style="margin-left: 10px;">', $board['topics'],' ', $txt[330], '</span><br />'; */
}
else{
//this line you can edit to change the child board text
echo '<a class="smalltext" style="margin-left: 20px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'],'</a><br />';
}
}
}
echo ' </TH>
</TR>
</TABLE></div>';