MyBB Community Forums

Full Version: How to make own tag like <sunjava>
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(2012-03-01, 04:40 PM)sunjava1 Wrote: [ -> ]Why it's impossible ? mybb codes is an example of it,
You can write

[sunjava]test[/sunjava]


result might be:
test

(2012-03-01, 05:00 PM)Alex Smith Wrote: [ -> ]bbcode isn't html though. It's converted into standard html when you submit the post.

For example, that blue text is actually sent as this:

<span xmlns="http://www.w3.org/1999/xhtml" style="color: blue;">test</span>
to your browser Smile
You guys are not getting it, I know it is sent to broswer as html / cnverted into html etc etc.

What I want is to make a simple thing with <sunjava> or [sunjava] in my own small webpage, a personal tag for my own use so that in posts, or making dynamic pages, I can only use my own tag, and they'll be replaced with the style.

How to do that ? using xml ? or php ?
php regex replacing Smile Or str_replace if you really must Smile You can't really just "make" your own HTML tags Smile
you might be able to using a custom DTD, but it'll probably end up confusing the major browsers that don't actually use the DTD and just treat it like a hint. I don't know which ones do that, though so good luck. I've never done anything like it so I have no idea where to point you to start.

In IE you can also add tags using JS, which is one way even IE6 can display simple HTML5 pages.
(2012-03-01, 06:18 PM)Tom K. Wrote: [ -> ]php regex replacing Smile Or str_replace if you really must Smile You can't really just "make" your own HTML tags Smile

Thanks Solved Smile


(2012-03-01, 06:13 PM)sunjava1 Wrote: [ -> ]You guys are not getting it, I know it is sent to broswer as html / cnverted into html etc etc.

What I want is to make a simple thing with <sunjava> or [sunjava] in my own small webpage, a personal tag for my own use so that in posts, or making dynamic pages, I can only use my own tag, and they'll be replaced with the style.

How to do that ? using xml ? or php ?

Tom's answer will suite your needs.

Just use <sunjava>Some Text</sunjava> while posting (storing the data to database). When you want to display the data (from database to browser), string replace <sunjava> with the opening tag you wish to display and </sunjava> with its respective closing tag, and then echo the data to browser.

Note:
Haven't seen above reply. Sad
Pages: 1 2