- 追加された行はこの色です。
- 削除された行はこの色です。
* テーブル幅をパーセントで指定したい。 [#gdf109d5]
- ページ: [[BugTrack2]]
- 投稿者: [[ch@in]]
- 優先順位: 普通
- 状態: 提案
- カテゴリー: 本体新機能
- 投稿日: 2015-07-30 (木) 18:34:37
- バージョン:
** メッセージ [#h04de4cb]
表組み表現でのテーブルは現在、px単位での指定となっています。
また、それぞれのth,tdタグに対して指定がされています。
しかし、tableタグに対しての指定方法が皆無で、またパーセント指定ができません。
昨今、スマートフォンによる利用者が出てきており、画面幅がPCとくらべて狭いユーザがいます。
そういったユーザーに対して可変的に対応できるパーセント指定は便利なものだと考えています。
--------
*サンプルコード [#xac84c47]
- 123行付近 function &Factory_Table()
function &Factory_Table(&$root, $text)
{
- if (!preg_match('/^\|(.+)\|([hHfFcC]?)$/', $text, $out)) {
+ if (!preg_match('/^\|(.+)\|(([hHfF]|[cC](\d+)?)?)$/', $text, $out)) {
- 515行付近 class TableCell extends Element
if ($is_template && is_numeric($text)) {
$this->style['width'] = 'width:'.$text.'px;';
}
+ if ($is_template && substr($text,-1) == '%' && is_numeric(substr($text,0,-1))) {
+ $this->style['width'] = 'width:'.$text.';';
+ }
- 605行付近 class Table extends Element]
-- 640行付近 public function toString()
if ($this->types[$nrow] == 'c') {
$stylerow = &$row;
- }
+ } else if(substr($this->types[$nrow],0,1) == 'c'){
+ $stylerow = &$row;
+ $_table_width = (is_numeric(substr($this->type,1))) ? substr($this->type,1) : "";
+ }
}
$string .= $this->wrap($part_string, $part);
}
+ $_table_width = $_table_width ? $_table_width.'%' : '';
- $string = $this->wrap($string, 'table', ' class="style_table" cellspacing="1" border="0"');
+ $string = $this->wrap($string, 'table', ' class="style_table" cellspacing="1" border="0" style="width:'.$_table_width.';"');
--------
#comment