1
BCdudes
Different Theme for Each Language, Script
  • 2006/11/28 16:03

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


Hey All

I have the following script that I put in a folder called "multi" under "themes" as the theme.html file, so it can choose the theme for me according to my modules.

<{php}>
    
$mod $GLOBALS['xoopsModule'];
    
$dirname = (isset($mod) ? $mod->getVar('dirname') :'system');
if (
$dirname == 'jar') {
   
$theme='jartheme';
  } else {




   
$theme='geometric_red';
}




$this->assign('themename'$theme.'/theme.html');
$this->assign('xoops_theme'$theme);
$this->assign('xoops_themecss'XOOPS_URL.'/themes/'.$theme.'/style.css');
$this->assign('xoops_imageurl'XOOPS_URL.'/themes/'.$theme.'/');
<{/
php}>
<{include 
file="$themename"}>



The script is great and works very well ( I think I got it from here,from a very kind person, thank you)...

What I need is to use a similar script, but instead of modules, i want it to be languages, something as such:
if langcode=en then use "ThemeEN"
if langcode=fr then use "ThemeFR"
else use "ThemeGeneric"


Thank you for your help in advance

Regards

BCdudes

2
BCdudes
Re: Different Theme for Each Language, Script
  • 2006/11/28 16:11

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


Oh and I use "xlanguage"

3
BCdudes
Re: Different Theme for Each Language, Script
  • 2006/11/28 21:40

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


any help ???

4
BCdudes
Re: Different Theme for Each Language, Script
  • 2006/11/29 14:32

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


never mind dudes, i foudn the solution.


Edit "header.php" in the root folder
and insert this code:

if ($xoopsConfig['language'] == 'arabic') { 
   
$xoopsConfig['theme_set']='arabicversion'
  } else { 
   
$xoopsConfig['theme_set']='englishversion'
}


before this line (at about line 30)
include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';

5
irmtfan
Re: Different Theme for Each Language, Script
  • 2006/11/29 16:09

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


a better solution without touching core files is using <{$xoops_langcode}> as below :
create a theme.html JUST with the following code:

<{include file="YOUR_THEME_NAME/theme_$xoops_langcode.html"}>

then create theme_ar.html theme_en.html and ...

but if you just want to RTL a theme there is exist even a better method for that.

6
BCdudes
Re: Different Theme for Each Language, Script
  • 2006/11/29 17:20

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


I tried the whole day messing up with $xoops_langcode , but the #OOPS# thing doesnt want to work (probably cuz i had everything in PHP rather than embedded php in HTML), i didn't try your method, but i am sure it will work.

My major problem is the RTL really, in the past, i used to do the whole thing on my own, create a StyleRTL.css file, and mirror most images, and use one theme.html file with [en][/en] [ar][/ar] tags in it to specify the content and the CSS file names, but i noticed its a lot of work, what i am doing now, is getting one theme from the arabic XOOPS support site (arabxoops.org) and getting its english counterpart, putting them into two different folders, and using the code i put above in the header.php to use the different theme for each language (I find that to take a tremendously lesser amount of time compared to my method above of editing the whole #OOPS# Style.css).

Do you have any easier method ? please enlighten me .

7
irmtfan
Re: Different Theme for Each Language, Script
  • 2006/11/29 17:22

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


sorry it needs a correction:

<{include file="YOUR_THEME_NAME/theme_$xoops_langcode.html"}>

Quote:
Do you have any easier method ?

yes i have the easiest method:
thanks to rowdi now we be able to have RTL themes without any touch to original English themes.

it means you just upload an LTR theme and it will be RTL in Arabic automatically.

but you always need to do some modifications like mirror images, logo , ...

this is just works in 2.0.14+ ( not 2.2)
open footer.php and add these lines:
// Start rowdi/irmtfan addition: assign the language css file to the template, if required
        
if ( file_exists(XOOPS_ROOT_PATH."/language/".$GLOBALS['xoopsConfig']['language']."/css/"._LANGCODE.".css") ) {
            
$xoTheme->addStylesheet"/language/".$GLOBALS['xoopsConfig']['language']."/css/"._LANGCODE.".css", array( "media" => "screen" ) );
        }
        if ( 
file_exists(XOOPS_ROOT_PATH."/language/".$GLOBALS['xoopsConfig']['language']."/js/"._LANGCODE.".js") ) {
            
$xoTheme->addScript"/language/".$GLOBALS['xoopsConfig']['language']."/js/"._LANGCODE.".js", array( "type" => "text/javascript" ) );
        }
        
// End rowdi/irmtfan addition

right BEFORE:
$xoTheme->render();

then put your RTL css file in language/YOUR_LANG/css/YOUR_LANG_CODE.css

ex: language/persian/css/fa.css

another edit:
i create a highly modified RTL style fa.css.
you can find it in the latest persian core patch for 2.0.16:
http://dev.xoops.org/modules/xfmod/project/showfiles.php?group_id=1164
you can use this patch for arabic without any problem just add your lang to language folders.

8
BCdudes
Re: Different Theme for Each Language, Script
  • 2006/11/29 17:34

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


but dont you need to create the RTL CSS from the English LTR CSS ??

9
irmtfan
Re: Different Theme for Each Language, Script
  • 2006/11/29 17:38

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


i do --> fa.css

and it has very good performance.
see xoops.ir as an example.

10
BCdudes
Re: Different Theme for Each Language, Script
  • 2006/11/29 17:41

  • BCdudes

  • Just popping in

  • Posts: 27

  • Since: 2006/8/31


is this fa.css specific to your theme? or is it generic, and wut template did you use (is it the style.css available in most themes , or ?)

Login

Who's Online

109 user(s) are online (80 user(s) are browsing Support Forums)


Members: 0


Guests: 109


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits