PDA

View Full Version : Html in content?


Sora
04-18-2009, 04:33 PM
Hi, hopefully I can explain this well enough.

I'd like to use html in the content updates. To cut a long story short, I'd like the image of a character on every page (eg. Character X on the welcome page, text beside him, Character Y on the extra page, text beside him, etc.). However, whilst the layout works fine on a testing html document, I can't actually get the script to accept the img src tag on the different pages.
Is there a way to do this? So far, I've only been able to do it on the adopt page.

If I haven't explained it well enough, let me know. Thanks for any help.

Ashje
04-18-2009, 04:47 PM
img src is what I have alot of trouble with as well. Try this:<img src='image url here' alt='alternative text here' border='border width here'>
That seems to work for me.

Sora
04-18-2009, 05:25 PM
Nope, didn't work :( In fact, now that I double check, I can't get the article section to accept any html tags at all.

Tequila
04-18-2009, 06:15 PM
You have to use the BBCode tags, it doesn't accept HTML tags.
your.image.address

Sora
04-18-2009, 06:41 PM
Thank you for that. Is there any way to align an image to the left at all? Sorry, I don't use BBCodes that much.

BMR777
04-18-2009, 06:52 PM
Thank you for that. Is there any way to align an image to the left at all? Sorry, I don't use BBCodes that much.


Try wrapping it in a tag.

Here's a BBCode list, with HTML equivelents:

$text = preg_replace('|\[b\](.+?)\[\/b\]|i', '<strong>$1</strong>', $text);
$text = preg_replace('|\[i\](.+?)\[\/i\]|i', '<em>$1</em>', $text);
$text = preg_replace('|\[u\](.+?)\[\/u\]|i', '<u>$1</u>', $text);
$text = preg_replace('|\[img\](.+?)\[\/img\]|i', '<img src="$1" border="0">', $text);
$text = preg_replace('|\[url=(.+?)\](.+?)\[\/url\]|i', '<a href="$1" target="_blank">$2</a>', $text);
$text = preg_replace('|\[color=(.+?[^;])\](.+?)\[\/color\]|i', '<span style="color:$1;">$2</span>', $text);
$text = preg_replace('|\[size=(.+?[^;])\](.+?)\[\/size\]|i', '<span style="font-size:$1;">$2</span>', $text);
$text = preg_replace('|\[left\](.+?)\[\/left\]|i', '<span style="text-align: left;">$1</span>', $text);
$text = preg_replace('|\[right\](.+?)\[\/right\]|i', '<span style="text-align: right;">$1</span>', $text);
$text = preg_replace('|\[center\](.+?)\[\/center\]|i', '<center>$1</center>', $text);

Sora
04-21-2009, 02:34 PM
Thanks for that, fixed the problem!

Ashje
04-21-2009, 05:57 PM
Oh, this is for article content. If you want HTML, just get rid of the BBCode Parse. That's what I did.