Перейти к контенту

Рекомендуемые сообщения

  • Ответы 85
  • Создана
  • Последний ответ

Лучшие авторы в этой теме

Лучшие авторы в этой теме

Незакрытый тэг не порушит документ. Я уже приводил пример как можно "порушить", но для этого юзеру надо две вложенные таблицы умудриться не так разместить

 

Так все же - будет ли возможность и в 2.1 воспользоваться табличками?

 

Постараюсь выделить время, но не обещаю, чтобы не говорили, что "обещать не хорошо" и тд :D

Ссылка на комментарий
Поделиться на других сайтах

Для версии 2.1.7

 

Открыть файл sources/classes/class_bbcode.php

 

Найти:

$txt = preg_replace( "#<!--quoteo([^>]+?)?-->(.+?)<!--quotec-->#sie", "\$this->_parse_new_quote('\\1', '\\2' )" , $txt );

 

Добавить ниже:

 

			 $txt = preg_replace( "#<!--tablebegin--><table(.*?)>#"				, "\n\[table\\1\]\n"		 , $txt );
				   $txt = preg_replace( "#</table><!--tableend-->#"				, "\[/table\]\n"		 , $txt );

				   $txt = preg_replace( "#<!--trS--><tr(.*?)>#"				, "\[tr\\1\]\n"		 , $txt );
				   $txt = preg_replace( "#</tr><!--trE-->#"				, "\n\[/tr\]\n"		 , $txt );

				   $txt = preg_replace( "#<!--tdS--><td(.*?)>#"				, "\[td\\1\]"		 , $txt );
				   $txt = preg_replace( "#</td><!--tdE-->#"				, "\[/td\]"		 , $txt );

 

Найти:

 

function regex_parse_tables_td($txt="", $attributes="")

 

добавить вышеописанную функцию для 2.0.х перед этой строкой.

 

Остальное все так же.

Ссылка на комментарий
Поделиться на других сайтах

Для 2.1 все тоже самое, только файл class_bbcode.php. Функции, надо вставлять, которые указаны в 1-м посте ЭТОЙ темы для форума v2.0.x.

 

Только в посте нужно писать [table border=1]...[/table] или еще впихнуть параметр color=black.

 

То, что написал efimer, я вообще не знаю, что это, особенно конец сообщения - что-то он там напутал. По этому рабочий вариант - первый пост.

Ссылка на комментарий
Поделиться на других сайтах

  • 3 недели спустя...
Jax, не могли бы вы пошагово (для тех кто на бронепоезде) описать в какие файлы из каких постов какие фрагменты кода нужно вставлять. Для версии 2.1.6 Спасибо.
Ссылка на комментарий
Поделиться на других сайтах

  • 1 месяц спустя...

Для 2.1.х

-------------------------------------------------------------------------------------------------------------------
| sources/classes/bbcode/class_bbcode.php
-------------------------------------------------------------------------------------------------------------------

-----------------------------------
| Найти:
-----------------------------------

$txt = preg_replace( "#(\[quote(.+?)?\].*\[/quote\])#ies" , "\$this->regex_parse_quotes('\\1')"  , $txt );

-----------------------------------
| Добавить выше:
-----------------------------------

/*Начало (Тег table)*/
while( preg_match( "#\n?\[table(.*?)\](.+?)\[/table\]\n?#is" , $txt ) )
						   {
								   $txt = preg_replace( "#\n?\[table(.*?)\](.+?)\[/table\]\n?#ies", "\$this->regex_parse_tables('\\2','\\1')" , $txt );
						   }
/*Конец (Тег table)*/

-----------------------------------
| Найти:
-----------------------------------

	return $before . str_replace( '<br />', '', str_replace( "? ", "?", $url )  ) . $after;
}

-----------------------------------
| Добавить ниже:
-----------------------------------
   /*Начало (Тег table)*/
   function regex_parse_tables($txt="", $attributes="")
   {
	   global $ibforums;
	   $attr="";
	   if ($attributes)
	   {
		  if (preg_match("#border=([1-7])#i", $attributes, $a))
			$attr.=" border=".$a[1];
		  if (preg_match("#bordercolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))
			$attr.=" bordercolor=".$a[1];
		  if (preg_match("#width=([0-9]+)%#i", $attributes, $a))
			$attr.=" width={$a[1]}%";
		  if (preg_match("#cellspacing=([1-7])#i", $attributes, $a))
			$attr.=" cellspacing={$a[1]}";
		  if (preg_match("#cellpadding=([1-7])#i", $attributes, $a))
			$attr.=" cellpadding={$a[1]}";
		  if (preg_match("#bgcolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))
			$attr.=" bgcolor=".$a[1];
		  if (preg_match("#background=(\S+)#i", $attributes, $a) )
		  {
				$url=$a[1]; $error=0;
				 if ($this->ipsclass->vars['allow_dynamic_img'] != 1)
				  {
						  if (preg_match( "/[?&;]/", $url)) $error=1;
						  if (preg_match( "/javascript(\:|\s)/i", $url )) $error=1;
				  }
				  if ($this->ipsclass->vars['img_ext'])
				  {
				   $extension = preg_replace( "#^.*\.(\S+)$#", "\\1", $url );
				   $extension = strtolower($extension);
				   if ( (! $extension) OR ( preg_match( "#/#", $extension ) ) ) $error=1;
				   $this->ipsclass->vars['img_ext'] = strtolower($this->ipsclass->vars['img_ext']);
				   if ( ! preg_match( "/".preg_quote($extension, '/')."(,|$)/", $this->ipsclass->vars['img_ext'] )) $error=1;
		   }
		   if (!preg_match( "/^(http|https|ftp):\/\//i", $url )) $error=0;
		   $url = str_replace( " ", "%20", $url );
		   if (!$error) $attr.=" background={$a[1]}";
		  }
		  if (preg_match("#align=(center|left|right)#i", $attributes, $a))
			 $attr.=" align=".$a[1];
	   }
	   while( preg_match( "#\n?\[tr(.*?)\](.+?)\[/tr\]\n?#is" , $txt ) )
	   {
			 $txt = preg_replace( "#\n?\[tr(.*?)\](.+?)\[/tr\]\n?#ies", "\$this->regex_parse_tables_tr('\\2', '\\1')" , $txt );
	   }
	   return "<!--tablebegin--><table{$attr}>".$txt."</table><!--tableend-->";
   }
   function regex_parse_tables_tr($txt="", $attributes="")
   {
			global $ibforums;
			$attr="";
			if ($attributes)
			{
			   if (preg_match("#height=([0-9]+)#i", $attributes, $a))
				  $attr.=" height=".$a[1];
			   if (preg_match("#valign=(top|middle|bottom)#i", $attributes, $a))
				  $attr.=" valign=".$a[1];
			   if (preg_match("#align=(center|left|right)#i", $attributes, $a))
				  $attr.=" align=".$a[1];
			   if (preg_match("#bgcolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))
				  $attr.=" bgcolor=".$a[1];
			   if (preg_match("#background=(\S+)#i", $attributes, $a) )
			   {
				 $url=$a[1]; $error=0;
				 if ($this->ipsclass->vars['allow_dynamic_img'] != 1)
				  {
						  if (preg_match( "/[?&;]/", $url)) $error=1;
						  if (preg_match( "/javascript(\:|\s)/i", $url )) $error=1;
				  }
				  if ($this->ipsclass->vars['img_ext'])
				  {
				   $extension = preg_replace( "#^.*\.(\S+)$#", "\\1", $url );
				   $extension = strtolower($extension);
				   if ( (! $extension) OR ( preg_match( "#/#", $extension ) ) ) $error=1;
				   $this->ipsclass->vars['img_ext'] = strtolower($this->ipsclass->vars['img_ext']);
				   if ( ! preg_match( "/".preg_quote($extension, '/')."(,|$)/", $this->ipsclass->vars['img_ext'] )) $error=1;
				  }
				  if (!preg_match( "/^(http|https|ftp):\/\//i", $url )) $error=0;
				  if (!$error) $attr.=" background={$a[1]}";
			   }
		   }
		   while( preg_match( "#\n?\[td(.*?)\](.+?)\[/td\]\n?#is" , $txt ) )
		   {
				  $txt = preg_replace( "#\n?\[td(.*?)\](.+?)\[/td\]\n?#ies", "\$this->regex_parse_tables_td('\\2', '\\1')" , $txt );
		   }
		   return "<!--trS--><tr{$attr}>".$txt."</tr><!--trE-->";
   }
   function regex_parse_tables_td($txt="", $attributes="")
   {
		   global $ibforums;
		   $attr="";
		   if ($attributes)
		   {
			   if (preg_match("#width=([0-9]+)%#i", $attributes, $a))
				   $attr.=" width={$a[1]}%";
			   if (preg_match("#height=([0-9]+)#i", $attributes, $a))
				  $attr.=" height=".$a[1];
			   if (preg_match("#valign=(top|middle|bottom)#i", $attributes, $a))
				  $attr.=" valign=".$a[1];
			   if (preg_match("#align=(center|left|right)#i", $attributes, $a))
				  $attr.=" align=".$a[1];
			   if (preg_match("#colspan=([0-9]+)#i", $attributes, $a))
				  $attr.=" colspan=".$a[1];
			   if (preg_match("#rowspan=([0-9]+)#i", $attributes, $a))
				  $attr.=" rowspan=".$a[1];
			   if (preg_match("#bgcolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))
				  $attr.=" bgcolor=".$a[1];
			   if (preg_match("#background=(\S+)#i", $attributes, $a) )
			   {
					 $url=$a[1]; $error=0;
								   $url=$a[1]; $error=0;
				 if ($this->ipsclass->vars['allow_dynamic_img'] != 1)
				  {
						  if (preg_match( "/[?&;]/", $url)) $error=1;
						  if (preg_match( "/javascript(\:|\s)/i", $url )) $error=1;
				  }
				  if ($this->ipsclass->vars['img_ext'])
				  {
				   $extension = preg_replace( "#^.*\.(\S+)$#", "\\1", $url );
				   $extension = strtolower($extension);
				   if ( (! $extension) OR ( preg_match( "#/#", $extension ) ) ) $error=1;
				   $this->ipsclass->vars['img_ext'] = strtolower($this->ipsclass->vars['img_ext']);
				   if ( ! preg_match( "/".preg_quote($extension, '/')."(,|$)/", $this->ipsclass->vars['img_ext'] )) $error=1;
				  }
				  if (!preg_match( "/^(http|https|ftp):\/\//i", $url )) $error=0;
				  if (!$error) $attr.=" background={$a[1]}";
			   }
		   }
		   return "<!--tdS--><td{$attr}>".$txt."</td><!--tdE-->";
   }
   /*Конец (Тег table)*/

-------------------------------------------------------------------------------------------------------------------

-----------------------------------
| Найти:
-----------------------------------

$txt = preg_replace( "#<a href=[\"']mailto:(.+?)['\"]>(.+?)</a>#"						 , "\[EMAIL=\\1\]\\2\[/EMAIL\]"   , $txt );
$txt = preg_replace( "#<a href=[\"'](http://|https://|ftp://|news://)?(\S+?)['\"].+?".">(.+?)</a>#" , "\[URL=\\1\\2\]\\3\[/URL\]"  , $txt );

-----------------------------------
| Добавить ниже:
-----------------------------------

/*Начало (Тег table)*/
$txt = preg_replace( "#<!--tablebegin--><table(.*?)>#"				, "\n\[table\\1\]\n"		 , $txt );
$txt = preg_replace( "#</table><!--tableend-->#"				, "\[/table\]\n"		 , $txt );
$txt = preg_replace( "#<!--trS--><tr(.*?)>#"				, "\[tr\\1\]\n"		 , $txt );
$txt = preg_replace( "#</tr><!--trE-->#"				, "\n\[/tr\]\n"		 , $txt );
$txt = preg_replace( "#<!--tdS--><td(.*?)>#"				, "\[td\\1\]"		 , $txt );
$txt = preg_replace( "#</td><!--tdE-->#"				, "\[/td\]"		 , $txt );
/*Конец (Тег table)*/

-------------------------------------------------------------------------------------------------------------------
Все :)

Ссылка на комментарий
Поделиться на других сайтах

  • 1 месяц спустя...

Для 2.2.х ...

 

Открыть файл sources/classes/class_bbcode.php

 

Найти

 

$txt = preg_replace_callback( "#(\[quote(.+?)?\].*\[/quote\])#is" , array( &$this, 'regex_parse_quotes' ), $txt );

 

Добавить выше

 

			while( preg_match( "#\n?\[table(.*?)\](.+?)\[/table\]\n?#is" , $txt ) )
						   {
							$txt = preg_replace( "#\n?\[table(.*?)\](.+?)\[/table\]\n?#ies", "\$this->regex_parse_tables('\\2','\\1')" , $txt );

				   }

 

найти

 

			$txt = preg_replace( "#<a href=[\"']mailto:(.+?)['\"]>(.+?)</a>#"								   , "\[email=\\1\]\\2\[/email\]"   , $txt );
		$txt = preg_replace( "#<a href=[\"'](http://|https://|ftp://|news://)?(\S+?)['\"].*?".">(.+?)</a>#" , "\[url=\\1\\2\]\\3\[/url\]"  , $txt );

 

добавить ниже

					  $txt = preg_replace( "#<!--tablebegin--><table(.*?)>#"				, "\n\[table\\1\]\n"		 , $txt );
					$txt = preg_replace( "#</table><!--tableend-->#"				, "\[/table\]\n"		 , $txt );

					$txt = preg_replace( "#<!--trS--><tr(.*?)>#"				, "\[tr\\1\]\n"		 , $txt );
					$txt = preg_replace( "#</tr><!--trE-->#"				, "\n\[/tr\]\n"		 , $txt );

					$txt = preg_replace( "#<!--tdS--><td(.*?)>#"				, "\[td\\1\]"		 , $txt );
					$txt = preg_replace( "#</td><!--tdE-->#"				, "\[/td\]"		 , $txt );

 

найти

		return $before . str_replace( '<br />', '', str_replace( "? ", "?", $url )  ) . $after;
}

 

добавить ниже

 

	   function regex_parse_tables($txt="", $attributes="")
   {
	   global $ibforums;
	   $attr="";
	   if ($attributes)
	   {
		  if (preg_match("#border=([1-7])#i", $attributes, $a))
			$attr.=" border=".$a[1];
		  if (preg_match("#bordercolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))
			$attr.=" bordercolor=".$a[1];
		  if (preg_match("#width=([0-9]+)%#i", $attributes, $a))
			$attr.=" width={$a[1]}%";
		  if (preg_match("#cellspacing=([1-7])#i", $attributes, $a))
			$attr.=" cellspacing={$a[1]}";
		  if (preg_match("#cellpadding=([1-7])#i", $attributes, $a))
			$attr.=" cellpadding={$a[1]}";
		  if (preg_match("#bgcolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))
			$attr.=" bgcolor=".$a[1];
		  if (preg_match("#background=(\S+)#i", $attributes, $a) )
		  {
				$url=$a[1]; $error=0;
				 if ($ibforums->vars['allow_dynamic_img'] != 1)
				  {
						  if (preg_match( "/[?&;]/", $url)) $error=1;
						  if (preg_match( "/javascript(\:|\s)/i", $url )) $error=1;
				  }
				  if ($ibforums->vars['img_ext'])
				  {
				   $extension = preg_replace( "#^.*\.(\S+)$#", "\\1", $url );
				   $extension = strtolower($extension);
				   if ( (! $extension) OR ( preg_match( "#/#", $extension ) ) ) $error=1;
				   $ibforums->vars['img_ext'] = strtolower($ibforums->vars['img_ext']);
				   if ( ! preg_match( "/".preg_quote($extension, '/')."(,|$)/", $ibforums->vars['img_ext'] )) $error=1;
		   }
		   if (!preg_match( "/^(http|https|ftp):\/\//i", $url )) $error=0;
		   $url = str_replace( " ", "%20", $url );
		   if (!$error) $attr.=" background={$a[1]}";
		  }
		  if (preg_match("#align=(center|left|right)#i", $attributes, $a))
			 $attr.=" align=".$a[1];
	   }
	   while( preg_match( "#\n?\[tr(.*?)\](.+?)\[/tr\]\n?#is" , $txt ) )
	   {
			 $txt = preg_replace( "#\n?\[tr(.*?)\](.+?)\[/tr\]\n?#ies", "\$this->regex_parse_tables_tr('\\2', '\\1')" , $txt );
	   }
	   return "<!--tablebegin--><table{$attr}>".$txt."</table><!--tableend-->";
   }
   function regex_parse_tables_tr($txt="", $attributes="")
   {
			global $ibforums;
			$attr="";
			if ($attributes)
			{
			   if (preg_match("#height=([0-9]+)#i", $attributes, $a))
				  $attr.=" height=".$a[1];
			   if (preg_match("#valign=(top|middle|bottom)#i", $attributes, $a))
				  $attr.=" valign=".$a[1];
			   if (preg_match("#align=(center|left|right)#i", $attributes, $a))
				  $attr.=" align=".$a[1];
			   if (preg_match("#bgcolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))
				  $attr.=" bgcolor=".$a[1];
			   if (preg_match("#background=(\S+)#i", $attributes, $a) )
			   {
				 $url=$a[1]; $error=0;
				 if ($ibforums->vars['allow_dynamic_img'] != 1)
				  {
						  if (preg_match( "/[?&;]/", $url)) $error=1;
						  if (preg_match( "/javascript(\:|\s)/i", $url )) $error=1;
				  }
				  if ($ibforums->vars['img_ext'])
				  {
				   $extension = preg_replace( "#^.*\.(\S+)$#", "\\1", $url );
				   $extension = strtolower($extension);
				   if ( (! $extension) OR ( preg_match( "#/#", $extension ) ) ) $error=1;
				   $ibforums->vars['img_ext'] = strtolower($ibforums->vars['img_ext']);
				   if ( ! preg_match( "/".preg_quote($extension, '/')."(,|$)/", $ibforums->vars['img_ext'] )) $error=1;
				  }
				  if (!preg_match( "/^(http|https|ftp):\/\//i", $url )) $error=0;
				  if (!$error) $attr.=" background={$a[1]}";
			   }
		   }
		   while( preg_match( "#\n?\[td(.*?)\](.+?)\[/td\]\n?#is" , $txt ) )
		   {
				  $txt = preg_replace( "#\n?\[td(.*?)\](.+?)\[/td\]\n?#ies", "\$this->regex_parse_tables_td('\\2', '\\1')" , $txt );
		   }
		   return "<!--trS--><tr{$attr}>".$txt."</tr><!--trE-->";
   }
   function regex_parse_tables_td($txt="", $attributes="")
   {
		   global $ibforums;
		   $attr="";
		   if ($attributes)
		   {
			   if (preg_match("#width=([0-9]+)%#i", $attributes, $a))
				   $attr.=" width={$a[1]}%";
			   if (preg_match("#height=([0-9]+)#i", $attributes, $a))
				  $attr.=" height=".$a[1];
			   if (preg_match("#valign=(top|middle|bottom)#i", $attributes, $a))
				  $attr.=" valign=".$a[1];
			   if (preg_match("#align=(center|left|right)#i", $attributes, $a))
				  $attr.=" align=".$a[1];
			   if (preg_match("#colspan=([0-9]+)#i", $attributes, $a))
				  $attr.=" colspan=".$a[1];
			   if (preg_match("#rowspan=([0-9]+)#i", $attributes, $a))
				  $attr.=" rowspan=".$a[1];
			   if (preg_match("#bgcolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))
				  $attr.=" bgcolor=".$a[1];
			   if (preg_match("#background=(\S+)#i", $attributes, $a) )
			   {
					 $url=$a[1]; $error=0;
								   $url=$a[1]; $error=0;
				 if ($ibforums->vars['allow_dynamic_img'] != 1)
				  {
						  if (preg_match( "/[?&;]/", $url)) $error=1;
						  if (preg_match( "/javascript(\:|\s)/i", $url )) $error=1;
				  }
				  if ($ibforums->vars['img_ext'])
				  {
				   $extension = preg_replace( "#^.*\.(\S+)$#", "\\1", $url );
				   $extension = strtolower($extension);
				   if ( (! $extension) OR ( preg_match( "#/#", $extension ) ) ) $error=1;
				   $ibforums->vars['img_ext'] = strtolower($ibforums->vars['img_ext']);
				   if ( ! preg_match( "/".preg_quote($extension, '/')."(,|$)/", $ibforums->vars['img_ext'] )) $error=1;
				  }
				  if (!preg_match( "/^(http|https|ftp):\/\//i", $url )) $error=0;
				  if (!$error) $attr.=" background={$a[1]}";
			   }
		   }
		   return "<!--tdS--><td{$attr}>".$txt."</td><!--tdE-->";
   }

Ссылка на комментарий
Поделиться на других сайтах

  • 3 недели спустя...
efimer, ты уверен, что твой код работает на 2.2? :D

 

 

После проверки и запостил сообщение =) работает на все 100% ) Чем очень доволен собственно )

 

коды предыдущих авторов работают только при LEGACY_MODE = 1

а оно по умоланию = 0

так что

да будет
$this->ipsclass->vars

!!!

 

 

Не поленился - проверил.

 

define( 'LEGACY_MODE', 0 );

 

Все работает как надо, версия 2.2.2

Ссылка на комментарий
Поделиться на других сайтах

  • 1 месяц спустя...

Как сделать чтобы bordercolor работал не только в ie?

В стилях прописать можно только 1 цвет.

Ссылка на комментарий
Поделиться на других сайтах

Под IE работает, а под Оперой bordercolor=red игнорируется.
Ссылка на комментарий
Поделиться на других сайтах

В firefox работает... Особенностей оперы не знаю ), но можно попробовать

 

Не

if (preg_match("#bordercolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))

$attr.=" bordercolor=".$a[1];

 

А

if (preg_match("#bordercolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))

$attr.=" style='border-color:".$a[1]"' ";

 

И чтобы обратно конвертировать нужно менять строку $txt = preg_replace( "#<!--tablebegin--><table(.*?)>#" , "\n\[table\\1\]\n" , $txt );

 

например на

 

$txt = preg_replace( "#<!--tablebegin--><table(.*?)\s?style='border-color:([\#0-9a-zA-Z]+)'(.*?)>#" , "\n\[table\\1 bordercolor=\\2\\3\]\n" , $txt );

$txt = preg_replace( "#<!--tablebegin--><table(.*?)>#" , "\n\[table\\1\]\n" , $txt );

 

Но перед этим проверить будет ли работать в опере если просто заменить в html коде бордерколор= на стайл=бордер-колор:

Ссылка на комментарий
Поделиться на других сайтах

Hostem,

Да, так работает. Спасибо.

 

точку только не написал здесь

 

if (preg_match("#bordercolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))

$attr.=" style='border-color:".$a[1]."' ";

 

 

Так-же тоже самое нужно дописать в фун-кцию regex_parse_tables_td, и на форуме каждой ячейке [td] указывать её bordercolor (извращение конечно, но как иначе?)

т.к. иначе опера показывает border цвета ячеек стандартным серым цветом.

 

По аналогии обратно конвертируем

$txt = preg_replace( "#<!--tdS--><td(.*?)\s?style='border-color:([\#0-9a-zA-Z]+)'(.*?)>#", "\[td\\1 bordercolor=\\2\\3\]", $txt );
$txt = preg_replace( "#<!--tdS--><td(.*?)>#", "\[td\\1\]", $txt );
$txt = preg_replace( "#</td><!--tdE-->#", "\[/td\]", $txt );

 

 

===up

Вот только теперь IE начал неправильно отображать ячейки в такой постановке =/

 

Вот пример html'я. Я имею ввиду непонятную окантовку в ячеейке, которая тестовая.

На тех цветах (тёмных) которые я у себя на форуме использую получается что левой и верхней границы ячейки вобще не видно.

<table bgcolor=#FFEBCD>
<tr>
<td>


<table border=3 style='border-color:red' width=85% cellspacing=5 cellpadding=5 align=center>

<tr>
<td>Ячейка1</td>
<td>Вторая ячейка</td>
</tr>

<tr bgcolor=#FFFFF0>

<td style='border-color:red'>
Здесь мы тестим</td>
<td>Траляля 12345</td>
</tr>


</tr>
</table>

</tr>
</table>

 

 

каждой ячейке можно задавать отдельные border-top border-bottom border-right и border-left но уж очень извращённо получается.

 

Вот в тему нашёл.. http://htmlcoder.visions.ru/HTML/?19

Ссылка на комментарий
Поделиться на других сайтах

PS

Кстати, то что по аналогии конвертируем. Проверь pls.

А то там кажется ошибся я где-то :D

Ссылка на комментарий
Поделиться на других сайтах

А если писать

 

if (preg_match("#bordercolor=([\#0-9a-zA-Z]+)#i", $attributes, $a))

$attr.=" style='border-color:".$a[1]."' bordercolor=red".$a[1];

 

?

 

Т.е. и style=border-color: и bordercolor...

 

Вообще я сталкивался только с тем, что если не написать # то цвет не работает, только не помню где именно

Ссылка на комментарий
Поделиться на других сайтах

В смысле сделать чтобы в тестовом примере получилось

<table bgcolor=#FFEBCD>
<tr>
<td>


<table border=3 bordercolor=red style='border-color:red' width=85% cellspacing=5 cellpadding=5 align=center>

<tr>
<td>Ячейка1</td>
<td>Вторая ячейка</td>
</tr>

<tr bgcolor=#FFFFF0>

<td style='border-color:red'>
Здесь мы тестим</td>
<td>Траляля 12345</td>
</tr>


</tr>
</table>

</tr>
</table>

 

Тогда в IE будет всё ok, но в опере только внешняя обводка таблицы нужного цвета, а ячейки - серые.

Ссылка на комментарий
Поделиться на других сайтах

Тогда в IE будет всё ok, но в опере только внешняя обводка таблицы нужного цвета, а ячейки - серые.

Пока нет стандарта css для объекта border, корректного кроссбраузерного кода не будет.

 

Можно выйти из положения: не изменять свойства объекта, а создать свой объект, внешне схожий с требуемым.

В случае с таблицами есть красивое решение через свойство cellspacing.

Вот код, который будет работать во всех браузерах:

<table border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="red">
<table border="0" cellspacing="3" cellpadding="0"><tr><td bgcolor="#FFEBCD">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="red">
<table width="100%" border="0" cellspacing="1" cellpadding="5"><tr><td bgcolor="White">
Ячейка1
</td></tr></table>
</td></tr></table>
</td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="red">
<table width="100%" border="0" cellspacing="1" cellpadding="5"><tr><td bgcolor="White">
Вторая ячейка
</td></tr></table>
</td></tr></table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="red">
<table width="100%" border="0" cellspacing="1" cellpadding="5"><tr><td bgcolor="White">
Здесь мы тестим
</td></tr></table>
</td></tr></table>
</td>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td bgcolor="red">
<table width="100%" border="0" cellspacing="1" cellpadding="5"><tr><td bgcolor="White">
Траляля 12345
</td></tr></table>
</td></tr></table>
</td>
</tr>
</table>
</td></tr></table>
</td></tr></table>

Громоздко? Зато работает и будет работать во всех браузерах.

Ссылка на комментарий
Поделиться на других сайтах

Это имитация бордера? %)

 

А "border-top border-bottom border-right и border-left" - везде работают? И в ИЕ и в Опере?

Ссылка на комментарий
Поделиться на других сайтах

Код делали еще во времена 4-х и-эксплорера и нетскейпа.

В css нет единого стандарта кодирования бордеров, поэтому не хочу кодировать бордеры стилями, лучше вручную сделать.

Ссылка на комментарий
Поделиться на других сайтах

  • 4 недели спустя...

Можно конечную инструкцию под 2.1.x ?

Тут столько замечаний, что я уже запутался что к чему написано :D

Ссылка на комментарий
Поделиться на других сайтах

А я ждал пока что-то окончательное будет, ждал, а потом забил и сделал сегодня себе на форуме ббкоды просто. ббкодов 6 штук получилось. Почти всё что надо выполняется в такой таблице. Ну развечто нельзя пару мелочей типа цвета границы который всеравно глючит в разных браузерах.

[table=][/table]
<table cellpadding='0' cellspacing='0' border={option}>{content}</table>

[large_table=][/large_table]
<table width='100%' cellpadding='0' cellspacing='0' border={option}>{content}</table>

[tr=][/tr]
<tr align={option}>{content}</tr>

[td][/td]
<td>{content}</td>

[td_large=][/td_large]
<td rowspan={option}>{content}</td>

[td_long=][/td_long]
<td colspan={option}>{content}</td>

Конечтно это не предел совершенства и может не так удобно как обычные таблици, но учитывая что это применяется довольно редко мне такой вариант очень нравится.

Ссылка на комментарий
Поделиться на других сайтах

Присоединиться к обсуждению

Вы можете ответить сейчас, а зарегистрироваться позже. Если у вас уже есть аккаунт, войдите, чтобы ответить от своего имени.

Гость
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Ответить в этой теме...

×   Вы вставили отформатированный текст.   Удалить форматирование

  Допустимо не более 75 смайлов.

×   Ваша ссылка была автоматически заменена на медиа-контент.   Отображать как ссылку

×   Ваши публикации восстановлены.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.

Зарузка...

×
×
  • Создать...

Важная информация

Находясь на нашем сайте, вы соглашаетесь на использование файлов cookie, а также с нашим положением о конфиденциальности Политика конфиденциальности и пользовательским соглашением Условия использования.