TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 415
  • Total: 415

Language Specific Frontpage

Started by Kordanor, June 20, 2009, 03:02:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Zetan

My suggestion is pulling the ssi_boardNews from the language specific boards.

boards 1, 2 and 3 German,
boards 4, 5 and 6 English

The boards themselves will have the different languages.

IchBin

But how do you control which user with a certain language gets to view those posts if you have it in an article?

Kordanor

So you think, you should combine Zetans suggestion with the ssi option together with the block system?

IchBin

You need to make sure you use the proper wording. There is a difference between articles, posts, and topics. When you said articles in your first post I thought you were talking about articles, and not posts or topics.

However, it sounds like all you need to do is combine both our suggestions to get what you want.

Zetan

Quote from: IchBinâ„¢ on June 20, 2009, 11:08:25 PM
But how do you control which user with a certain language gets to view those posts if you have it in an article?

That is a good question!

It was late when I replied. I'd assumed Articles or the Article Categories have the same viewing options as Blocks. By current design, we don't have language viewing options in Articles.. But we do in blocks.

Example:

  • Front Page Block type: PHP
  • Add custom block title for any installed language - except for default: German; Willkommen
  • Choose where the block should appear. > Languages: German or English

    I'm assuming these options are for targeting members using different languages? I've never used these options for languages so I don't know if they work that way.



    I like the idea and I think it can be done, if the blocks work as I think they do and we can array the ssi_boardNews

bloc

ssi_boardnews can only fetch one board..but TP_boardNews can show multiple. Try in a single PHP block something like:


if($context['user']['language']=='english')
$myposts = TP_boardNews('12,15', 10,0);
elseif($context['user']['language']=='german')
$myposts = TP_boardNews('91,25', 10,0);

foreach ($myposts as $news)
{
echo '
<div>
<a href="', $news['href'], '">', $news['icon'], '</a> <b>', $news['subject'], '</b>
<div class="smaller">', $news['time'], ' ', $txt[525], ' ', $news['poster']['link'], '</div>
<div class="post" style="padding: 2ex 0;">', $news['body'], '</div>
', $news['link'], $news['locked'] ? '' : ' | ' . $news['comment_link'], '
</div>';

if (!$news['is_last'])
echo '
<hr style="margin: 2ex 0;" width="100%" />';
}


Note that the HTML code is just lifted from SSI, which may be different from TP usual output as TP use several layouts etc.

About articles being shown according to language thats something to be considered in future versions of TP.

bloc

Note: this can actually also be used inside a regular PHP article, especially if you set as "featured" and show only that.

Kordanor

#17
Most probably the easiest methode would be to edit the code and just catch the language before the forums are selected, isn't it?

I guess it's done in the TPortal.template.php file, but i can't really find it.

My Idea is to do something like:

if (language==german)
{functiontogetthreads 5,6,7}
else
{functiontogetthreads X,Y,Z} //taken from settings, considered you make the main settings for english

The code is a little bit confusing, as I am not the only one who messed up articles and threads ;)
I mean even the print field is always called "print article", independet of the source.

Edit:
seems like the file is TPortal.php and the variable is $context
But I still can't make out the exact position.

bloc

Uhm, try looking for this line:
$forumposts=TP_boardNews($context['TPortal']['SSI_board'],$maxnumber,$context['TPortal']['mystart'],$context['TPortal']['frontpage_limit_len'],'array');


As you can see its actually fetching posts from the TP setting of 5 boards. If we transfer what i wrote above to this, it would be:

if($context['user']['language']=='english)
$forumposts=TP_boardNews('12,15',$maxnumber,$context['TPortal']['mystart'],$context['TPortal']['frontpage_limit_len'],'array');
else
$forumposts=TP_boardNews('3,4',$maxnumber,$context['TPortal']['mystart'],$context['TPortal']['frontpage_limit_len'],'array');



It assumes its only english + another and will fallback on "other" if language for some reason is not defined.You could add another for guests as well if you like.

Note that the 5 boards setting in TP will not work now, it will only fetch the ones you put in. When you update TP this will be erased by newer files, so beware.

Kordanor

Yep, works perfectly!

Thank you very much! :)

This website is proudly hosted on Crocweb Cloud Website Hosting.