Heya,
I have got 2 languages installed in the board and I already managed to include specific panels dependent on the language, so that newest articles are just shown from specific language boards.
But where I can't find a solution is the main window on the frontpage. Is it possible to show just posts of specific threads there dependend on the language selection?
We need to know more about your setup to answer that question.
Please read the Posting Guidelines.html (http://www.tinyportal.net/index.php/topic,581) and uppdate your first post with the info we ask for in the posting guide.
I don't really see a point in that as it is a general functionallity question but there you go:
Link to my site: http://ndnw.piranho.de/forum/index.php
(which wont work most probably as I am editing in it all the time)
SMF version: 1.19
TP version: v1.0 beta 4
Theme name and version: default...still modifying it myself
Browser Name and Version: IE 6.0 FF 3.0.11 Opera 9.64
Mods installed: None
Related Error messages: None
With info we need more of i mean what you posted so we can see what you have so far.
And with more info i mean more info on your settings, what you have tried so far, if you are using blocks, or articles, or single pages etc.
More or less, what is your setup and what have you done so far with the settings.
Well, maybe I just put my question not straight enough.
Is it possible without editing within the code to implement an alternative/additional frontpage which is getting other boards to display as news?
Lets say:
German Frontpage
getting news from boards 5,6,7 (which are german)
English Frontpage
getting news from boards 8,9,10 (which are english)
I could find enable/disable language options for the additional blocks and panels but nothing on the main "content" window.
If you say that there is no easy solution and I have to digg in the code, thats an okish anwer for me too, at least I know what to do then. :)
AH!, now i see what you mean, i will have to let the coders answer this one as i dont know ( interested in the answers my self though ) ;)
Take a look in the Block Code Snippets board. Theres a snipet to show recent posts from boards, X, Y , Z. Then use it again for another article, show boards A, B, C.
It uses the ssi_recentTopics() and has the topics in an array.
http://www.tinyportal.net/index.php/topic,1234.0.html
Try changing
ssi_recentTopics
to
ssi_boardNews
It might just work.. I haven't tried it though.
Actually, all you should need is this:
$result=ssi_boardNews(10,array(1,3,4),'return');
let me know if it works, I may just use it myself.
Hmm.. after some testing, it wasn't that easy :P
have a look at this topic at SMF:
http://www.simplemachines.org/community/index.php?topic=163375.0
for TP php articles or blocks, the php tags are not needed
<?php
?>
There is no way to do this without modifying the code for articles. The only work around I would try is only using blocks on your frontpage. You can then control blocks with languages. And inside a blocks settigns you can show an article, and then select the language you want the block to show for.
Other than that, you would have to use some custom PHP code checking for a users language in the article.
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.
But how do you control which user with a certain language gets to view those posts if you have it in an article?
So you think, you should combine Zetans suggestion with the ssi option together with the block system?
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.
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
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.
Note: this can actually also be used inside a regular PHP article, especially if you set as "featured" and show only that.
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.
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.
Yep, works perfectly!
Thank you very much! :)