Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHPBB3 - Editing Default BBCode Tags

Status
Not open for further replies.

Ploper001

Technical User
Oct 5, 2006
286
GB
Hi all,

I've never programmed in PHP but I do have a lot of experience in VB.NET so I've been able to make a great many changes to my phpbb3 forum using common sense and my general programming knowledge.

I am stuck on two things however. I wish to change the way two of the BBCode tags work, but I cannot see how. Firstly is the QUOTE tags. At the moment you need to use the following tags for it to work:

Code:
[Quote="User name"]Stuff[/quote]

but I want it to work as follows:

Code:
[Quote=User name]Stuff[/quote]

I've seen at least two forums that use this, but I can't believe that PHP would limit this so I think it must be possible. The only relevant lines I can find in the files are in the bbcode.php file:

Code:
		foreach ($bbcode_ids as $bbcode_id)
		{
			switch ($bbcode_id)
			{
				case 0:
					$this->bbcode_cache[$bbcode_id] = array(
						'str' => array(
							'[/quote:$uid]'	=> $this->bbcode_tpl('quote_close', $bbcode_id)
						),
						'preg' => array(
							'#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#ise'	=> "\$this->bbcode_second_pass_quote('\$1', '\$2')"
						)
					);
				break;
.....

and

Code:
	function bbcode_second_pass_quote($username, $quote)
	{
		// when using the /e modifier, preg_replace slashes double-quotes but does not
		// seem to slash anything else
		$quote = str_replace('\"', '"', $quote);
		$username = str_replace('\"', '"', $username);

		// remove newline at the beginning
		if ($quote == "\n")
		{
			$quote = '';
		}

		$quote = (($username) ? str_replace('$1', $username, $this->bbcode_tpl('quote_username_open')) : $this->bbcode_tpl('quote_open')) . $quote;

		return $quote;
	}


Any idea how to make the quotation marks unnecessary (it would be nice if you could use both, but that is a luxury I can live without)? I've tried simply removing the """s but it did not change anything - quotation marks were still necessary when quoting someone.


The second tag is the bullet point one. Presently you have to do the following:

Code:
[list][*] Stuff 1
[*] Stuff 2
[*] Stuff 3[/list]

I would like the behaviour to be as follows:


Code:
[*] Stuff 1
[*] Stuff 2
[*] Stuff 3

Again, I have seen other forums where this is possible so unless it's a limitation of php/phpbb3 then it can be done. I have no idea where to start for this but here is the/some relevant code:

Code:
				case 9:
					$this->bbcode_cache[$bbcode_id] = array(
						'preg' => array(
							'#(\[\/?(list|\*):[mou]?:?$uid\])[\n]{1}#'	=> "\$1",
							'#(\[list=([^\[]+):$uid\])[\n]{1}#'			=> "\$1",
							'#\[list=([^\[]+):$uid\]#e'					=> "\$this->bbcode_list('\$1')",
						),
						'str' => array(
							'[list:$uid]'		=> $this->bbcode_tpl('ulist_open_default', $bbcode_id),
							'[/list:u:$uid]'	=> $this->bbcode_tpl('ulist_close', $bbcode_id),
							'[/list:o:$uid]'	=> $this->bbcode_tpl('olist_close', $bbcode_id),
							'[*:$uid]'			=> $this->bbcode_tpl('listitem', $bbcode_id),
							'[/*:$uid]'			=> $this->bbcode_tpl('listitem_close', $bbcode_id),
							'[/*:m:$uid]'		=> $this->bbcode_tpl('listitem_close', $bbcode_id)
						),
					);
				break;


Does anyone have any ideas that might help me?

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top