MyBB Community Forums

Full Version: [F] portal.php and paragraph tags
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
portal.php
Paragraph <p> and </p> are being put in reverse order, or there is no start tag.

check http://community.mybboard.net/portal.php source code
in this case there is no "<p>"

look for
This release also corrects/adds the following:<br />
</p>
<ul><li>Inline error messages for users changing their username, password or email address through the User CP<br />
</li><li>Updated MySQL 5.1 strict compatibility<br />
</li><li>PHP 5.2.0 shutdown bug<br />

</li><li>Fixes for a whole range of other 1.2.1 and earlier identified bugs<br />
</li></ul><br />
</p>
I hope you 'll understand
I see it. It's a problem with the parsing of the "list" tag. To fix it go into inc/class_parser.php

FIND
function mycode_parse_list($message, $type="")
	{
		$message = str_replace('\"', '"', $message);
		$message = preg_replace("#\[\*\]\s?#", "</li><li>", $message);
		$message .= "</li>";

		if($type)
		{
			$list = "</p>\n<ol type=\"$type\">$message</ol>\n<p>";
		}
		else
		{
			$list = "</p>\n<ul>$message</ul>\n</p>";
		}
		$list = preg_replace("#<(ol type=\"$type\"|ul)>\s*</li>#", "<$1>", $list);
		return $list;
	}
and REPLACE WITH
function mycode_parse_list($message, $type="")
	{
		$message = str_replace('\"', '"', $message);
		$message = preg_replace("#\[\*\]\s?#", "</li><li>", $message);
		$message .= "</li>";

		if($type)
		{
			$list = "<p>\n<ol type=\"$type\">$message</ol>\n</p>";
		}
		else
		{
			$list = "<p>\n<ul>$message</ul>\n</p>";
		}
		$list = preg_replace("#<(ol type=\"$type\"|ul)>\s*</li>#", "<$1>", $list);
		return $list;
	}

I tested it on my forum and it works fine...
hmm, yes you are right

but it seems there are more mistakes?
* Parses quote MyCode.
	*
	* @param string The message to be parsed
	* @return string The parsed message.
	*/
	function mycode_parse_quotes($message)
	{
		global $lang;

		// Assign pattern and replace values.
		$pattern = array("#\[quote=(?:&quot;|\"|')?(.*?)[\"']?(?:&quot;|\"|')?\](.*?)\[\/quote\](\r\n?|\n?)#si",
						 "#\[quote\](.*?)\[\/quote\](\r\n?|\n?)#si");
						 

		$replace = array("</p>\n<div class=\"quote_header\">".htmlentities('\\1')." $lang->wrote\n</div><div class=\"quote_body\">$2</div>\n<p>\n",
						 "</p>\n<div class=\"quote_header\">$lang->quote\n</div><div class=\"quote_body\">$1</div>\n<p>\n");

function mycode_parse_code($code)
	{
		global $lang;
		$code = trim($code);
		$code = preg_replace('#\$([0-9])#', '\\\$\\1', $code);
		$code = str_replace('\\', '\', $code);
		return "</p>\n<div class=\"code_header\">".$lang->code."\n</div><div class=\"code_body\"><div dir=\"ltr\"><code>".$code."</code></div></div>\n<p>\n";
	}

		// Send back the code all nice and pretty
		return "</p>\n<div class=\"code_header\">$lang->php_code\n</div><div class=\"code_body\">".$code."</div>\n<p>\n";
	}

ehhh, one more thing Smile
see this (error 8 & 10)
http://validator.w3.org/check?uri=http%3...ype=Inline
We need to close the paragraph because in showthread it begins with <p>, a div within a paragraph == bad. This might be a theme problem though.

Edit, this was a template problem. Forgotten paragraphs around the text.
This bug has been fixed in the latest code.

Please note the latest code is not live on the site or for download. An update will be released which contains this fix.
can you psot the fixed file please?
No as it's a template change. 0.o
Do you really need to fix _every_ bug?.. It's only a html fix.
Oh well.
Here's a fix:

Inside your portal_announcement template
change:
{$message}{$post['attachments']}
to:
<p>{$message}</p>{$post['attachments']}