PEAK XOOPS - piCalのclass定義でカテゴリ名を使う場合 in englishin japanese

piCalのclass定義でカテゴリ名を使う場合

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 .2 | Posted on 2008/1/17 20:03 | Last modified
runaruna  二等兵   Posts: 2
長年piCalを使わせて頂いております。(^人^)感謝♪

そこで以前から悩んでいた
ちょっと嬉しいはずのclass=カテゴリ名でのCSS指定について

CSSのクラス名に日本語っていうのは使えるのかもしれないですが、カテゴリ名にスペースが入ると指定できないですよね?

で、今回改変してみたところ上手く行っているようなので、どなたかの参考になればと思い書き込ませて頂きます。

class>piCal.php の1121行目あたり
元のコード↓※見当たらないときは catname を検索
// サニタイズ
$event->summary = $this->text_sanitizer_for_show( $event->summary ) ;
// categories
$catname = $this->text_sanitizer_for_show( $this->categories[ intval( $event->categories ) ]->cat_title ) ;
// とりあえず半角33字を上限としておく
$summary = mb_strcut( $event->summary , 0 , 33 ) ;
if( $summary != $event->summary ) $summary .= ".." ;
$event_str_tmp = "&bull;&nbsp;<a href='$get_target?smode=Monthly&amp;action=View&amp;event_id=$event->id&amp;caldate=$this->caldate' style='font-size:10px;font-weight:normal;text-decoration:none;' class='$catname'>$summary</a>" ;


改変したコード
// サニタイズ
$event->summary = $this->text_sanitizer_for_show( $event->summary ) ;
// categories
$catname = $this->text_sanitizer_for_show( $this->categories[ intval( $event->categories ) ]->cat_title ) ;
$mycat = $this->text_sanitizer_for_show( $this->categories[ intval( $event->categories ) ]->cid ) ;
// とりあえず半角33字を上限としておく
$summary = mb_strcut( $event->summary , 0 , 33 ) ;
if( $summary != $event->summary ) $summary .= ".." ;
//$event_str_tmp = "&bull;&nbsp;<a href='$get_target?smode=Monthly&amp;action=View&amp;event_id=$event->id&amp;caldate=$this->caldate' style='font-size:10px;font-weight:normal;text-decoration:none;' class='$catname'>$summary</a>" ;
$event_str_tmp = "&bull;&nbsp;<a href='$get_target?smode=Monthly&amp;action=View&amp;event_id=$event->id&amp;caldate=$this->caldate' title='$catname' style='font-size:10px;font-weight:normal;text-decoration:none;' class='piCal_cat$mycat'>$summary</a>" ;

変更点
1)クラス名を cat_title ではなく cid を使ったものに。
以下の行を追加
$mycat = $this->text_sanitizer_for_show( $this->categories[ intval( $event->categories ) ]->cid ) ;

以下の行をコメントアウト
//$event_str_tmp = "&bull;&nbsp;<a href='$get_target?smode=Monthly&amp;action=View&amp;event_id=$event->id&amp;caldate=$this->caldate' style='font-size:10px;font-weight:normal;text-decoration:none;' class='$catname'>$summary</a>" ;


2)cat_title は、リンクのtitleに流用。
以下の行を追加
$event_str_tmp = "&bull;&nbsp;<a href='$get_target?smode=Monthly&amp;action=View&amp;event_id=$event->id&amp;caldate=$this->caldate' title='$catname' style='font-size:10px;font-weight:normal;text-decoration:none;' class='piCal_cat$mycat'>$summary</a>" ;

※最終行の piCal_cat$mycat の piCal_cat は任意の文字列でOK。

一度該当ページを表示させてソースを確認。
class="piCal_cat00001"などを確認して適宜スタイルを定義。
images>default>style.css
.piCal_cat00001{
    background:url(http://xxx.com/modules/cal1/images/default/listicon.gif);
    background-repeat: no-repeat;
    padding: 0 0 0 17px;
    color:blue;
}

こんな感じで今のところ上手く動作していますが何か問題があったらお知らせ下さい。
Votes:6 Average:8.33
Previous post - Next post | Parent - No child | Posted on 2008/1/21 4:48
GIJOE  先任軍曹   Posts: 4110
runarunaさん、こんにちは。

Quote:

こんな感じで今のところ上手く動作していますが何か問題があったらお知らせ下さい。
もちろん、何も問題ありません

確かにカテゴリ名そのものをclass名とされても使いづらいですよね。

私がpiCalに手を入れることは、少なくとも近いうちにはないと思いますが、参考になる人も多いと思います。
Votes:3 Average:10.00
Previous post - Next post | Parent - No child | Posted on 2008/1/24 16:45
runaruna  二等兵   Posts: 2
GIJOEさま 問題なくてよかったです^^

でも、上手く行かない場合がありました(笑)
これは元の仕様で仕方のないことだと思うのですが、ブロックで月別フルサイズカレンダー(カレンダー本体)を表示してる場合
piCalモジュールで指定したCSS(modules>piCal※>images>default>style.css)が有効ではありません。
※piCalを利用している該当フォルダ

というわけで、単純な解決策
利用しているテーマのスタイル定義 (例:themes>default>style.css)にも指定してしまうと上手く行きます。
が・・・、それじゃpiCalのCSSに指定する必要もないという話に。(><)

私は忘れないためにpiCalのstyle.cssの中で
/* Notice! This line is added to themes style.css */
と書いて、両方に指定しています。
・・・本当は自分のは日本語で書いてます。英語は苦手(ToT)
Votes:5 Average:10.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!