31
Daigoro
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/7/23 0:37

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


I have just hacked the tinyevent module v1.01 to be fully multilangual.

First there's a simple hack to the te_nextevents.php file located in /modules/tinyevent/blocks/

Just before the while-loop starts in line 43, I have added the following:
Quote:
$myts =& MyTextSanitizer::getInstance();


Then I replaced the following line:
Quote:
$events['event'] = $te_event['event'];

With this line:
Quote:
$events['event'] = $myts->makeTboxData4Show($te_event['event']);



Second there's also a small change to the display.inc.php file located in /modules/tinyevent/include/

I started by adding the following line as line 2, just after the php statement.
Quote:
include_once XOOPS_ROOT_PATH."/class/module.textsanitizer.php");


Then I replaced the two instanses of the following:
Quote:
printf(_TE_COMESFROM,$xoopsConfig['sitename']);


With this:
Quote:
$myts =& MyTextSanitizer::getInstance();
printf(_TE_COMESFROM,$myts->makeTboxData4Show($xoopsConfig['sitename']));


This seems to work for me.

I've noticed one tiny flaw, which I can't realy figure out.
If I have an event written in Japanese, then sometimes when I click on the 'printer frindly' icon, the encoding changes to 'Western European' instead of the 'Japanese (EUC)' I was just using on the previous page. If you have any idear why, please let me know!

I hope I remembered to mention all of the changes I made to the files to make it work.

--
Daigoro

32
Daigoro
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/8/5 17:52

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Finaly I figured out where the site name of the titleline was inserted into the site. Just as with the Slogan, it's in the header.php file.

The title line is divided into two parts:
The first part is the site name, set using the admin->preferances->general settings form.
The second part is a slogan which changes for each module you enter - and for the startpage is is set in same place as the site name.

In a previous posting in this thread, I explained the four placed I changed to change the slogan. I at the time that two of the four changes would cover the site name and the other two would cover the slogan - not so!

In order to change the site name, I replaced the following line
$xoopsTpl->assign(array('xoops_theme' => $xoopsConfig['theme_set'], 'xoops_imageurl' => XOOPS_URL.'/themes/'.$xoopsConfig['theme_set'].'/''xoops_themecss'=> xoops_getcss($xoopsConfig['theme_set']), 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), 'xoops_sitename' => $xoopsConfig['sitename'], 'xoops_slogan' => $xoopsConfig['slogan']));


...with the following lines

$myts =& MyTextSanitizer::getInstance();
$xoopsTpl->assign(array('xoops_theme' => $xoopsConfig['theme_set'], 'xoops_imageurl' => XOOPS_URL.'/themes/'.$xoopsConfig['theme_set'].'/''xoops_themecss'=> xoops_getcss($xoopsConfig['theme_set']), 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), 'xoops_sitename' => $myts->makeTboxData4Show($xoopsConfig['sitename']), 'xoops_slogan' => $xoopsConfig['slogan']));


and voila, the browsertitle is multilangual.

(Phew - finally I found it


33
azeini
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/8/5 19:37

  • azeini

  • Just popping in

  • Posts: 19

  • Since: 2003/7/23


Hi Chado,

This is a great hack.

Greetings.

34
einherjer
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/8/14 17:28

  • einherjer

  • Just popping in

  • Posts: 30

  • Since: 2002/11/8


Thank you for this great hack, i was looking for something like this a long time.

Currently i try to apply it to a testsite an also integrate it in the modules and blocks i use and into the administration section.

I hope someone can help me with some problems i have:

- Select boxes (drop-down menus)
eg. if i activate the navigation box in the news i have all two languages (german/english) and i found no way to change this :(

the html output of the drop down menu looks like this:
Quote:



i think the following function have to be changed:
Quote:
if ( $xoopsModuleConfig['displaynav'] == 1 ) {
$xoopsTpl->assign('displaynav', true);
$xt = new XoopsTopic($xoopsDB->prefix('topics'));
ob_start();
$xt->makeTopicSelBox(1, $xoopsOption['storytopic'], 'storytopic');
$topic_select = ob_get_contents();
ob_end_clean();
$xoopsTpl->assign('topic_select', $topic_select);
$storynum_options = '';
for ( $i = 5; $i <= 30; $i = $i + 5 ) {
$sel = '';
if ($i == $xoopsOption['storynum']) {
$sel = ' selected="selected"';
}
$storynum_options .= '';
}
$xoopsTpl->assign('storynum_options', $storynum_options);
} else


as this applys to many select boxes through XOOPS a solution would be great - i have no idea how to get this to work.

- some blocks (eCal)
I got some other blocks to work (polls, whos online,...) but not the next events block from eCal:
Quote:
function eCal_nextn() {
//
// Next N Events block
//
global $xoopsDB, $xoopsConfig;
$block = array(); include($xoopsConfig['root_path']."/modules/eCal/cache/config.php");
$block['title'] = str_replace('%N', $nextncount, _MB_ECAL_NEXTN) ;
// how many events to show?
$numEvents = $nextncount;
$usertimevent = (userTimeOffset()*3600) +time();
$start = date("Y-m-j", addDays(0, $usertimevent))." 00:00:00";
$query = "SELECT subject, stamp FROM ".$xoopsDB->prefix("eCal")
." WHERE valid='yes' AND (stamp >= '$start') AND valid='yes' order by stamp limit 0, $numEvents";
$block['content'] = content( $query,"" );
if ($block['content'] == "") $block['content'] .= _NOEVENTSCHED;
return $block;
}


Don´t worry - i dont want a complete solution but some ideas would help me i hope

PS: Sorry for the long post and ich hope my english ist readable to you

35
hsalazar
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/8/14 18:15

  • hsalazar

  • Just popping in

  • Posts: 78

  • Since: 2003/2/6 1


einherjer:

One thing at a time. Here's what you need to do to successfully hack the options in a select box.

1) First, go to your database and in the table xoops_topics change the field topic_title from varchar(50) to varchar(255). This is so you have ample space to write the topic name in the database.

2) Open your file admin/index.php and look for the function modTopic() around line 226. Look for the place where the input text box is defined and instead of having 20 and 40 as the values for size and maxlength, set them to 40 and 250, so the page lets you write enough characters.

3) The function you mention is not the place to change site-wide the select boxes. For that, open your file class/xoopstree.php and look for function makeMySelBox(...). There, just before the line:

echo "$catid'$sel>$name\n";

add a line saying:

$name $myts->makeTboxData4Show($name);


This has the effect of passing the variable $name through the sanitizer, and since this is hacked, it will display the correct string in your site's select boxes.

I think that should do it. Hope it helps.

Cheers.

36
einherjer
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/8/15 0:54

  • einherjer

  • Just popping in

  • Posts: 30

  • Since: 2002/11/8


Thanks a lot hsalazar!

Just edited the files and it works great!

As ich can see all select boxes works correct now

37
mCity
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/9/8 13:22

  • mCity

  • Just popping in

  • Posts: 52

  • Since: 2003/3/31


This is really a great hack that I could modify XOOPS by myself from all your information.

Let me share a little hack for checkbox in Adv. Search to have modules list in multilingual.

open /class/xoopsform/formcheckbox.php

after function addOptionArray($options){

add
Quote:


$myts =& MyTextSanitizer::getInstance();

before $this->addOption($k, $v);
add Quote:

$v = $myts->makeTboxData4Show($v);

Happy to share in here.

ERROR Let's take out this, this would affect group admin by showing up html link for each blocks.

38
Chado
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/9/8 15:32

  • Chado

  • Not too shy to talk

  • Posts: 113

  • Since: 2003/6/6 7


Thanks a lot mCity! We are slowly making progress on getting many of the modules multilingualized (new word!)
Chad

39
mCity
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/9/9 13:45

  • mCity

  • Just popping in

  • Posts: 52

  • Since: 2003/3/31


Chad, I enjoy to hack and share for multilingual. Well, I should say many thanks to you all first. You all start my engine to hack XOOPS.

In Admin->News->Modify Topic, it would decode the topic title if we try to modify it. We have to retype all again for all language title. But I found XOOPS is Good and well prepared. Lets correct this file.

Open /modules/news/admin/index.php

goto line 241 in function modTopic()

modify Quote:


This function used default format 'S' 4show (but we hacked). The function has been well prepared to accept parameter 'E' 4Edit format which we should use in this file.

Hope XOOPS developer update this file.

PS. I changed maxlength of title to 50 as database defined, and thinking why XOOPS defined 40 in this file.

40
IsiRyder
Re: SOLVED - Making Xoops CONTENT Multilingual *Fixed Code Quote problem*
  • 2003/9/19 13:44

  • IsiRyder

  • Just popping in

  • Posts: 2

  • Since: 2003/9/19


Hi everyone!

This is my first message but not the last one!

Great hack!. I've already hacked contents and titles, but what about hacking links ?? When using [language][/language] in titles, changing language to spanish and so on, i have not enough space to do it. How can i change the length in a safe way?


Thanks

Login

Who's Online

339 user(s) are online (220 user(s) are browsing Support Forums)


Members: 0


Guests: 339


more...

Donat-O-Meter

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

Latest GitHub Commits