Forums / National / Russian / Cotonti 0.0.3 beta 2

motor2hg
#8861 2009-02-25 23:07
Можно так сделать если через функцию

function sed_news_strip_newpage(&$html)
{
	
	$newpage = mb_strpos($html, "newpage]");
	$titletwo = mb_strpos($html, "[/title]");

	if ($newpage !== false)
	{
		
		$html_substr = mb_substr ($html, $newpage-1, $titletwo+14);
         //$titletwo+14 because delete </br> after [newpage][title]bla bla[/title] if no need set - $titletwo+8
		$html = preg_replace('#\[title\](.*?)\[/title\][\s\r\n]*(<br />)?#i', '', $html_substr);
		//А можно так
		//$html = str_replace($html_substr, '', $html);
	}
	
	$titleone = mb_strpos($html, "title]");
	
    if ($titleone!=false)
	{
		$html_substr = mb_substr ($html, $titleone-1, $titletwo+14);
        //$titletwo+14 because delete </br> after [title]bla bla[/title] if no need set - $titletwo+8
		$html = preg_replace('#\[title\](.*?)\[/title\][\s\r\n]*(<br />)?#i', '', $html_substr);
		//А можно так
		//$html = str_replace($html_substr, '', $html);
	}

Ratibor:
Не нужно это лечить, а нужно обработку сделать на уровне парсера

Это правильное предложение.
This post was edited by motor2hg (2009-02-25 23:14, 15 years ago)