#
?Um, maybe to be compatible with the way Twitter handles hashtags? Anyway...seems to me this can be done with a BBCode. Something like this:AmigoJack wrote:What'd be the purpose of that if you already have a keyword search?
Code: Select all
[ht]{IDENTIFIER}[/ht]
Code: Select all
<a href="./search.php?keywords=%2B{IDENTIFIER}&sr=posts&ch=300"><b>#{IDENTIFIER}</b></a>
Code: Select all
#{keyword}
If I require a tag for boldface, I preferRMcGirr83 wrote:<b> should only be used when there are no other more suitable elements. In this case it should be <strong>
<b>
to <strong>
because <b>
will always select the 700 font weight. <strong>
selects the next heavier weight available, which may or may not be the 700 weight.I agree. Try the BBCode and let me know how it works for you. Hmm. The BBcode replacement code above isn't XHTML Strict, so if that matters to you, use this instead:TheDani wrote:Half of the purpose is that the usage is:Code: Select all
#{keyword}
Code: Select all
<a href="./search.php?keywords=%2B{IDENTIFIER}&sr=posts&ch=300"><b>#{IDENTIFIER}</b></a>
Code: Select all
#{IDENTIFIER}
Code: Select all
<a href="./search.php?keywords=%2B{IDENTIFIER}&sr=posts&ch=300"><b>#{IDENTIFIER}</b></a>
Your BBCode is constructed in an invalid form.
I am not talking about font weight (visual appearance), I am speaking of semantics. If using a hashtag I would think that the OP would want that tag to "stick out" more for bots (not to mention blind people). A bot may interpret the strong tag to indicate that element is more important than the others.DionDesigns wrote:If I require a tag for boldface, I preferRMcGirr83 wrote:<b> should only be used when there are no other more suitable elements. In this case it should be <strong><b>
to<strong>
because<b>
will always select the 700 font weight.<strong>
selects the next heavier weight available, which may or may not be the 700 weight.
Yes, by using [ht]{IDENTIFIER}[/ht]. But that kinda defeats the purpose.AmigoJack wrote:Of course: can you name one BBCode without a square bracket? FAQ: What is BBCode. That's why DionDesigns proposed it the way he did.
Code: Select all
$message = smiley_text($message);
Code: Select all
// hashtag code, UNTESTED
$message = preg_replace('/(\s)?#(.\w+?)\b/', '\1<a href="' . $phpbb_root_path . 'search.' . $phpEx . '?keywords=\2&terms=all&author=&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Search">#\2</a>', $message);
Code: Select all
[b]Hello[/b]
Code: Select all
[b]Hello[/b]
There are several issues with that one:t_backoff wrote:dug this up
Code: Select all
[url=http://en.wikipedia.org/wiki/PhpBB#MODs]no hashtags at all[/url]
keyword=
is enough. Code: Select all
function smiley_text($text, $force_option = false)
{
Code: Select all
/*** 2013-06-20 BEGIN AmigoJack, t_backoff
http://www.phpbb.com/community/viewtopic.php?t=2186935 ***/
function hashtag_callback( $aMatch ) {
global $phpbb_root_path, $phpEx;
if( preg_match( '#(color|background|text-shadow)[:=]|style="#i', $aMatch[1] ) ) return $aMatch[0];
return $aMatch[1]. '<a href="'. append_sid( "{$phpbb_root_path}search.$phpEx", 'keywords='. $aMatch[2] ). '">#'. $aMatch[2]. '</a>';
}
function smiley_text($text, $force_option = false)
{
$text= preg_replace_callback( '/(^|style="[^"#]+|[^\\s]*[\\s]+|>)#([\\p{Lu}\\p{Ll}\\p{N}\\w\\d]+)\\b/um', 'hashtag_callback', $text );
/*** 2013-06-20 END ***/
Code: Select all
#StartOfLine
in the middle #1337 and
the #under_score
with a #dot.appended and
the [url=http://en.wikipedia.org/wiki/PhpBB#MODs]link_anchor[/url]
[b]what #else?[/b]
and #ソニック Katakanas
\\p{Lu}\\p{Ll}\\p{N}\\w\\d]+)\\b/u
with \\w\\d]+)\\b/
. Tested.preg_replace
using modificator e
is a security threat.