| |
| | |

CodersClub

 Forgot password?
 Register
Search
Author: khalid
Collapse the left

RTL CSS & Templates

[Copy link]

 Russia

Post time: 2011-12-13 14:00
| Show all posts
Can not understand the idea...

Did you compare this two files?
/data/cache/style_1_module.css
and /data/cache/style_1_module_rtl.css

 Palestine

 Author| Post time: 2011-12-13 14:04
| Show all posts
Edited by khalid at 2011-12-13 13:05

i mean the problem from this line
  1. /*vot*/                $content = @implode('', file(DISCUZ_ROOT.'./data/cache/style_'.STYLEID.'_module'.$direction.'.css'));
Copy the Code
in class_template.php file


but when i use default value  module_rtl.css not used

The question now :-

How to use module_rtl.css  without the previous problem ?

 Russia

Post time: 2011-12-13 15:15
| Show all posts
i mean the problem from this line

I see this line,
but I can not understand, what is wrong here???

At what the URL this style appear in the html code?

 Palestine

 Author| Post time: 2011-12-13 20:12
| Show all posts
I mean this line is case this problem


please Restore the original line

or check it

 Russia

Post time: 2011-12-13 20:31
| Show all posts
I see, the reason is in absolutely another place.

By default, the forum index page must contain 2 css files:
<link rel="stylesheet" type="text/css" href="data/cache/style_1_common.css?5EP" />
<link rel="stylesheet" type="text/css" href="data/cache/style_1_forum_index.css?5EP" />

But after switching to Arabic language the page include only one css file:
<link rel="stylesheet" type="text/css" href="data/cache/style_1_common_rtl.css?5EP" />

File style_1_forum_index.css is exists.
But style_1_forum_index_rtl.css is NOT exists.

So, the file "style_1_forum_index_rtl.css" is not generated when updating the cache.
It is required to verify the compile style function...



 Palestine

 Author| Post time: 2011-12-13 20:39
| Show all posts
vot رد في  2011-12-13 19:31
I see, the reason is in absolutely another place.

By default, the forum index page must contain 2 c ...

What is the solution now?

 Russia

Post time: 2011-12-13 20:45
| Show all posts
Look for bug...
Post time: 2011-12-13 22:35
| Show all posts
use this functions:

writetocsscache, file cache_styles.php
  1. function writetocsscache($data) {
  2.         global $_G;
  3.         $cssdir = ($_G[langdir] == "ltr") ? "" : "_rtl" ;
  4.         $dir = DISCUZ_ROOT.'./template/default/common/';
  5.         $dh = opendir($dir);
  6.         $data['staticurl'] = STATICURL;
  7.         while(($entry = readdir($dh)) !== false) {
  8.                 if(fileext($entry) == 'css') {
  9.                         $cssfile = DISCUZ_ROOT.'./'.$data['tpldir'].'/common/'.$entry;
  10.                         !file_exists($cssfile) && $cssfile = $dir.$entry;
  11.                         $cssdata = @implode('', file($cssfile));
  12.                         if(file_exists($cssfile = DISCUZ_ROOT.'./'.$data['tpldir'].'/common/extend_'.$entry)) {
  13.                                 $cssdata .= @implode('', file($cssfile));
  14.                         }
  15.                         if(is_array($_G['setting']['plugins']['available']) && $_G['setting']['plugins']['available']) {
  16.                                 foreach($_G['setting']['plugins']['available'] as $plugin) {
  17.                                         if(file_exists($cssfile = DISCUZ_ROOT.'./source/plugin/'.$plugin.'/template/extend_'.$entry)) {
  18.                                                 $cssdata .= @implode('', file($cssfile));
  19.                                         }
  20.                                 }
  21.                         }
  22.                         $cssdata = preg_replace("/\{([A-Z0-9]+)\}/e", '\$data[strtolower(\'\1\')]', $cssdata);
  23.                         $cssdata = preg_replace("/<\?.+?\?>\s*/", '', $cssdata);
  24.                         $cssdata = !preg_match('/^http:\/\//i', $data['styleimgdir']) ? preg_replace("/url\((["'])?".preg_quote($data['styleimgdir'], '/')."/i", "url(\\1../../$data[styleimgdir]", $cssdata) : $cssdata;
  25.                         $cssdata = !preg_match('/^http:\/\//i', $data['imgdir']) ? preg_replace("/url\((["'])?".preg_quote($data['imgdir'], '/')."/i", "url(\\1../../$data[imgdir]", $cssdata) : $cssdata;
  26.                         $cssdata = !preg_match('/^http:\/\//i', $data['staticurl']) ? preg_replace("/url\((["'])?".preg_quote($data['staticurl'], '/')."/i", "url(\\1../../$data[staticurl]", $cssdata) : $cssdata;
  27.                         if($entry == 'module.css' || $entry == 'module_rtl.css') {
  28.                                 $cssdata = preg_replace('/\/\*\*\s*(.+?)\s*\*\*\//', '[\\1]', $cssdata);
  29.                         }
  30.                         $cssdata = preg_replace(array('/\s*([,;:\{\}])\s*/', '/[\t\n\r]/', '/\/\*.+?\*\//'), array('\\1', '',''), $cssdata);
  31.                         if(@$fp = fopen(DISCUZ_ROOT.'./data/cache/style_'.$data['styleid'].'_'.$entry, 'w')) {
  32.                                 fwrite($fp, $cssdata);
  33.                                 fclose($fp);
  34.                         } else {
  35.                                 exit('Can not write to cache files, please check directory ./data/ and ./data/cache/ .');
  36.                         }
  37.                 }
  38.         }
  39. }
Copy the Code
loadcsstemplate, file class_template.php
  1. function loadcsstemplate() {
  2.                 global $_G;
  3.                 $cssdir = ($_G[langdir] == "ltr") ? "" : "_rtl" ;
  4.                 $scriptcss = '<link rel="stylesheet" type="text/css" href="data/cache/style_{STYLEID}_common'.$cssdir.'.css?{VERHASH}" />';
  5.                 $content = $this->csscurmodules = '';
  6.                 $content = @implode('', file(DISCUZ_ROOT.'./data/cache/style_'.STYLEID.'_module'.$cssdir.'.css'));
  7.                 $content = preg_replace("/\[(.+?)\](.*?)\[end\]/ies", "\$this->cssvtags('\\1','\\2')", $content);
  8.                 if($this->csscurmodules) {
  9.                         $this->csscurmodules = preg_replace(array('/\s*([,;:\{\}])\s*/', '/[\t\n\r]/', '/\/\*.+?\*\//'), array('\\1', '',''), $this->csscurmodules);
  10.                         if(@$fp = fopen(DISCUZ_ROOT.'./data/cache/style_'.STYLEID.'_'.$_G['basescript'].'_'.CURMODULE.$cssdir.'.css', 'w')) {
  11.                                 fwrite($fp, $this->csscurmodules);
  12.                                 fclose($fp);
  13.                         } else {
  14.                                 exit('Can not write to cache files, please check directory ./data/ and ./data/cache/ .');
  15.                         }
  16.                         $scriptcss .= '<link rel="stylesheet" type="text/css" href="data/cache/style_{STYLEID}_'.$_G['basescript'].'_'.CURMODULE.$cssdir.'.css?{VERHASH}" />';
  17.                 }
  18.                 $scriptcss .= '{if $_G[uid] && isset($_G[cookie][extstyle]) && strpos($_G[cookie][extstyle], TPLDIR) !== false}<link rel="stylesheet" id="css_extstyle" type="text/css" href="$_G[cookie][extstyle]/style.css" />{elseif $_G[style][defaultextstyle]}<link rel="stylesheet" id="css_extstyle" type="text/css" href="$_G[style][defaultextstyle]/style.css" />{/if}';
  19.                 return $scriptcss;
  20.         }
Copy the Code
this functions work as your rules:

LTR CSS:
common.css
...

RTL CSS:
common_rtl.css

 Russia

Post time: 2011-12-14 08:35
| Show all posts

 Russia

Post time: 2011-12-14 08:37
| Show all posts
Lets's look to RTL pages again.
1) Find wrong positioned elements and correct it's style
2) Find images that must be converted to RTL.
You have to log in before you can reply Login | Register

Points Rules

Archive|Mobile|Dark room|CodersClub

Top.Mail.Ru
Top.Mail.Ru

2024-05-02 13:12 GMT+3 , Processed in 0.107865 sec., 7 queries .

Powered by Discuz! X3.4 Release 20230520

© 2001-2024 Discuz! Team.

MultiLingual version, Rev. 4301, © codersclub.org

Quick Reply To Top Return to the list