Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Combining BBcode To Create One Html Tag


I'm working on some BBCode and I was wondering if it is possible to combine two bbcode tags to create one span tag after the preg_replace e.g. Code:

[font=Arial ][b ][color=red ]Text[/color ][ /b][/font ]

HTML Code:

<span style='font-family:Arial;font-weight:bold;color:red;'>Text</span>

instead of HTML Code:

<span style='font-family:Arial;'><span style='font-weight:bold;'><span style='color:red;'>Text</span></span></span>

Of course I'd need it for multiple instances of nested BBcode tags within the same message.




View Complete Forum Thread with Replies

Related Forum Messages:
Replacing Bbcode With Html Tags Using Php
i have a place for people to post with bbcode (written with javascript), the data is posted and sent to a mysql database, and retrieved from my website's page, where it is displayed.

when the data shows up on the page, the bbcode is still visible. is there a php script for this? if there is where would i put it? on the website's page?

View Replies !
BBCode To Be Converted To HTML Attributes
I'm creating a small web app in PHP/MySQL and I'm building the backend. At the moment when one of my novice users enter some news via the form it enters it as a text string into the database.

However I need that string styled and as my users are experienced with BBCode I thought they might as well be able to use that.

So what I need is for their BBCode to be converted to HTML attributes either when it's being added to the db or when it's being displayed.

I can find plenty of scripts, but as I'm a bit of a rookie - I need some installation instructions too!

Has anybody dealt with bbCode in your apps before?
Does anybody have any ideas?

View Replies !
Bbcode And Html Tags Problem
I'm trying to make a tutorial script... and I'm having some problems with bbcode+html tags
My addtutorial.php PHP Code:

View Replies !
Questions About Combining HTML
My only knowledge is in using HTML. I'm planning on doing SEO for a new site, put up Adsense and publish it.

Ideally, I'd like to use my existing HTML skills and add snippets of PHP codes that I've just learnt. I know there is a steep learning curve, so I plan to take it step-by-step. However I do have some questions about PHP and here they are:

1) Is PHP well supported with browsers like IE 6-7, Firefox 1-2, and Safari, and Opera?
2) Will there be any conflicts in using stylesheets to control HTML tags?
3) Is it better to use SSI or PHP's include command?

View Replies !
Create HTML Page
I would like to make a form that once you insert data into the form,it ll automatically create a html format of the data you entered in a html and save it in a folder! How do i go by doing this?

View Replies !
Create An Html Link
Is it possible to create an html link for in internal *.html file where $filename.html is posted from a form?

View Replies !
Create A New Html File
how to open and edit or add a file but ,I don't know how to create a new ".html" or ".txt" file? I have STFW and STFM but still maybe i'm blind.

View Replies !
Create Html Table
tryin to get a table to add a new td /td for every result from the Db. but can't for life of me figure it out...

the nubers are the results and there are 3 required infos from each entry,(abc)
so if there were 4 results it would have a 4a,4b,4c...

its prob really simple but i cant get it! how would i print it via PHP? Code:

View Replies !
Create HTML Emails
I've been trying to create HTML emails but when i receive the email created by this script the link comes out as text do anyone have any idea why this might be? and what apoach would be best to solve it. Code:

View Replies !
How To Create Html List From Such Array ?
I've got an example array like this:

$myArr = array(
array("jj", "0", "jjj"),
array("ee", "0", "eee"),
array("bb", "ee", "bbb"),
array("ll", "ee", "lll"),
array("ff", "0", "fff"),
)

Where each row is an array with columns: id of list element, id of parent
list element ("0" means main node) and content of the element. So, from my
array I'd like to create a list like this:

<ul>
<li>jjj</li>
<li>eee
<ul>
<li>bbb</li>
<li>eee</li>
</ul>
</li>
<li>fff</li>
<ul>

View Replies !
Create Html Table With Php Result?
I'm looking to display 5 records in one rows, from the database. What i mean is, basically, let's take the "emails" as an example. I have a table with 100s of email
addresses. Now i want to display these email addresses on a html table, but i want to display only 5 email adresses per table row, then the next 5 in the next table row and so
on.

View Replies !
PHP Create HTML Email Inserts '!'s
I'm trying to create an email and when it sends the email, it mostly
works except that there are '!' inserted at some spots. Checking the
html source of the email, looks like they are placed at the end of
long lines. I'm assuming there is some issue with the encoding, but
searching through groups, nothing I've tried has worked. Can someone
let me know if I should be doing something differently with my headers
for an html email? I'll change emails to null@null.com. Thanks!

$headers = "X-Mailer: PHP " . phpversion() . "
";
$headers .= "From: null@null.com
";
$headers .= "Reply-To: null@null.com
";
$headers .= "Content-Type: text/html;
";
$headers .= "charset="iso-8859-1"
";
$headers .= "Content-Transfer-Encoding: 7bit
";

View Replies !
Script To Create Html File
I'm looking for a php script that will look in my images folder and for each image in there, create an html file named <imagename>.html and store it in a folder called "pages". I currently use the code  inserted below that scans my image folder, creates an xml file that contains a list of the images and the my Flash image gallery reads the xml file to create the gallery.

but I would rather do it by the method I'm requesting above and get away from flash. Any ideas? Even if there's a way to modify the code below to do what I want, that would be great. Code:

View Replies !
Create Form Linked To Html
I need to access an SQL database from a webpage so users can update information directly to the database (in the form of a "form"). There are a few fields from different tables in SQL that I need on the form. I have no idea how to even begin. Someone mentioned that PHP is the way to go and I've started looking through tutorials, but thought I would post the question to see if this is even the right language to use.

View Replies !
Create A New .html File On My Server...
i have some data in a variable ($message) that is being emailed with
the php's mail() function (an html email actually)...i'd like to also
take that html data in the $message variable and have my script also
make a new .html (with any random name) file on my server with that
$message data, any easy way to do that?

View Replies !
Create HTML File From Mysql Result
I want to create HTML file from Mysql result one row to one HTML file ( below only display ), Code:

View Replies !
Create A Data Entry HTML Form For Given Table
I am working on a simple web site updating utility for a web site. Rather than hard code the data entry forms, I would like to automactically generate them based upon the table a user selects to update or insert into. What is the best way to approach this?

for "insert" should I use the MySQL DESCRIBE table command and build a form element for each field according to its data type? for "update" should I use the DESCRIBE command to build the form as above and SELECT statement to populate each element with data, or should I just use a SELECT statement to retrieve the data and use php to determine the field type and choose an appropriate form element?

View Replies !
Read A Directory Files, And Create Echo HTML?
i have a foo/ directory and a foobar/ directory, and a barfoo/ directory in root/

for each directory in root, i'll put x or y or z amount of images in each directory. then, have the php write 01.html with the correct links to a) main image, b) thumb images and prev/fwd links.

we could have separate php files to handle the drawing of the new sequenced .html files in each directory (probably best to pass variables), because they're slightly different, or one to rule them all (sounds like too much work).

then, the syntax would need to be sorted out (so index.html has a link to foo/foo.php?=foo01) would work correctly and draw up 01.html with the correct images, being that index.html would probably have to have hardcoded variable-passing links. eh?

it's sweet, 'cause updating would be fast. upload and delete image files. done. I mean, I know that you could go the database/XML route, but sigh ........

View Replies !
Create A Simple HTML Form That Has The Standard To:, CC:, BCC:, Comments: Etc
I need to create a simple HTML form that has the standard To:, CC:, BCC:, Comments: etc. - but I need for the form to have a drop down list of "Subjects". Depending on which subject the user selects, it should email a different email address for each one for the contact.

The email addresses should be hidden and only server side. Could someone point me to a sample form which has something like this? I've Googled it all over but can't find any examples.

View Replies !
Form Script - Create The Landing Page In Html With Tags
A form that people will enter their info, and when the submit it, they will land on a page that shows the info they submitted for them to double check that it is the correct info before they confirm the submission. I have an idea that I could create the landing page in html with tags like [firstname] and [address], and have the script replace those tags with the matching field data from the form. I just can't figure out HOW to do it.
Sorry if I'm rather incoherent. just spent a long night attempting to figure this out. I'm feeling very, VERY Dense, even with my very limited PHP knowledge.

View Replies !
Bbcode Help
This is my first time doing bbcode so I'm not really sure how to do this.  I copied this from a tutorial but it doesn't work.

$string = "I am so [b]cool[/b] ";
$bb-replace = array('[b]','[/b]','[i]',[/i]');
$bb-replacements = array ('<b>','</b>','</i>','</i>');
$string = str_replace($bb-replace,$bb-replacements,$string);

The error is a syntax error unexpected T_ARRAY.

View Replies !
BBcode
I making a forum and want to add BBcode to it. How can i do this? I have looked everywhere?

View Replies !
BbCode Into
Can anyone recommend a simple way of implementing bbcode into a php-based website/database design?  I'd like the user to be able to enter the data using bbcode's options (simple click and format options without having to know anything about code... like this site has) and have this display in pages when the results are pulled out of the database and displayed in HTML format.

View Replies !
Implementing BBCODE?
I have been working on a system to add news and articles to a site, I have the core adding and removing out of the way and have had some very good advice from eelixduppy, the code for what i currently have is at the end of this post.

What i would to acheive is something where if i typed:

HELLO and wanted to make it bold i could wrap HELLO in something like the BBCODE on this forum. for example square brackets with a B inside to start the Bold area and square brackets with a /B inside to close the bold area, I would like to know how i can underline things with this too and perhaps add things such as font colours etc. a basic intro into how to get it to work would be great, here is the code i currently have if it helps in anyway at all.

<?php
include 'dbconnect.php'
$title = $_POST['title'];
$news = $_POST['news'];
$pattern = "/(http://[w.]+)/";
$replace = "<a href='$1'>$1</a>";
$title = preg_replace($pattern, $replace, $title);
$news = preg_replace($pattern, $replace, $news);
$title = mysql_real_escape_string($title);
$news = mysql_real_escape_string(nl2br($news));
$date = date("D d M Y, g:i a");
$sqlquery = "INSERT INTO tnews (Title, Body, Date) VALUES ('$title','$news','$date')";
header("Location: display.php");
//print $sqlquery;
$results = mysql_query($sqlquery);
mysql_close($dbc);
?>

View Replies !
Help With My Bbcode Function
Someone here very kindly gave me a small example of how to implement a bbcode function, I have expanded this function so it now looks like this.

bbcode.php

<?
function bb2html($text)
{
$trans = array("" => '<b>', "" => '</b>',
"[u]" => '<u>', "[/u]" => '</u>',
"" => '<i>', "" => '</i>',
":-)" => '<img src="../images/smile.gif" title="smile :-)">',
";-)" => '<img src="../images/wink.gif" title="wink ;-)">',
"->" => '<img src="../images/arrow.gif" title="arrow">',
">-)" => '<img src="../images/badfrin.gif" title="bad grin">',
":-D" => '<img src="../images/biggrin.gif" title="big grin">',
":-S" => '<img src="../images/confused.gif" title="confused">',
"0-)" => '<img src="../images/cool.gif" title="cool">',
";-(" => '<img src="../images/cry.gif" title="cry">',
"/-¦" => '<img src="../images/doubt.gif" title="doubt">',
":-@" => '<img src="../images/evil.gif" title="evil">',
"<!>" => '<img src="../images/exclaim.gif" title="exlamation">',
"<i>" => '<img src="../images/idea.gif" title="idea">',
"<lol>" => '<img src="../images/arrow.gif" title="lol">',
">-<" => '<img src="../images/mad.gif" title="mad">',
":-¦" => '<img src="../images/neutral.gif" title="nuetral">',
"<?>" => '<img src="../images/question.gif" title="question">',
":-P" => '<img src="../images/raz.gif" title="raz">',
"$-¦" => '<img src="../images/redface.gif" title="red face">',
"8-¦" => '<img src="../images/rolleys.gif" title="rolly eyes">',
":-(" => '<img src="../images/sad.gif" title="sad">',
">-O" => '<img src="../images/shock.gif" title="shock">',
":-O" => '<img src="../images/suprised.gif" title="suprised">',
" " => '<table bgcolor='#cccccc'><tr><td style='border: solid 1px #000000'>', " " => '</td></tr></table>');

$translated = strtr($text, $trans);
return $translated;
}
?>


I do however have a small problem this works fine first time when I add the data to the database, I am using the following code to add the data to the database

newsadd.php

<?php
include '/home/www/juttuffi/auth.php'
include '/home/www/juttuffi/dbc.php'
include '/home/www/juttuffi/news/admin/bbcode.php'

$pattern = "/(http://[w.]+)/";
$replace = "<a href='$1'>$1</a>";

$title = $_POST['title'];
$news = $_POST['news'];

if (!empty($title) &&!empty($news))
{
$title = preg_replace($pattern, $replace, $title);
$news = preg_replace($pattern, $replace, $news);

$title = bb2html($title);
$news = bb2html($news);

$title = mysql_real_escape_string($title);
$news = mysql_real_escape_string(nl2br($news));
$date = date("D d M Y, g:i a");

$sqlquery = "INSERT INTO tnews (title, body, date) VALUES ('$title','$news','$date')";

header("Location: index.php");

//print $sqlquery;
$results = mysql_query($sqlquery);
}
else
{
include '/home/www/juttuffi/header.php'
echo '<san class="notice">'
echo '***ERROR: Please make sure you have entered a title and some news***'
echo '</span>'
echo '<br>'
include '/home/www/juttuffi/news/admin/newsaddform.php'
}

mysql_close($dbc);
?>


This works fine the smilies appear fine in the output, however when i use my edit script which is below i get some distorted output, here is my edit script.

newsedit.php

<?php
include '/home/www/juttuffi/auth.php'
include '/home/www/juttuffi/dbc.php'
include '/home/www/juttuffi/news/admin/bbcode.php'

$pattern = "/(http://[w.]+)/";
$replace = "<a href='$1'>$1</a>";

$title = $_POST['title'];
$news = $_POST['news'];
$id = (int)$_POST["id"];

if (!empty($title) &&!empty($news))
{
$title = preg_replace($pattern, $replace, $title);
$news = preg_replace($pattern, $replace, $news);

$title = bb2html($title);
$news = bb2html($news);

$title = mysql_real_escape_string($title);
$news = mysql_real_escape_string(nl2br($news));

$sqlquery = "UPDATE tnews SET title='$title', body='$news' WHERE id='$id'";

header("Location: index.php");

//print $sqlquery;
$results = mysql_query($sqlquery);
}
else
{
include '/home/www/juttuffi/header.php'
echo '<span class="notice">'
echo '***ERROR: Please make sure that yu have not tried to submit any empty fields***'
echo '</span>'
echo '<br>'
include '/home/www/juttuffi/news/admin/newseditform.php'
}

mysql_close($dbc);

?>


as you can see the edit code is almost identical to the add code, however say i added a simple news post which contained one smiley.

:-), this would appear as a smiley fine but then say i edited the post and didn't change anything but just clicked "edit" you would expect there to be no change in the output and for it to remain a smiley

:-)

instead i get something like this after editing

:-)">

can anyone help me locate the problem here and perhaps tell me how to solve it, I would be extremely grateful.

View Replies !
Strip Bbcode
I've been trying to piece together a function that can strip bbcode/vBcode from a block of text (ie: posts). I don't want to translate any of it - just remove all instances of [ ] and whatever tags are between them. This is probably a simple string parsing application, but I can't seem to figure out a way to pull it off.

View Replies !
Bbcode Interface
I'm implementing a bbcode parsing engine on a news script, but my only concern is how to create those buttons that interact with the textbox and automatically insert tags and such when you click on them.

View Replies !
Parsing (BBCode)
I'm trying to make a BBCode parser for a forum project I'm working on. I've got the whole bit that finds the code and says turn [b] -> <strong> and that, but my problem is, if you put [b]text, the rest of the page is in bold. What I want is it to automatically add the closing tag. How do I do this?

View Replies !
Youtube BBcode
i want to add a youtube bbcode to my online game to allow players to embed youtube into their profiles using [youtube]video id[/youtube]

so i need to convert this to work as the above bbcode

<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/YEfKdjOjqso"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/YEfKdjOjqso" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>

thats just a example embed. ive tried several different ways of doing this, any ideas?

View Replies !
Bbcode Code
static function code($string)
{
    return preg_replace("/[code](.*?)[/code]/", "<div id='code'>$1</div>", $string);
}

When i type:
[code]
<br />
<?php
echo 'Hello world';
?>
<br />
[/code]

It doesnt recognize the code-brackets, why not?

View Replies !
Gif BBcode Issue
When I upload a gif file to my hosting site, it loads it as a thumbnail. All of the other file types show up just fine. Code:

View Replies !
Bbcode For Quote
On my forums I am trying to add a quotes user feature so that it will parse this to the page when bbcode is used like this. PHP Code:

[quote=username] text here [/quote]

will output this. Code:

<div class="Quote_User" style="margin-bottom: 5px;">
<b><a href="?p=profile&userid=1">USERNAME</a> wrote:</b> <br>
<div style="padding-top: 5px;"></div><i>TEXT HERE</i></div>

View Replies !
BBCode Stripping
I want to disable BBCode feature in my forum. But I want to leave [quote ] [ /quote] tags for quotations purposes... I have messages stripped from BBCode before saving to database by this function: Code:

View Replies !
Strippping BBCode!
I need some help on replacing 'nested' BBCode, preferably using preg_replace. Say I have a text like:

[quot:5e946ce841="user1"]:-)[quot:5e946ce841="user2"]Hi, there!
[/quot:5e946ce841]
Hey, Howdy!!
[/quot:5e946ce841]
bla bla bla...

I want it converted to:

<quot>:-)<quot>Hi, there!
</quot>
Hey, Howdy!!
</quot>
bla bla bla...

converting '[quot]' into '<quot>' & '[/quot]' into '</quot>'

View Replies !
FCKeditor Vs BBcode
I need some forms that would let the user format the text just a little. The format that I'm letting the user to use is bold, italic, font size, links and some alignments.
I'm trying FCKeditor, but it's too robust for what I want (alghough it can be well customized). I'm wondering if there's any other nice utility even if it's more basic, but that can suit my needs? Also, what's more secure to use? a FCKeditor that handles html tags directly or BBcode?

View Replies !
Irregular Bbcode
I Have regexp replacements in order to have working bbcode on the site. But I also want to include new tag which will remove any codes inside of itself (ie write them as text).

It's easy in theory - just to grab everything inside NO tag and replace all "[" and "]" to their html codes (ie [ and ]).

It doesn't have to be a regexp, i can do replacement b4 everything else, cuz regexp may actually slow down performance in this case.

View Replies !
Emoticons And Bbcode
I'd like enable visitors to my website to use bbcode and emoticons whilst entering text into a form. Are there any standard lumps of php/javascript I can use for this purpose?. In particular the encoder/decoder for the emoticons & bbcode and any examples of form layouts for textual input with all the appropriate '[url]' and emoticon buttons.

View Replies !
BBcode Parser
im making a website, its not a forum or anything like that but it does require the user of BBcode. i decided to use this because allowing the users to use html (like how myspace did) creates too many security risks and i like my design how it is so i am going to keep it. i want to know how i can implement BBcode on my page. i need all the basic functions. does anyone have any areas of expertise here. ive looked at multiple tutorials but i get lost in them all . does anyone have a link to a good on.

View Replies !
Displaying Bbcode
Currently I've been working on a news script for my website and I've been pulling posts from a set forum but since they are displaying in plaintext I was wondering how I would go about displaying the bbcode tags correctly. For example, one of my posts the text is

[b:0236504185]Links:[/b:0236504185]

View Replies !
Regex BBCode Code
I've got my forum system setup so you can use BBCode [url ] etc....... but if the user doesn't put [url ] a round a hyperlink i want when the message is posted to add the [url ] around it if not already there.

View Replies !
Remove Bbcode From Text
I have the following code that pulls text and subject from a phpBB database and displays it on the main page of a site. I want to pull the bbcode tags out cause it looks ugly. My question is how would I integrate that in to the code that I have below? Code:

View Replies !
Bbcode Parser Classes ?
Theres a ton out there, just wanted to see if someone had any favorites.

View Replies !
Php Script That Does All The Bbcode Stuff?
if there is anywhere i can download a php script that does all the bbcode stuff for me? Because i need something like that and, though i can write the code myself if i need to, downloading the script would save ALOT of time. So no worries if there isn't anywhere i can get it. But i was just curious. I already did some searching on google myself, and i didn't seem to be able to find anything.

View Replies !
Major Bbcode System
Right now im just learning how to add stuff soon ill be adding smileys. Also how do I put html code in to php code because it kept giving a unexpect > for the html code.

View Replies !
Making My Own BBCode, Sort Of..
Right heres the thing I have multiple files, tutorials.php lists the tutorials and view_tutorial.php displays the tutorial by getting the id. Anyways I need to display code in parts of the tutorial, with only part of it needing highlighting I can't use highlight_string();

How would I go about making a tag that wraps around my code, sits the same in the database then is displayed in a box with syntax highlighting? Also it needs to keep <html> tags in-tact, nother words I don't want them to vanish once its shown to the user.

View Replies !
BBCode [quote] Iteration
I have basic code for [quote=name]: '`[quote=(.+?)](.+?)[/quote]`i'
However, when there is a quote within a quote, only the first [quote] is converted. What can I do to solve this without having to call preg_replace again?

View Replies !
Preg_replace() For BBcode With HARDCODED Url: How?
For "preg_replace()", what is the syntax to search for a specific 'hardcoded' URL with a query string attached contained within BBcode tags?

The url is contained in a variable AND each can be found 1 or more times within the body of the text. Code:

View Replies !
BBcode, Forms And Database Security
I have a form where the user can enter some BBcode to style text but I am really concerned about database security.

When I submit a form, I use stripslashes to get rid of the crap before it enters the database but will this affect the BBcode as it has a slash i.e. [/tag]

What is the best way so i can insert the BBcode or the converted HTML into my database without compromising my database?

View Replies !
Removing The Bbcode_id From Bbcode Tags
phpbb, at least, puts a unique ID number into each bbcode tag a user posts, for example, if I were to post bold text and look at the raw code in the database, it would look like this:

[b:9f0e836e4c]bold text[/b:9f0e836e4c]

Now, it's simple enough to remove those numbers using this regex:

[b:[^]]+]

What's really got me stumped, though, is how to do this when the bbcode has attributes, such as size and a quote: Code:

View Replies !
BBCode Parsers And Exporting Text From A DB
I'm currently working on a simple (at least I had hoped) script to pull posts from a single "news" forum from phpbb and importing it on the front page of my site. It works great except for the BBCode issues.

It doesn't keep line breaks (biggest concern) as well as text colors, urls, etc (which was expected).  Talking with a friend, he tells me that I'm going to have to insert some BBCode parser to make things work right.  I have 3 questions regarding this:

1) is that my only answer?

2) should I try to use the phpbb BBCode parser that the forum uses?

3) should I install a custom BBCode parser instead?

I did not want to use a portal because they were just over bloated for what I needed and that was simply the posts from the forum itself w/o all the extras like who's online, last post made on the forums, etc.

Would it just be easier to try to strip down something like EZportal to just the info I need instead of trying to use this custom script?

View Replies !
A BBCode Based WYSIWYG Editor
I think it's possible but never figured out how to accomplish it. Or there are some editors like that already? I've never seen any tho.

View Replies !
Remove Bbcode And Double Quotes
I want to preview some posts of my forum on my main page, but the bbcode is being very annoying. I simply want to remove all bbcode from the $text variable.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved