niiki-lou Posted May 28, 2009 Share Posted May 28, 2009 Hello all, im writing a chatbox script ive managed to get everything working fine up untill now when ive tried to add some BBcode tags stuff in there, my problematic code is below, When i add this in above my text area that requires the bbcodes it just gives me a Parse error: syntax error, unexpected '[' in /home/nikki-lou/public_html/shoutbox.php on line 183 <a title="Bold : [b ][/b ]" onmousedown="addTags('[b ]','[/b ]')" style="background-color:#F7F7F7; font-size:10pt; border: outset white 1px;"> <b>B</b> </a> <"smily" title="[ ]" onmousedown="addText('[ ]')"> Can anyone shed some light on this for me please ? im still learning with this and its been alot of fun up untill now Quote Link to comment Share on other sites More sharing options...
Jibberish Posted May 28, 2009 Share Posted May 28, 2009 If that's withinthe <?php ?> tags then it needs to be echoed out, and the quotation marks need sorting out with it as well, as they are opening an closing before the end of the line. Quote Link to comment Share on other sites More sharing options...
niiki-lou Posted May 28, 2009 Author Share Posted May 28, 2009 Hey, sorry for my denseness but everything you just said went over my head lol, im learning php as im going along so basicly i need to fix my tags ? Quote Link to comment Share on other sites More sharing options...
Jibberish Posted May 28, 2009 Share Posted May 28, 2009 No problem, every one starts somewhere. On php pages you will have some tags that look like this <?php ?> That shows where php code is. If those lines are within those tags you need to use echo to output them to the screen <?php echo 'Something to output'; ?> so for that string it will looks something like <?php echo '<a title="Bold : [b ][/b ]" onmousedown="addTags(\'[b ]\',\'[/b ]\')" style="background-color:#F7F7F7; font-size:10pt; border: outset white 1px;"> <b>B</b> </a>'; ?> with the '[b ]' bits you need to escape the ' marks to stop it from breaking the string, and you do that with \. Hope this helps, if not post your code, it will probable help give us a clearer example of what you are trying to do Quote Link to comment Share on other sites More sharing options...
niiki-lou Posted May 28, 2009 Author Share Posted May 28, 2009 Hello Jibberish thansk for the break down / explanation it helped e to understnad this in a better way but im still getting my errors and im very unsure why Parse error: syntax error, unexpected T_STRING in /home/phpcorec/public_html/pm/compose.php on line 125 $contentOutput .=' <form name="send" method="post" action="index.php?page=messages&option=new"> <table width="80%"> <tr> <td width="150px" align="left" valign="top"><p>Username</p></td> <td width="" align="left" valign="top"><input name="username" id="username" value="' . $_GET['user'] . $receiver . '" readonly="readonly"></td> </tr> <tr> <td width="150px" align="left" valign="top"><p>Subject</p></td> <td width="" align="left" valign="top"><input name="subject" type="text" id="subject" value="' . $subject . '"></td> </tr> <?php // THIS IS LINE 125 echo '<a title="Bold : [b ][/b ]" onmousedown="addTags(\'[b ]\',\'[/b ]\')" style="background-color:#F7F7F7; font-size:10pt; border: outset white 1px;"> <b>B</b> </a>'; ?> <tr> <td width="150px" align="left" valign="top"><p>Message Body</p></td> <td width="" align="left" valign="top"><textarea name="message" type="text" id="message" value="" cols="50" rows="10"></textarea></td> </tr> <tr> <td><input type="hidden" name="unread" value="' . $unread . '"></td> </tr> <tr> <td></td> <td><input type="submit" name="Submit" value="Send Message"></td> </tr> </table> </form>'; } ?> Quote Link to comment Share on other sites More sharing options...
niiki-lou Posted May 28, 2009 Author Share Posted May 28, 2009 Oh! never mind i know what the problem is, i forgot to close out my template framework tag Doh me! Quote Link to comment Share on other sites More sharing options...
MiCR0 Posted May 28, 2009 Share Posted May 28, 2009 Tons of problems in this 1st your trying to echo out inside a table code look into </td> and </tr> of a table. </tr> table is still running this unless you output inside the <td>OUTPUT</td> your have problems on the rending side of html. Next error You have the STRING $contentOutput which means this page is already have a PHP start at the top maybe so you do not need to start it again. Last problem You look to be editing someones code and if this was done by a professional this would more then likely be an return therefore this will make problems trying to echo inside a return as it will just echo outside the top of the page and also maybe a session error, therefor you need to follow his logic with the personal code. I recommend finding the end of that table which shown as </table> and then add a new line after the "';" $contentOutput .= '<a title="Bold : [b ][/b ]" onmousedown="addTags(\'[b ]\',\'[/b ]\')" style="background-color:#F7F7F7; font-size:10pt; border: outset white 1px;"> <b>B</b> </a>'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.