After working for hours on end on my html2bbcode function, I had a mind block when it came to <a href> tags. Some <a href> links have “titles” and some don’t and if you mix the two variations in one string, you’re bound to get in trouble when converting them to bbCode. i couldn’t get it work for hours and decided to go out for a hair cut since i’d worked for so long, that the hair on my head had grown so long that it was impairing my sight to the monitor.
I couldn’t help but take some pictures while I was out.![]()
It was the sight of the models at the lingerie show that inspired me the to answer of my preg_replace problem….Strip! Just strip away the “titles”…who cares about titles anyway? F#?$K titles! If you have a better idea, by all means let me know.
$pattern = "#<a href=\"(.*?)\"(.*?)>(.*?)< \/a>#is"; $replace = '[url=$1]$3[/url]'; $content = preg_replace ($pattern, $replace, $content); /*......*/
Oh, and this picture has got to be the funniest picture I took today. I didn’t think it was funny when taking it, but when I came home and saw it…haha…The two ladies are looking straight at me thinking I’m taking a picture of them, when actually they just happen to be in the general area. (Click to see the full picture.)
















…
Oh lord thank you for making titties =)
Blah.
What about the rel attribute?
-Shade
PS:
PS:
MangaBlog.org went up, finally.
I’m wondering what to do with a design… was thinking of a greenish color, but beyond that I’ve no ideas… any thoughts?
-Shade
…
Hmmm…how were you thinking of attribute in bbcode ?
…
Well, in theory:
W3C recommendations say that all links should have a title… This is easily argueable, as some don’t see the usefulness. But it is an option.
URLs should have at most, three attributes at the very most:
HREF - TITLE - REL
The URL is the easy part.
Rel is the easy part - if the REL is not defined it just becomes “”
But what to do with title?
The title should be, by default, relevant to the URL… Usually it would be done like this:
<a href="http://magnablog.0xtc.com/" title="http://magnablog.0xtc.com/">http://magnablog.0xtc.com/</a>
But then we have BBCode problems.
So, how about this:
<a href="http://magnablog.0xtc.com/" title="0xtc.com">http://magnablog.0xtc.com/</a>
Strip away the WWW and the http. Then the URL would be:
{URL=0xtc.com title=0xtc.com rel=}0xtc.com{/URL}
-Shade
…
test
<a href="http://magnablog.0xtc.com/" title="http://magnablog.0xtc.com/">http://magnablog.0xtc.com/</a>
…
hmm…It sure is worth a thought…Doing W3C happy bbCode…hmmm
…
test2 (any attribute will be parsed)
0xtc.com