Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 06:16:57 PM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155547 Posts in 21714 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Anynews Archive! How do I change looks and automatic language?  (Read 501 times)
Roych

Offline Offline

Posts: 149



« on: June 08, 2011, 10:56:35 AM »

Hello

I would like to change the language and the looks of Anynews Archive module?

I called it with a:
Code:
if (function_exists('display_news_items')) {
display_news_items(
$group_id=0,
$max_news_items=10,
$max_news_length=-1,
$display_mode=1,
$header_text="Latest News",
$readmore_text="Beri več/Read more", 
$custom_placeholder = false,
$not_older_than = 0,
$no_news_text="no news available yet...");
}
Hope this is right.

And now I would like to change the looks of it and I would like the language to change automaticaly, like in anynews module. (or is this
Code:
$readmore_text="Beri več/Read more
the only option?
But there is no CSS and no language files for that module.

I've tried too change the include.php but I'm no coder so I could make only some small changes like deleted the "Latest News" title and stuff.

Any ideas how to combine the Anynews and Anynews_Archive modules so it would work the same as Anynews with all it's functions and languages etc.?


Hope you understand what I mean.
 thank you in advance Wink
Royh
« Last Edit: June 08, 2011, 11:21:01 AM by Roych » Logged
YoJoe

Offline Offline

Posts: 74


WWW
« Reply #1 on: June 08, 2011, 12:23:45 PM »

The simplest approach is to use conditionals (if or case) to display news exceprts in the way you want.
Look for a variable LANGUAGE, and then add a case to the display_news_items function in the way

Code:
$newslang = LANGUAGE;
if (function_exists('display_news_items')) {
...

switch ($newslang)
{
    case "EN":
        $readmore_text="Read more";
        break;
    case "CZ":
        $readmore_text="Beri več";
        break;
    default: //your default language
        $readmore_text = "Weiter lesen";
        break;
}
...

}
Can't guarantee above code will work flawlessy, as I don't have the ability to test it on multilanguage website.
You may also try using if & elseif syntax.



edit: the same goes for $display_mode variable.
But you'd have to create own display modes for all languages you use, if display has to  differ.
« Last Edit: June 08, 2011, 12:37:37 PM by YoJoe » Logged

WuJitsu - in web I trust  cool
Roych

Offline Offline

Posts: 149



« Reply #2 on: June 08, 2011, 01:17:27 PM »

Thank you for help I somehow didn't make it work. I'm not a coder so don't really know where to put all this. Sry Sad


For better understanding my needs. I need anynews module to work with news archive module.
Because anynews_archive is missing all the languages and css!

If this was the thing you wanted to help me with, can you please be more specific, where do I place this code.
 ........modules/anynews/include.php ?

or?


Thanx
Logged
YoJoe

Offline Offline

Posts: 74


WWW
« Reply #3 on: June 08, 2011, 03:02:41 PM »

ohh, no wonder it doesn't work in the way you want.
I didn't understand you use another news plugin, and want to show captions on the news page, not on the page you show news with anynews.
After looking inside plugin's code, I see that it's more a duplicate of news plugin.
It should process automatically translations files from language directory.
But I don't see it makes own directory during installation process.
If it has own directory in /modules, copy languages directory from /modules/news to archive plugin's directory.
If it deleted /modules/news during install, and overwrote it, copy news languages directory from WB archive.

I don't have any more ideas, as I'd have to test it more, and atm I have very little time because of deployment.



edit: no wonder I didn't get what you were talking about.
Earlier solution should be working perfectly with anynews-archive module (containing 3 files).
Do a simple test by pasting
<?php echo LANGUAGE ?>
somewhere in your template, to see the current page's language. String which will be shown is the case string of the condition to show readmore text.
If this "snippet" shows DE on in e.g. spanish news page, then solution I posted won't work for logical purposes.


you can use also if/elseif in the way
Code:
if (LANGUAGE == "EN") {
    $readmore_text="Read more";
} elseif (LANGUAGE == "DE") {
    $readmore_text = "Weiter lesen";
} elseif (LANGUAGE == "WHATEVER") {
   $readmore_text = "WHATEVER more";
}

and so on
« Last Edit: June 08, 2011, 03:13:51 PM by YoJoe » Logged

WuJitsu - in web I trust  cool
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!