Jump to Main Content
Content > XOOPS > XOOPS Codes Explained
XOOPS Codes Explained

XOOPS Codes are some simple HTML replacements that many modules can or still use. They were designed to be secure replacements of HTML code. Today's content management systems tend to use WYSIWYG editors, but not all modules have (unless you hack their code). This is somewhat legacy XOOPS because I recommend using WYSIWYG wherever possible.

XOOPS Codes

The XOOPS Codes are processed in the MYTS (My Text Sanitizer) class which is XOOPS_ROOT/class/module.textsanitizer.php and you'll find this functionality in the function xoopsCodeDecode. It's a mess of regex pattern replacement information so be prepared to know your regex if you take a look at it.

XOOPS Codes Translations
Xoops Code HTML Replacement Notes 
[siteurl=value]text[/siteurl] <a href="XOOPS_URL/value">text</a> expects URL value to be relative to site root with no starting slash
[url=value]text[/url]
<a href="value" target="_blank">text</a> value can be properly formed http, https, ftp or domain relative URL (http:// will be added to front if relative)
[color=value]text[/color] <span style="font-color: #value;">text</span>
don't add the expected # in front of value
[size=value]text[/size]
<span style="font-size: value;">text</span> value should be a proper CSS font-size
[font=value]text[/font]
<span style="font-family: value;">text</span> value should be a proper CSS font-family
[email]value[/email] <a href="mailto:value">value</span> value should be properly formed e-mail address

[b]text[/b]

<b>text</b> W3C prefers strong tag to b tag

[i]text[/i]

<i>text</i> W3C prefers em tag to i tag
[u]text[/u] <u>text</u> this is inserted text
[d]text[/d] <del>text</del> this is strikethrough text
[quote]text[/quote] <div class="xoopsQuote"><blockquote>text</blockquote></div>  
Images  
Images depends upon whether or not images are allowed or not, thus two displays for each below.
XOOPS Code
Images Allowed ($allowimages == 1)
Images Not Allowed ($allowimages != 1)
Notes
[img]value[/img] <img src="value" alt="" />

<a href="value" target="_blank" />value</a>
value must be properly formed URL, absolute or domain relative
[img align=alvalue]value[/img] <img src="value" align="alvalue" alt="" />

<a href="value" target="_blank" />value</a>
alvalue must be left, right, or center
[img id=idvalue]value[/img] <img src="XOOPS_URL/image.php?id=idvalue" alt="value" />

<a href="XOOPS_URL/image.php?id=idvalue" target="_blank" />value</a>
idvalue must be numerical
[img align=alvalue id=idvalue]value[/img] <img src="XOOPS_URL/image.php?id=idvalue" align="alvalue" alt="idvalue" />

<a href="XOOPS_URL/image.php?id=idvalue" target="_blank" />idvalue</a>
exactly this order -- id before align will not work; alt (and displayed text) IMHO should contain value, but the code uses idvalue
[Note: value can be enclosed in single or double quotes. This same function removes javascripts and about:'s.]

Final Notes

I'll note that based on the image codes that most sites probably don't use these XOOPS codes because the image translations aren't always necessarily congruent to what I would expect usage should be especially when both id and align are used, but that's a topic for another discussion.

My recommendation is to use WYSIWYG editors (my personal favorite is FCKeditor) and not the standard DHTML text area editor making XOOPS codes moot. I hope that's the overall forward direction as I don't think users should need to learn XOOPS, BB or Wiki codes (kind of like learning DOS). But I did on one site, and the users needed to know the codes, thus this page. I think philosophically, the DHTML editor ought to have a helper pop-up window link to give you a look into those codes.


Other Pages
Previous Page Debaser (Audio/Video Module) Themes Next Page
 
Comments are solely the opionion of the author and not to be construed as the opinion of anyone else.
Login
 

 

 

(c) 2006-2007 - Mark Boyden
Privacy - Legal Stuff - Contacts