[How to]BBcode Tutorial

How-to's, little tricks, tutorials, code examples (snippets) and read-me's.

Re: [How to]BBcode Tutorial

Postby andars » 30 Jan 2007, 21:04

Awesome, that did the trick. Thanks a lot.
andars
Cadet I
Cadet I
 
Posts: 11
Joined: 30 Jan 2007, 00:16
Gender: Male


Re: [How to]BBcode Tutorial

Postby Handyman » 31 Jan 2007, 08:08

Hello

Also, don't ask for support for making mods at area51, they aren't supported over there yet and you will most likely get your topic locked. Black Eye
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7457
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male

Re: [How to]BBcode Tutorial

Postby Ghost Sniper X » 19 Jan 2009, 19:32

I have followed this format correctly. However it is not submitting fields to the database. Here is the complete code:

Code: Select all
if (isset($_POST['submit'])) {
$title = utf8_normalize_nfc(request_var('title', '', true));
$preview = utf8_normalize_nfc(request_var('preview', '', true));
$post = utf8_normalize_nfc(request_var('post', '', true));

$userid = $user->data['user_id'];
$newsip = $user->ip;
$date = time();

$uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage
$allow_bbcode = $allow_urls = $allow_smilies = true;

generate_text_for_storage($title, $preview, $post, $userid, $newsip, $date, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);

$sql_ary = array(
    'news_title'        => $title,
   'news_preview'      => $preview,
    'news_post'         => $post,
   'news_authid'       => $userid,
    'news_ip'           => $newsip,
    'news_date'         => $date,
    'bbcode_uid'        => $uid,
    'bbcode_bitfield'   => $bitfield,
    'bbcode_options'    => $options,
);

$sql = 'INSERT INTO tabled_news ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
            }

echo'<form name="news" method="post" action="news.php?sid='.$user->session_id.'">
Title:<br>
<input type="post" name="title"><br>
News Preview:<br>
<textarea name="preview"></textarea><br>
News Post:<br>
<textarea name="post"></textarea><br>
<input type="Submit" Name="submit" value="Post News"><br>
</form>';


It submits everything except preview, post, bbcode_bitfield, bbcode_options. Then bbcode_uid is being submitted as "2" which is my id. I believe I have done everything correctly, however it is not working. Please help, thanks.
Ghost Sniper X
Crewman
Crewman
 
Posts: 1
Joined: 19 Jan 2009, 19:25
Gender: Male

Re: [How to]BBcode Tutorial

Postby Zappien » 10 Dec 2009, 21:09

It looks like this is a very old topic but i take my chance,


the bbcode works perfect on the site! Now what i don't see is, what if i want to make a preview function? the text won't be stored by that, so how do you do something like that? like you use bbcode then click on preview and then you see the output... ( this is for outside the forum btw, on the normal site )


Thanks in advance
Zappien    
Crewman
Crewman
 
Posts: 7
Joined: 10 Oct 2009, 04:42
Gender: Male
phpBB Knowledge: 6

Previous

Return to Tutorials and How-Tos

Who is online

Users browsing this forum: No registered users and 3 guests