**[[質問箱4/540]] [#z2a3c2c0] |RIGHT:70|LEFT:410|c |~サマリ|表組みの文字をtopにする| |~バージョン|1.4.7| |~投稿者|[[yataro]]| |~状態|質問| |~投稿日|&new{2009-12-22 (火) 20:31:22};| ***質問 [#x2ee240f] 表(テーブル)の中の文字を上に持っていく方法はありますでしょうか? 現時点では改行を使って上に持っていくしかないので、どうにかできるとうれしいのですが。 |文字列1&br;文字列2&br;文字列3&br;文字列4|文字列1| となってしまうので、右側の表の文字を上にしたいのです。 ***回答 [#f58e6561] - [[質問箱3/343]] -- &new{2009-12-23 (水) 03:29:24}; - wiki 全体で固定するなら、CSS を設定すればできます。表やセルごとに変えたい場合は、改造しないとできません。&br;lib/convert_html.php 1.18基準で --485行目あたり var $rowspan = 1; var $style; // is array('width'=>, 'align'=>...); + var $valign = ''; function TableCell($text, $is_template = FALSE) { --490行目あたり $this->style = $matches = array(); - while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\(([#\w]+)\)|SIZE\((\d+)\)):(.*)$/', + while (preg_match('/^(?:(LEFT|CENTER|RIGHT)|(BG)?COLOR\(([#\w]+)\)|SIZE\((\d+)\)|(TOP|MIDDLE|BOTTOM)):(.*)$/', $text, $matches)) { if ($matches[1]) { $this->style['align'] = 'text-align:' . strtolower($matches[1]) . ';'; - $text = $matches[5]; + $text = $matches[6]; } else if ($matches[3]) { $name = $matches[2] ? 'background-color' : 'color'; $this->style[$name] = $name . ':' . htmlspecialchars($matches[3]) . ';'; - $text = $matches[5]; + $text = $matches[6]; } else if ($matches[4]) { $this->style['size'] = 'font-size:' . htmlspecialchars($matches[4]) . 'px;'; - $text = $matches[5]; + $text = $matches[6]; + } else if ($matches[5]) { + $this->valign = strtolower($matches[5]); + $text = $matches[6]; } } if ($is_template && is_numeric($text)) $this->style['width'] = 'width:' . $text . 'px;'; --545行目あたり if ($this->colspan > 1) { $param .= ' colspan="' . $this->colspan . '"'; unset($this->style['width']); } + if (isset($this->valign != '') { + $param .= ' valign="' . $this->valign . '"'; + } if (! empty($this->style)) $param .= ' style="' . join(' ', $this->style) . '"'; - と改造すれば、TOP:, MIDDLE:, BOTTOM: のルールを追加できるはず。 -- &new{2009-12-23 (水) 03:58:41}; - wiki全体ではなく、上記改造の通りで指定したいと思っていました。早速やってみたのですが画面がエラーの真っ白になってうまくいきませんでした。&br;[[質問箱4/243]]の改造をしているのですが、それが原因なのでしょうか? -- [[yataro]] &new{2009-12-24 (木) 01:06:30}; - ぱっと見では、それだけだと干渉しないハズなので、追記位置がずれてパースエラー(構文エラー)になってるだけだとは思うんですが・・・。[[Q. 設置後にアクセスすると画面が真っ白になって、エラーメッセージが何も表示されない>Q&A/インストール#x80b2883]] を参考に、エラーを確認してみては?(ただ、PHP 5 なら[[dev:BugTrack2/146]] のエラーとかまで、表面化するかもしれませんが) -- &new{2009-12-24 (木) 02:31:10}; #comment