Old php tags should be deprecated

We know you have an opinion on how things should be run around here. These are suggestions for the forums, and the website.This forum is not a place to ask for suggestions to your own coding (or otherwise) problems.

Moderator: General Moderators

Post Reply
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Old php tags should be deprecated

Post by josh »

If I type an old style

Code: Select all

tag I get a bunch of html entities. I realize this is semi-intended at one point because of upgrading, but at this point can the old tags & their corresponding behavior be dismantled? It is confusing for users  :D

[php]
$this->test();

Code: Select all

$this->test();
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Old php tags should be deprecated

Post by McInfo »

I'm bumping this topic to raise awareness that [syntax=php] tags should be used instead of [php] tags because this issue still exists.

Sample [php][/php]

Code: Select all

<?php if (true) {
    echo '<a href="http://nowhere/nothing.php">Link</a>';
} ?>
Sample [syntax=php][/syntax]

Code: Select all

<?php if (true) {
    echo '<a href="http://nowhere/nothing.php">Link</a>';
} ?>
User avatar
Benjamin
Site Administrator
Posts: 6896
Joined: Sun May 19, 2002 10:24 pm

Re: Old php tags should be deprecated

Post by Benjamin »

I don't know where in the code this is implemented. It may be a part of the same library we are using to add all the other tags. I'll look into it when I get a minute. Have I mentioned the phpBB codebase is psychotic?
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: Old php tags should be deprecated

Post by mikosiko »

maybe I'm wrong... but is not just matter of:
a) delete the row associated to the

Code: Select all

 tag in the table bbcodes or
b) update that row with the same definitions that the tag [syntax] has, allowing in this way to don't break old post ?
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Old php tags should be deprecated

Post by josh »

When I quote posts the code looks good, so in theory they should replace "

Code: Select all

" with "[syntax=php]" with a rewrite rule.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: Old php tags should be deprecated

Post by superdezign »

While that could work, it would also replace

Code: Select all

 with [syntax=php] right here, making me look as though I'm comparing [syntax=php] with [syntax=php]. While not a huge deal right now, who knows if it could be in the future. What if I was writing code that used an array with php as a key?

[syntax=php]$languages = array(
  'asp' => 'okay',
  'php' => 'awesome',
);

echo "PHP is $languages[php]";[/syntax]
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Old php tags should be deprecated

Post by josh »

That would be true of find & replace, however with regex that would not even be a concern.

Code: Select all

\[php\](.*?)\[/php\]
This will only match tags that have both been opened and closed. So if I write

Code: Select all

[php] [php]foo[/php]
it'll match the latter part. The only exception would be what I just wrote, putting a fully matched tag in code tags (not a big deal in my opinion).

IMO if you weigh the two choices, its clear we should do it. What's more embarrassing making it look like the wrong tag, or making it look like our community writes non compiling PHP code, heh..
User avatar
Benjamin
Site Administrator
Posts: 6896
Joined: Sun May 19, 2002 10:24 pm

Re: Old php tags should be deprecated

Post by Benjamin »

I took a brief look at the code and it appears that it uses the language such php, css, html, ini etc to look for a corresponding parser which is located as a file on disk based on the language name. I'm not able to spend much time on that right now so if anyone else wants to have a look feel free. I believe the geshi code for phpBB is easy to find.
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: Old php tags should be deprecated

Post by mikosiko »

@benjamin:

Maybe you could attach the message_parser.php file in case somebody could take a look at it, also will help to know which phpbb mod was installed to implement Geshi... was bbGeshi_0.7.5 ?
Post Reply