Jump to content


Photo

can anyone add bbcode (or bbtag whichever you prefer to call it) to this code?


  • Please log in to reply
3 replies to this topic

#1 schme16

schme16
  • Members
  • PipPipPip
  • Advanced Member
  • 97 posts
  • LocationAustralia - Queensland - Toowoomba

Posted 02 October 2006 - 01:12 PM

hi all, this is my first or second post here, and i was wondering if anyone out there in teh interwebs was willing to add to a peice of code for me, its a posting system for me to add new update posts to my hompage....but i want to be able to use bb code in it as well as html...no luck so far...


heres the code...entirely except of bbcode implementation (thought it'd be easier for you guys to start fro scratch ^_^.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<link href="css/editpage.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style6 {
	font-size: 24px;
	font-weight: bold;
}
-->
</style>
</head>

<body>

<p>
  <?php
ob_start();
// allows you to use cookies
include("configs/config.php");
include("time.php");
$userlvl = $logged[userlevel];

if (($userlvl)==(2))
{

//gets the config page
if ($_POST[post]) {
// the above line checks to see if the html form has been submitted
$username = $logged[username];
$message = $_POST[message];


$realname = $logged[realname];
$email = $logged[email];

//the above lines set variables with the user submitted information
if($message==NULL) {
//checks to make sure no fields were left blank
echo "Type a damned message ya idiot!.";
}else{
//Everything seems good, lets insert.
$query = mysql_query("INSERT INTO posts (title, realname, username, message, email, date) VALUES('$title','$realname','$username','$message','$email','$date')");
// inserts the information into the database.
echo "You have successfully posted! Now redirecting you to you to view your post";
echo ("<meta http-equiv=Refresh content=2;URL=\"posts.php\" />");
}
}
else
{
    

echo ("<form method=\"POST\"><br />
<div align=center><span class=header>Hello $logged[realname]! 
    </span><br /><br />
	<span class=dingbat>Type the title of your post:</span>
	<input type=\"text\" size=60 name=\"title\" maxlength=\"45\" /><br /><br />
	 <span class=dingbat>Type the body of your post:</span><br />	
    <textarea name=\"message\" cols=\"80\" rows=\"15\" class=\"Viner-Pargraph\"></textarea><br />
     *Note that Full Html may be used and is most casses encouraged until the BBCode system has been implemented!
	 
   <br />
<input name=\"post\" type=submit class=title value=\"post\">
  </div><br />
  </form>
");
}
}
else
{

echo'Sorry but you are not authorized to enter this area!';
}
?> 
</p>
</body>
</html>

I always want my code to be exciting, who wants uniform, easy to read code?
If you really want to break up the dull, try using ASP style tags every now and then, or random indentation! -jesirose on August 26, 2007


#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 02 October 2006 - 01:46 PM

Therre are plenty of posts about bbcode systems in the Regex board. Take a look at  this post.

Also we are not here to write scripts for you. We'll provide code snippets but not full scripts. If you want someone to build a fully fledged bbcode system then ask in the freelance forum.

#3 schme16

schme16
  • Members
  • PipPipPip
  • Advanced Member
  • 97 posts
  • LocationAustralia - Queensland - Toowoomba

Posted 02 October 2006 - 03:59 PM

it would hardly be building the entire script, and i'd be just as happy with a detailed explanation as to where the preg-something function goes and how to actually make it work...most of the tutorials out their are comprehensive...but never show you where in the code it has to sit and what the variables should be set to.....
I always want my code to be exciting, who wants uniform, easy to read code?
If you really want to break up the dull, try using ASP style tags every now and then, or random indentation! -jesirose on August 26, 2007


#4 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 02 October 2006 - 04:03 PM

i'd be just as happy with a detailed explanation as to where the preg-something function goes and how to actually make it work...


then, you should be very pleased with the thread that wildteen pointed you to ;)

it's a very detailed explanation, and it also includes the code needed to make it work.

good luck
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users