TinyPortal

Development => Support => Topic started by: alhaudhie on May 11, 2008, 04:24:52 PM

Title: trying copy forum to upper block..
Post by: alhaudhie on May 11, 2008, 04:24:52 PM
i try to put this code from boardindex in upper block..
/* 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.) */
$first = true;
foreach ($context['categories'] as $category)
{
echo '
<div class="tborder" style="margin-top: ' , $first ? '0;' : '1ex;' , '' , $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'width: 100%;' : '', '">
<div class="catbg', $category['new'] ? '2' : '', '" style="padding: 5px 5px 5px 10px;">';
$first = false;

// If this category even can collapse, show a link to collapse it.
if ($category['can_collapse'])
echo '
<a href="', $category['collapse_href'], '">', $category['collapse_image'], '</a>';

echo '
', $category['link'], '
</div>';

// Assuming the category hasn't been collapsed...
if (!$category['is_collapsed'])
{
echo '
<table border="0" width="100%" cellspacing="1" cellpadding="5" class="bordercolor" style="margin-top: 1px;">';

/* 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>
<td ' , !empty($board['children']) ? 'rowspan="2"' : '' , ' class="windowbg" width="6%" align="center" valign="middle"><a href="', $scripturl, '?action=unread;board=', $board['id'], '.0">';

// If the board is new, show a strong indicator.
if ($board['new'])
echo '<img src="', $settings['images_url'], '/on.gif" alt="', $txt[333], '" title="', $txt[333], '" />';
// This board doesn't have new posts, but its children do.
elseif ($board['children_new'])
echo '<img src="', $settings['images_url'], '/on2.gif" alt="', $txt[333], '" title="', $txt[333], '" />';
// No new posts at all! The agony!!
else
echo '<img src="', $settings['images_url'], '/off.gif" alt="', $txt[334], '" title="', $txt[334], '" />';

echo '</a>
</td>
<td class="windowbg2">
',$board['viewer_text'],'<b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b><br />
', $board['description'];

// Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
if (!empty($board['moderators']))
echo '
<div style="padding-top: 1px;" class="smalltext"><i>', count($board['moderators']) == 1 ? $txt[298] : $txt[299], ': ', implode(', ', $board['link_moderators']), '</i></div>';

// Show some basic information about the number of posts, etc.
echo '
</td>
<td class="windowbg" valign="middle" align="center" style="width: 12ex;"><span class="smalltext">
            ', $board['posts'], ' ', $txt[21], ' ', $txt['smf88'], '<br />
            ', $board['topics'], ' ', $txt[330], '
</span></td>
<td class="windowbg2" valign="middle" width="25%">
<span class="smalltext">';

/* The board's and children's 'last_post's have:
time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
link, href, subject, start (where they should go for the first unread post.),
and member. (which has id, name, link, href, username in it.) */
if (!empty($board['last_post']['id']))
echo '
                                    <b>', $txt[22], '</b> ', $txt[30], ' ', $board['last_post']['time'] , '<br />
                                    ', $txt[525], ' ', $board['last_post']['member']['link'], ' ', $txt['smf88'], ' ', $board['last_post']['link'];
echo '
</span>
</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)
{
$child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . $child['viewer_text'] . ')">' . $child['name'] . '</a>';
$children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];
}

echo '
<tr>
<td colspan="3" class="windowbg', !empty($settings['seperate_sticky_lock']) ? '3' : '', '">
<span class="smalltext"><b>', $txt['parent_boards'], '</b>: ', implode(', ', $children), '</span>
</td>
</tr>';
}
}
echo '
</table>';
}
echo '
</div>';
}

if ($context['user']['is_logged'])
{
echo '
<table border="0" width="100%" cellspacing="0" cellpadding="5">
<tr>
<td align="', !$context['right_to_left'] ? 'left' : 'right', '" class="smalltext">
<img src="' . $settings['images_url'] . '/new_some.gif" alt="" align="middle" /> ', $txt[333], '
<img src="' . $settings['images_url'] . '/new_none.gif" alt="" align="middle" style="margin-left: 4ex;" /> ', $txt[334], '
</td>
<td align="', !$context['right_to_left'] ? 'right' : 'left', '">';

// Mark read button.
$mark_read_button = array('markread' => array('text' => 452, 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;sesc=' . $context['session_id']));

// Show the mark all as read button?
if ($settings['show_mark_read'] && !empty($context['categories']))
echo '
<table cellpadding="0" cellspacing="0" border="0" style="position: relative; top: -5px;">
<tr>
', template_button_strip($mark_read_button, 'top'), '
</tr>
</table>';
echo '
</td>
</tr>
</table>';
}

that is ok when settup ( go directly to the forum )
but when using frontpage the is nothing there.. i have set it up to show in frontpage...
Title: Re: trying copy forum to upper block..
Post by: JPDeni on May 11, 2008, 05:24:11 PM
It's likely due to the fact that, until you're in the forum, many of those variables have not yet been defined. You need to back up in the code to find where the $context['categories'] array is defined.
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on July 07, 2008, 05:01:59 AM
Quote from: JPDeni on May 11, 2008, 05:24:11 PM
It's likely due to the fact that, until you're in the forum, many of those variables have not yet been defined. You need to back up in the code to find where the $context['categories'] array is defined.


What is thhis mean...  (You need to back up in the code to find where the $context['categories'] array is defined.)

Anybody can make it easy way...
Title: Re: trying copy forum to upper block..
Post by: JPDeni on July 07, 2008, 05:28:42 AM
Quote(You need to back up in the code to find where the $context['categories'] array is defined.)

If you don't understand it, then you don't have enough knowledge of php in order to write it.

QuoteAnybody can make it easy way...

What is it that you're trying to do? Why don't you start from the beginning and say what it is that you want?
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on July 08, 2008, 02:31:17 PM
ok.. tq..

i want to put the whole original board index in block..
that can give me access to put it showing in the page that i want it to show...
Title: Re: trying copy forum to upper block..
Post by: JPDeni on July 08, 2008, 03:25:38 PM
So you want to copy the whole BoardIndex.template.php file into a block? Couldn't you use an iframe?
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on July 08, 2008, 05:09:18 PM
Not whole the boardindex.template...

i want to put the board index in frontpage. That can show twice in forum and home.
Title: Re: trying copy forum to upper block..
Post by: IchBin on July 08, 2008, 05:11:32 PM
TP settings only allow you to set your home to go to the forum. Not to have a home of the forum index. as well as a forum index being separate.
Title: Re: trying copy forum to upper block..
Post by: JPDeni on July 08, 2008, 06:14:34 PM
QuoteNot whole the boardindex.template...

i want to put the board index in frontpage.

In order to print out the board index, you have to use the boardindex.template.php file -- or the code in it. The whole file is required.
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on July 09, 2008, 05:32:43 AM
ok.. i have succes in copy boardindex withuot info center.. i put it in block to show in home and forum.
but its showing in Forum only, the block does not run (empty) in home.
Title: Re: trying copy forum to upper block..
Post by: JPDeni on July 09, 2008, 06:13:24 AM
This is just a guess, but you might try adding


require_once('BoardIndex.php');


Then again, you may get an error message. If so, this isn't the way to go.
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on July 09, 2008, 09:12:41 AM
Quote from: JPDeni on July 09, 2008, 06:13:24 AM
This is just a guess, but you might try adding


require_once('BoardIndex.php');


Then again, you may get an error message. If so, this isn't the way to go.

i got nothing happen... empty page...
Title: Re: trying copy forum to upper block..
Post by: Zetan on July 09, 2008, 09:23:45 AM
I have to wonder.. actually, I'm done wondering..

[Q] Why?

Why do you want to do this?
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on July 09, 2008, 10:43:46 AM
Quote from: ZTN on July 09, 2008, 09:23:45 AM
I have to wonder.. actually, I'm done wondering..

[Q] Why?

Why do you want to do this?

I want it because i want to show board index (like forum)  with tp frotpage original article block at the bottom.. i dont want to use article snippet or other like that...
Title: Re: trying copy forum to upper block..
Post by: G6Cad on July 09, 2008, 11:36:20 AM
Im really confused now..

But here goes....

You want to only show the forum on the frontpage, like you have SMF only on your site with out the TP frontpage visible ?

If that is what you are trying to do, why just not set your frontpage to go directly to forum  ???

Admin/TinyPortal/Settings & Frontpage/ Mark the blox where it say. " Go directly to forum "

Title: Re: trying copy forum to upper block..
Post by: Zetan on July 09, 2008, 02:00:48 PM
Ok, without sounding like I'm angry, annoyed.. or whatever you read into it..

Still doesn't answer, Why?

Because "you want to" isn't an answer. I just "want" to know what this will achieve that isn't already an option or an already submitted working Snippet.
I just feel that some requests are really a "want", rather than a "need". How will this improve your site?

I have a Home Page button and A Forum button.. I'm certainly not going to pander to every wish and whim of my members when if it really was an issue, they can simply press the Forum Button.

As G6 suggested, you can set the site to go directly to the Forum rather than a Home page.

Quote from: alhaudhie on July 09, 2008, 10:43:46 AM
i dont want to use article snippet or other like that...

Why not? There are Snippets and I'm sure I've seen somewhere an Info Center snippet before.
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on July 09, 2008, 04:15:11 PM
 :up:

ok i thing my request is not practical.. soo it look better to stop here.
Sorry everyone... and tq for support..
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on December 11, 2009, 05:42:47 PM
sorry.. everyone.. hope i can restart this topic again...

i want to show forum board index in frontpage block instead boardindex.
Title: Re: trying copy forum to upper block..
Post by: JPDeni on December 11, 2009, 09:59:41 PM
As ZarPrime asked you before, why?

It sounds like you want to copy the Board Index to the Front Page. That would be redundant and inefficient. Unless we can understand the point of this -- why you want it -- the only response you're going to get is what G6 suggested, which is to set your site to go directly to the forum instead of the Home Page, which will give you exactly what you have asked for.
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on December 13, 2009, 10:31:28 AM
Quote from: JPDeni on December 11, 2009, 09:59:41 PM
As ZarPrime asked you before, why?

It sounds like you want to copy the Board Index to the Front Page. That would be redundant and inefficient. Unless we can understand the point of this -- why you want it -- the only response you're going to get is what G6 suggested, which is to set your site to go directly to the forum instead of the Home Page, which will give you exactly what you have asked for.

Ok..

the request i make... because i want to show original artcile intro in boardindex. when i swith frontpage to boardindex/forum the article is gone. i dont want to use code block because its different with the original article intro in frontpage.

Or anybody here can help to push code to show original article intro like frontpage one to put in block? tq soo much.
Title: Re: trying copy forum to upper block..
Post by: ZarPrime on December 13, 2009, 04:46:17 PM
Mrcare,

I've got to admit ~ This is one of the most confusing requests I've ever seen here.  In fact, this one is a doozy. :o For some reason, I think we have a language barrier here.  You've got us so confused that JPDeni is even calling Zetan by my name, and that's not a good thing. :D  I think we need to start over, especially since we don't even know what version of TinyPortal you are using to try to do whatever it is you are trying to do.

Please Read and Follow the Posting Guidelines (http://www.tinyportal.net/index.php/topic,581), and perhaps give us some mockup of just exactly what you want to show on the FrontPage and what you want to show on the Forum Boardindex.  It doesn't have to be elaborate, just something like this would be fine ...

FrontPage ...
Article Intro on top
Boardindex on the bottom

Forum index ...
Boardindex only

None of us can see in our minds what it is you are trying to accomplish and, until we do, there is no way for us to make any suggestions as to how you can accomplish it.  Please help us to understand so that we can help you.

ZarPrime
Title: Re: trying copy forum to upper block..
Post by: JPDeni on December 13, 2009, 06:20:52 PM
QuoteYou've got us so confused that JPDeni is even calling Zetan by my name, and that's not a good thing.
:2funny: Sorry 'bout that. All those Zs get confusing.
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on December 13, 2009, 07:18:57 PM
Quote from: ZarPrime on December 13, 2009, 04:46:17 PM
Mrcare,

I've got to admit ~ This is one of the most confusing requests I've ever seen here. 

sorry about this..    :o

ok...

im ask about tp 1.0.5

as u say..

FrontPage ...
Article Intro on top
Boardindex on the bottom

Forum index ...
Boardindex only

now i want to show board index in frontpage.. coz i want to show article intro with boardindex.

if u suggest me go directly to boardindex as frontpage for my site.. and use article block code.. its not same with original article intro like in frontpage.

hope anybody can make article intro block code like or using default article intro in frontpage. tq... if anyone can't undeerstand what i mean.. i think we stop here.. sorry for everything...
Title: Re: trying copy forum to upper block..
Post by: ZarPrime on December 15, 2009, 04:49:57 PM
Mrcare,

I'm sorry, but I'm still having trouble understanding what it is you are trying to accomplish.  Perhaps you could show us a marked up screenshot of the look you want.

ZarPrime
Title: Re: trying copy forum to upper block..
Post by: IchBin on December 15, 2009, 07:40:20 PM
He is asking if you can have TP set to go directly to the board index, AS WELL as having an article above the board index that is only showing an articles intro.

There are no settings for this, but I am sure if you put a request in the code board that someone could write a block code that would fetch an articles intro and display that in a block above your board index.
Title: Re: trying copy forum to upper block..
Post by: alhaudhie on December 16, 2009, 05:35:51 AM
Quote from: IchBinâ„¢ on December 15, 2009, 07:40:20 PM
He is asking if you can have TP set to go directly to the board index, AS WELL as having an article above the board index that is only showing an articles intro.

There are no settings for this, but I am sure if you put a request in the code board that someone could write a block code that would fetch an articles intro and display that in a block above your board index.

Yes.. finally someone understand what i mean.. tq.