This little code snippet will create a menu consisting of all your Categories, boards, and child boards. A small screen shot is attached so you can see what it looks like. Just put this code into a phpbox type of block. I've put some comments in the code in case anyone would like to edit the style of the text, to indicate which line for the text.
global $db_prefix, $context, $user_info;
// 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 '<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="normaltext" style="margin-left: 20px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'],'</a><br />';
}
}
}
Great work IchBin :D
IchBin, would it be possible to combine this with a javascript menu I have to make the categories collapsable?
Works perfect!
Thank you very much for your effort
:up: Works well, I might just keep this in Admin view minimised. Top stuff.
Quote from: Bloodlvst on August 23, 2007, 02:53:02 PM
IchBin, would it be possible to combine this with a javascript menu I have to make the categories collapsable?
I'm sure its possible, but its beyond me at this point.
I put this into a PHPBox but it does not show up. I see the header, but the script appears to not be working. I am not getting any errors listed below the header, just , a header bar and nothing following except the next box,.
I like it :up:
Just added a couple of existing style classes and it blends in very nicely. :)
Quote from: Tracy Beyer on September 18, 2007, 03:18:44 PM
I put this into a PHPBox but it does not show up. I see the header, but the script appears to not be working. I am not getting any errors listed below the header, just , a header bar and nothing following except the next box,.
Have a link? I may need to look at the block so if you could provide a temp account with TP admin access I'll take a look at it.
Is it possible to do something very similar but for the Articles page listing Categories and Subcategories?
Yes, just create a php Article... here's an example:
http://labradio.co.uk/index.php?page=Board_Index
Quote from: Zetan on September 20, 2007, 01:25:00 PM
Yes, just create a php Article... here's an example:
http://labradio.co.uk/index.php?page=Board_Index
Thats pretty much exactly what I want to do but I don't know how to write any sort of code. In fact i struggle with English (my only language). Could you give me a hand with the code. And will it remain if I change themes.
Dog
:) You simply create an Article, which is a PHP type article and copy/paste IchBins code into it.
All I have done is added a line break between the categories. The hard work has been done for you already ;)
I was looking at doing it as a phpblock as a navigation menu. I thought that IchBin's code was for Forum Categories
This code is for forum categories and boards. There's a code snippet for articles, but I haven't seen one for article categories.
Yeah, and I am not smart enough to be able to actually write one myself.
Quote from: Maddog452 on September 20, 2007, 11:50:39 PM
Yeah, and I am not smart enough to be able to actually write one myself.
I'm not sure what you are asking. You want to put the Site Map, or I should say, Board Index Map in a block.. or a php Article?
All you have to do is copy/paste.. you don't need to write any code at all.
I am looking to do what IchBin has done for Forum Categories but to do it with article categories. Wouldn't that mean at least modifying IchBin's code?
Article Category1
Article Sub-Cat 1.1
Article Sub-Cat 1.2
Article Category 2
Article Sub-Cat 2.1
Article Sub-Cat 2.2
Article Sub-Cat 2.3
Article Category 3
etc
I see... I seem to have misunderstood what you were asking.
At this time, as IchBin stated.. no such code has been written yet for Article categories.
How hard would it be to write. I've only gotta learn a few new languages and how they apply to each application. I might have a fiddle and see if I can create something. If not a work around.
Cheers
Dog
You can't use a categorybox type of block to get what you want?
I was looking at setting up some sort of links within a sidebox.
EG.
"Awards" --> http://theblackhand.asn.au/forum/index.php?cat=6
and so on.
Of course I have to work out how to create links!
Will that work
Can't view the page as a guest, but I know what you mean. I don't have the time right now to look at this for you. Sorry.
thanks anyway. If you get some time, please PM me and I will open up my helper account.
Cheers
DM
I finally got it sorted. I just used the menu manager and put the items into my site map. Pretty easy really and I probably should done some more research before annoying people. Thanks for your help
Sometimes annoying can be the way to learn to ;)
Glad you got it sorted.
Is it possible to have this mod get only the categories and the top level boards? I don't need it to fetch the number of topics and child boards.
You can just delete the part that outputs the child boards.
else{
//this line you can edit to change the child board text
echo '<a class="normaltext" style="margin-left: 20px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'],'</a><br />';
}
Fully xhtml 1.0+ compliant too, and works great!
very nice work
Is it possible to put a small icon before each board name :)
Yep, I commented where you can edit certain text. Just add your icon code to the echo code for it. Although, it will have to be the same icon for all as there is no way to assign different icons to each board atm.
how to do that means wot code to write if my icon url is
http://www.tinyportal.net/tp-images/Image/tinyportals.gif
This is the code that makes the board. Notice the comments I put so people would know where to edit.
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 />';
Add your icon to the regular board line like this: (may require some tweaking to make it look good as I haven't tested this).
if (!$board['child_level']){
//edit the following line for the regular board text
echo '<img src="http://www.tinyportal.net/tp-images/Image/tinyportals.gif" /><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 />';
i want to put this just below my webpage in a frontpage block.. currently, all the links show up vertically, can someone tell me how to put the links (categories, boards, topics) horizontally, like in a table form.. this is to emulate those blogs with category links underneath their webpage
example
category 1 category 3 category
board 1 board 3 board
2 topics 2 topics topics
board 4
category 2
board 2
2 topics
etc..
thanks in advance!
bump... any help
Well, I'd like to ask for a little addition to this wonderful code: RSS.
The thing I'd like to show is a RSS feed icon (like this, for example (https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.graphicsguru.com%2Frsson.png&hash=8873276cf1da09cfafd84b0a1806366b5d39f6c4) ) before each category and board, that links to their RSS.
Just like this SMF mod does (RSS Feed Icon for boards): http://custom.simplemachines.org/mods/index.php?mod=376
I think this could be very useful for all who want syndicate contents
Change the following line:
echo '<a href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a><br />';
To this:
echo '<a href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a><a href="',$scripturl,'?action=.xml;board=', $board['id'], ';type=rss"><img src="',$settings['images_url'],'/rss.gif" /></a><br />';
You will then need to add your image of choice for the rss.gif to your themes images folder.
Thank you very much! Works perfect!
Actually, I've used http://www.smashupgraphics.com/smashups/rss-feed-button to generate the rss gif image, and made some changes to show the block the way I like:
//edit the following line for the regular board text
echo '<a href="',$scripturl,'?action=.xml;board=', $board['id'], ';type=rss"><img src="',$settings['images_url'],'/rss.gif" alt="RSS de ', $board['name'],'"" /></a> <a href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a>: ';
I want to show also RSS for categories and syndicate only posts and not the comments, but I think I can get it by myself. Any help in this direction would be very appreciated, though.
Thank you again for your help! :up:
..great snippet
Is there a way to alter the code so that only certain Categories and Boards show up? I was thinking of hiding one or two Categories/Boards...
Not really. What it does is only shows the categories and boards if the user is allowed.
Quote from: IchBinâ,,¢ on April 27, 2008, 02:36:18 AM
Not really. What it does is only shows the categories and boards if the user is allowed.
ahhh, ok, I forgot you can hide categories via the permissions?
Hope that will do the trick, Thanks
Quote from: alving on January 11, 2008, 12:58:34 AM
i want to put this just below my webpage in a frontpage block.. currently, all the links show up vertically, can someone tell me how to put the links (categories, boards, topics) horizontally, like in a table form.. this is to emulate those blogs with category links underneath their webpage
example
category 1 category 3 category
board 1 board 3 board
2 topics 2 topics topics
board 4
category 2
board 2
2 topics
etc..
thanks in advance!
First of all, this is a wonderful code snippet. Thanks to IchBin for the great work. I'd like to come back to the question of Alving. Is there a way to put the links horizontally so that it can be used for a centre block?
I can think of a way to make it output like this possibly.
board1 board2
board3 board4
However, I can't think of a way to make it go this way: (although I'm sure its possible, I just don't know atm)
board1 board3
board2 board4
Is that ok?
Thank you very much.
I hacked away at it (I can't code) and I stripped the menu down so that it does NOT show the post count. I failed miserably a couple of times (syntax errors) but I got the ; and the { in working order. Your comments were very helpfull.
Glad its working for you. And good working doing a modification to it. :up:
Quote from: IchBinâ,,¢ on May 11, 2008, 06:35:24 AM
I can think of a way to make it output like this possibly.
board1 board2
board3 board4
However, I can't think of a way to make it go this way: (although I'm sure its possible, I just don't know atm)
board1 board3
board2 board4
Is that ok?
can you please give this a go ichbin? thanks in advance
Ok, so how do you want it to look? Categories won't line up with boards listing it this way. So would you rather just list the boards and not the categories? Do you want topics/posts count displayed? How many columns do you want? Give me as many details as you can please.
just the board names will do and pls include topic counts. can child boards' topic counts be included as well?
maybe 6 columns will do and is it possible to have the number of columns changeable?
thanks
Having the columns changeable should work. I just have to figure out how to pull the info from the arrays. Can you give me an idea of how you want it displayed? Do you want the topic count to be under? Or in another column to the side of the board title? Please be as specific as you can. I'm not sure if topic count will work with child boards at this time.
topic counts can be under the board title just like what the original code here does.. it's just the columnar arrangement, that i'm keen of..
I need something like this expandable...
my guild is on 5 servers. i want a list as follows
+arkenstone
+brandywine
+landroval
+elendilmir
+Vilya
and when i click on a server name it expands
+Arkenstone
- Brandywine
-Leader: Tawar
-Member: Homer
-Member: Homer2
+Landroval
+Elendilmir
+Vilya
could i do this..and how? PS... this list needs to go into a HTML area on the tolkien theme. It seems to be outside the left block on my site
www.orderofmiddleearth.com
I goto Admin>Current Theme then it allows me to write HTML into this box.
Vivasvan, what you're asking for would have to be hard code in HTML with some type of drop down. This is a php snippet, and it won't be possible to put it into any HTML box to make it work like you're asking.
As for the previous poster, I'm out of town for the weekend, so if I get a chance I'll try to figure the code out.
hi was wondering if this possible just to show the boards we have no childboards etc just the names of the main boards ive tried messing with it just getting lots of errors any help be appreciated.
dont really need all the other info but a list of all my boards.
regards
Plat
edit: got it myself thankyou
Ah, did someone still need this script to make a column menu? I almost forgot about this. Let me know, as I'm sure I can still work the code out.
i still need it, sir..
cheers
Ok, this code will create a two columned layout. I haven't added any special style to the table, so if you need more done, just add a different class to the <td>'s. You can change the number of columns by changing this line if ($columns % 2 != 0){. Change the number 2 to represent how many columns you want.
global $db_prefix, $context, $user_info;
// 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);
echo '
<table >
<tr>';
$first = true;
$columns = -1;
foreach ($context['jump_to'] as $category){
foreach ($category['boards'] as $board){
$columns++;
if ($columns % 2 != 0){
echo '
<td class="normaltext"><a href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a></td>';
}
else{
echo '
</tr>
<tr>
<td class="normaltext"><a href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a></td>';
}
}
}
echo '
</tr>
</table>';
hi ichbin,
thanks for the code but it is not working properly. at the moment, eventhough i changed 2 to any number, the code still displays the board links in one horizontal row..
Works for me on my site. Would you like me to take a look at it on your site? PM me with a temp admin account if you'd like. Not much I can do to fix it for you, if its working on my site.
Fixed the code in the post above, and fixed the code on your site. Sorry about that. Don't know why I left some things out.
you are a very good fixer ICH.. ;)
Quote from: IchBinâ,,¢ on June 20, 2008, 02:55:45 AM
Fixed the code in the post above, and fixed the code on your site. Sorry about that. Don't know why I left some things out.
cheers, ichbin! i just saw it now when i visited my site! thanks once again
wow , great .
thnx IchBinâ„¢
IchBin I just copied and pasted this code onto a PHP block but it just doesn't seem to appear... It's basically empty. Please help me out here buddy.... Thanks alot....
It would probably help if you followed our Posting Guidelines (http://www.tinyportal.net/index.php?topic=581) so I knew what versions of software you were running.
--edit--
I see you've sent me a PM. I don't do support via PM, sorry. However, I see that you are now running SMF2. That would be the reason this doens't work. It was written for SMF1.x. I don't know if I'll have the time real soon to update this, but I'll see what I can do.
My apologies for PM'ing. Thanks for responding anyways. Will be looking forward to see u write one for SMF 2+
Well I was worried that SMF might have changed the code for the jump_to function of SMF that this relies on. Looks like it only need a slight update for database stuff. This should work in SMF2.
global $smcFunc, $context;
// Find the boards/cateogories they can see.
$request = $smcFunc['db_query']('', '
SELECT c.name AS catName, c.id_cat, b.id_board, b.name AS boardName, b.num_topics, b.child_level
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
WHERE {query_see_board}',
array()
);
$context['jump_to'] = array();
$this_cat = array('id' => -1);
while ($row = $smcFunc['db_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['child_level'],
'is_current' => isset($context['current_board']) && $row['id_board'] == $context['current_board'],
'topics' => $row['num_topics']
);
}
$smcFunc['db_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 '<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'],' Topics</span><br />';
}
else{
//this line you can edit to change the child board text
echo '<a class="normaltext" style="margin-left: 20px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'],'</a><br />';
}
}
}
Wow thanks alot man. You will never know how much I appreciate it - TRUST ME. ALOT! :)
Just a suggestion. The Board names should be click-able links that can be collapsed and expanded would be a pretty cool. Only a thought.
Hi! the last code posted by IchBin doesn't work for me.
Link to my site: http://www.gamesandgamers.org
SMF version: 2.0.2
TP version: 1.106
Default Forum Language: Italian-utf8
Theme name and version: TotalBlue
Browser Name and Version: Latest version of Chrome, FF and IE
Mods installed:
Pretty URLs 1.0
SMF Arcade 2.5
Justify BBCode 2.3.2
Custom Board Sort 1.0.2
Float BBCODE 1.0.2
Highslide BBCode and Image Viewer 1.0
Drafts 1.1.2
Sitemap 2.2.0
Spoiler Tag 0.7.2a
Tapatalk SMF 2.0 RC4/RC5/Final Plugin 3.0.0
Aeva Media 1.4w
Related Error messages: Fatal error: Call to undefined function tpdb_query() in /web/htdocs/www.gamesandgamers.org/home/forum/Sources/Load.php(2176) : eval()'d code(114) : eval()'d code on line 4
Try the code again, I updated the post above.
It works. It just needs some font adjustement. Thank you for the quick solution!
I've made a litte modification to the IchBin code and added a very simple jquery toggle effect.
http://www.gamesandgamers.org
Hi MBry0,
Very nice. O0
However, it seems that the + sign shows up next to the main board even if the Main Board has no child boards, at least that a guest can see. I'm wondering, could you post the entire code you are using so that I could have a look at it to see if I can figure out how to remove the + sign if there are no child boards.
Thanks,
ZarPrime
Here it is :)
global $smcFunc, $context;
// Find the boards/cateogories they can see.
$request = $smcFunc['db_query']('', '
SELECT c.name AS catName, c.id_cat, b.id_board, b.name AS boardName, b.num_topics, b.child_level
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
WHERE {query_see_board}',
array()
);
$context['jump_to'] = array();
$this_cat = array('id' => -1);
while ($row = $smcFunc['db_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['child_level'],
'is_current' => isset($context['current_board']) && $row['id_board'] == $context['current_board'],
'topics' => $row['num_topics']
);
}
$smcFunc['db_free_result']($request);
$counter = 0;
foreach ($context['jump_to'] as $category){
// edit the following line if you want to change the style of the category text.
echo '<span><b>', strtoupper($category['name']), '</b></span><br />';
foreach ($category['boards'] as $board){
if (!$board['child_level']){
$counter++;
//edit the following line for the regular board text
echo '<a style="font-size: 12px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a><span id="more_', $counter, '" style="cursor:pointer;"> <img src="THE + IMAGE HERE"/></span>
<script type=text/javascript>
$(document).ready(function(){
$("#more_', $counter, '").click(function(){
$(".showhide_'.$counter.'").toggle();
});
});
</script>
<br />';
//this line you can edit for the topics count text
echo '<span>';
}
else{
//this line you can edit to change the child board text
echo '<span class="showhide_'.$counter.'" style="display:none;"><a style="font-size: 10px; margin-left: 20px;"
href="',$scripturl,'?board=', $board['id'], '"><img src="YOUR ARROW IMAGE HERE"/>', $board['name'].'</a><br /></span>';
}
}
}
EDIT: the block causes thousands errors. Those 2 in loop:
http://www.gamesandgamers.org/forum/index.php?
8: Undefined variable: scripturl
File: /web/htdocs/www.gamesandgamers.org/home/forum/Themes/default/languages/TPortal.italian-utf8.php (tp_below sub template - eval?)
String: 44
http://www.gamesandgamers.org/forum/index.php?
8: Undefined variable: scripturl
File: /web/htdocs/www.gamesandgamers.org/home/forum/Themes/default/languages/TPortal.italian-utf8.php (tp_below sub template - eval?)
String: 59
Whit eval enabled i get the same errors and same strings on /web/htdocs/www.gamesandgamers.org/home/forum/Themes/default/TPsubs.template.php
Quote from: MBry0 on March 30, 2012, 09:52:05 AM
Here it is :)
global $smcFunc, $context;
// Find the boards/cateogories they can see.
$request = $smcFunc['db_query']('', '
SELECT c.name AS catName, c.id_cat, b.id_board, b.name AS boardName, b.num_topics, b.child_level
FROM {db_prefix}boards AS b
LEFT JOIN {db_prefix}categories AS c ON (c.id_cat = b.id_cat)
WHERE {query_see_board}',
array()
);
$context['jump_to'] = array();
$this_cat = array('id' => -1);
while ($row = $smcFunc['db_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['child_level'],
'is_current' => isset($context['current_board']) && $row['id_board'] == $context['current_board'],
'topics' => $row['num_topics']
);
}
$smcFunc['db_free_result']($request);
$counter = 0;
foreach ($context['jump_to'] as $category){
// edit the following line if you want to change the style of the category text.
echo '<span><b>', strtoupper($category['name']), '</b></span><br />';
foreach ($category['boards'] as $board){
if (!$board['child_level']){
$counter++;
//edit the following line for the regular board text
echo '<a style="font-size: 12px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'], '</a><span id="more_', $counter, '" style="cursor:pointer;"> <img src="THE + IMAGE HERE"/></span>
<script type=text/javascript>
$(document).ready(function(){
$("#more_', $counter, '").click(function(){
$(".showhide_'.$counter.'").toggle();
});
});
</script>
<br />';
//this line you can edit for the topics count text
echo '<span>';
}
else{
//this line you can edit to change the child board text
echo '<span class="showhide_'.$counter.'" style="display:none;"><a style="font-size: 10px; margin-left: 20px;"
href="',$scripturl,'?board=', $board['id'], '"><img src="YOUR ARROW IMAGE HERE"/>', $board['name'].'</a><br /></span>';
}
}
}
EDIT: the block causes thousands errors. Those 2 in loop:
http://www.gamesandgamers.org/forum/index.php?
8: Undefined variable: scripturl
File: /web/htdocs/www.gamesandgamers.org/home/forum/Themes/default/languages/TPortal.italian-utf8.php (tp_below sub template - eval?)
String: 44
http://www.gamesandgamers.org/forum/index.php?
8: Undefined variable: scripturl
File: /web/htdocs/www.gamesandgamers.org/home/forum/Themes/default/languages/TPortal.italian-utf8.php (tp_below sub template - eval?)
String: 59
Whit eval enabled i get the same errors and same strings on /web/htdocs/www.gamesandgamers.org/home/forum/Themes/default/TPsubs.template.php
you must globalize $scripturl that will fix the errors
how to make original board index layout in the block?
Edit this section of the code to output what you would like it to be:
foreach ($context['jump_to'] as $category){
// edit the following line if you want to change the style of the category text.
echo '<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="normaltext" style="margin-left: 20px;" href="',$scripturl,'?board=', $board['id'], '">', $board['name'],'</a><br />';
}
}
}
can i call ssi function?
There is no ssi function that does this.
try to add this to block... but not succeed
function template_main()
{
global $context, $settings, $options, $txt, $scripturl, $modSettings;
echo '
<div id="boardindex_table" class="boardindex_table">
<table class="table_list">';
/* Each category in categories is made up of:
id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
and boards. (see below.) */
foreach ($context['categories'] as $category)
{
// If theres no parent boards we can see, avoid showing an empty category (unless its collapsed)
if (empty($category['boards']) && !$category['is_collapsed'])
continue;
echo '
<tbody class="header" id="category_', $category['id'], '">
<tr>
<td colspan="4">
<div class="cat_bar">
<h3 class="catbg">';
// If this category even can collapse, show a link to collapse it.
if ($category['can_collapse'])
echo '
<a class="collapse" href="', $category['collapse_href'], '" title="' ,$category['is_collapsed'] ? $txt['show'] : $txt['hide'] ,'">', $category['collapse_image'], '</a>';
echo '
', $category['link'], '
</h3>
</div>
</td>
</tr>
</tbody>';
// Assuming the category hasn't been collapsed...
if (!$category['is_collapsed'])
{
echo '
<tbody class="content" id="category_', $category['id'], '_boards">';
/* Each board in each category's boards has:
new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
children (see below.), link_children (easier to use.), children_new (are they new?),
topics (# of), posts (# of), link, href, and last_post. (see below.) */
foreach ($category['boards'] as $board)
{
echo '
<tr id="board_', $board['id'], '" class="windowbg2">
<td class="windowbg icon"', !empty($board['children']) ? ' rowspan="2"' : '', '>
<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';
// If the board or children is new, show an indicator.
if ($board['new'] || $board['children_new'])
echo '
<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
// Is it a redirection board?
elseif ($board['is_redirect'])
echo '
<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
// No new posts at all! The agony!!
else
echo '
<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';
echo '
</a>
</td>
<td class="info">
<a class="subject" href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a>';
// Has it outstanding posts for approval?
if ($board['can_approve_posts'] && ($board['unapproved_posts'] || $board['unapproved_topics']))
echo '
<a href="', $scripturl, '?action=moderate;area=postmod;sa=', ($board['unapproved_topics'] > 0 ? 'topics' : 'posts'), ';brd=', $board['id'], ';', $context['session_var'], '=', $context['session_id'], '" title="', sprintf($txt['unapproved_posts'], $board['unapproved_topics'], $board['unapproved_posts']), '" class="moderation_link">(!)</a>';
echo '
<p>', $board['description'] , '</p>';
// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
if (!empty($board['link_moderators']))
echo '
<p class="moderators">', count($board['link_moderators']) == 1 ? $txt['moderator'] : $txt['moderators'], ': ', implode(', ', $board['link_moderators']), '</p>';
// Show some basic information about the number of posts, etc.
echo '
</td>
<td class="windowbg stats">
<p>', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], '
', $board['is_redirect'] ? '' : '<br /> '.comma_format($board['topics']) . ' ' . $txt['board_topics'], '
</p>
</td>
<td class="lastpost">';
if (!empty($board['last_post']['id']))
echo '
<p>', $board['last_post']['last_post_message'], '</p>';
echo '
</td>
</tr>';
// Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
if (!empty($board['children']))
{
// Sort the links into an array with new boards bold so it can be imploded.
$children = array();
/* Each child in each board's children has:
id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
foreach ($board['children'] as $child)
{
if (!$child['is_redirect'])
$child['link'] = '<a href="' . $child['href'] . '" ' . ($child['new'] ? 'class="board_new_posts" ' : '') . 'title="' . ($child['new'] ? $txt['new_posts'] : $txt['old_posts']) . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')">' . $child['name'] . ($child['new'] ? '</a> <a href="' . $scripturl . '?action=unread;board=' . $child['id'] . '" title="' . $txt['new_posts'] . ' (' . $txt['board_topics'] . ': ' . comma_format($child['topics']) . ', ' . $txt['posts'] . ': ' . comma_format($child['posts']) . ')"><span class="new_posts">' . $txt['new'] . '</span>' : '') . '</a>';
else
$child['link'] = '<a href="' . $child['href'] . '" title="' . comma_format($child['posts']) . ' ' . $txt['redirects'] . ' - ' . $child['short_description'] . '">' . $child['name'] . '</a>';
// Has it posts awaiting approval?
if ($child['can_approve_posts'] && ($child['unapproved_posts'] || $child['unapproved_topics']))
$child['link'] .= ' <a href="' . $scripturl . '?action=moderate;area=postmod;sa=' . ($child['unapproved_topics'] > 0 ? 'topics' : 'posts') . ';brd=' . $child['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" title="' . sprintf($txt['unapproved_posts'], $child['unapproved_topics'], $child['unapproved_posts']) . '" class="moderation_link">(!)</a>';
$children[] = $child['new'] ? '<strong>' . $child['link'] . '</strong>' : $child['link'];
}
echo '
<tr id="board_', $board['id'], '_children" class="windowbg2">
<td colspan="3" class="windowbg children">
<p><strong>', $txt['parent_boards'], '</strong>: ', implode(', ', $children), '</p>
</td>
</tr>';
}
}
echo '
</tbody>';
}
echo '
<tbody class="divider">
<tr>
<td colspan="4"></td>
</tr>
</tbody>';
}
echo '
</table>
</div>
<ul id="posting_icons">';
if ($context['user']['is_logged'])
echo '
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_some.png" alt="" /> ', $txt['new_posts'], '</li>';
echo '
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_none.png" alt="" /> ', $txt['old_posts'], '</li>
<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_redirect.png" alt="" /> ', $txt['redirect_board'], '</li>
</ul>';
// Show the mark all as read button?
if ($context['user']['is_logged'] && $settings['show_mark_read'] && !empty($context['categories']))
echo '
<div class="mark_read">', template_button_strip($context['mark_read_button'], 'right'), '</div>';
}
I don't know what you are trying to do but remove the declare of the function and the opening bracket at the top ...
function template_main()
{
... and the closing bracket at the bottom ...
}
... and it will show.
ZarPrime
its only show...
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimg404.imageshack.us%2Fimg404%2F6343%2Fq3dv.png&hash=ade91224da8fadb11e05a6ed790c100b00015e78)
MrCare,
I can't really help what shows up. Like I said, I don't even know what you are trying to do. If you want something else, maybe you should start a new topic in the "Requests Board" and maybe someone can help you come up with something. Unfortunately though, I probably wouldn't be interested in helping with it.
ZarPrime
The code you posted is not the code that this topic deals with. It's pretty messy too. I'd suggest you start another topic and tell us what you've done. What versions you are using. Where you got the code. etc. etc.