Joshv1288 Posted July 16, 2008 Share Posted July 16, 2008 Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/h3swat/public_html/Forum/core/_forum.php on line 567 im gettin this error w/ this code and from there down it gives me an error can someone help me out $suche = array('/[b](.+?)[/b]/i', '/[i](.+?)[/i]/i', '/[u](.+?)[/u]/i', '/[url=(.+?)](.+?)[/url]/i', '/:)/i', '/;)/i', '/:D/i', '/:p/i', '/:'/i', 567-> '/[quote](.+?)[/quote]/is', '/[color=(.+?)](.+?)[/color]/i'); $code = array('<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<a href="$1" class="link" target="_blank">$2</a>', '<img src="images/smilies/smile.gif" alt="" />', '<img src="images/smilies/wink.gif" alt="" />', '<img src="images/smilies/laugh.gif" alt="" />', '<img src="images/smilies/tounge.gif" alt="" />', '<img src="images/smilies/worried.gif" alt=":'(" />', '<br /><div class="quote">$1</div><br />', '<span style="color: $1;">$2</span>'); $text = stripslashes($text); $text = preg_replace($suche, $code, $text); $text = nl2br($text); return $text; } } ?> Link to comment https://forums.phpfreaks.com/topic/114949-php-parse-error/ Share on other sites More sharing options...
BillyBoB Posted July 16, 2008 Share Posted July 16, 2008 You didn't escape the use a of a ' apostrophe. $suche = array('/[b](.+?)[/b]/i', '/[i](.+?)[/i]/i', '/[u](.+?)[/u]/i', '/[url=(.+?)](.+?)[/url]/i', '/:)/i', '/;)/i', '/:D/i', '/:p/i', '/:\'/i', //in this line the apostrophe needed escaped it was cutting your str in half. 567-> '/[quote](.+?)[/quote]/is', '/[color=(.+?)](.+?)[/color]/i'); $code = array('<b>$1</b>', '<i>$1</i>', '<u>$1</u>', '<a href="$1" class="link" target="_blank">$2</a>', '<img src="images/smilies/smile.gif" alt="" />', '<img src="images/smilies/wink.gif" alt="" />', '<img src="images/smilies/laugh.gif" alt="" />', '<img src="images/smilies/tounge.gif" alt="" />', '<img src="images/smilies/worried.gif" alt=":'(" />', '<br /><div class="quote">$1</div><br />', '<span style="color: $1;">$2</span>'); $text = stripslashes($text); $text = preg_replace($suche, $code, $text); $text = nl2br($text); return $text; } } ?> Also you can shorten your regex with quote and color. '/[quote](.*)[/quote]/is', '/[color=(.*)](.*)[/color]/i'); The asterisk reads as zero or more of the previous character. I have included a little regex cheat sheet it works wonders when I'm in a bind with regex. [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/114949-php-parse-error/#findComment-591188 Share on other sites More sharing options...
MadTechie Posted July 16, 2008 Share Posted July 16, 2008 also you may want to update your regex's by replacing the / tags with % ie $suche = array('%[b](.+?)[/b]%i', //etc etc etc Link to comment https://forums.phpfreaks.com/topic/114949-php-parse-error/#findComment-591189 Share on other sites More sharing options...
BillyBoB Posted July 16, 2008 Share Posted July 16, 2008 @MadTechie: I would love to know why someone would do that. Is there an error with using / or is it just better for the system if you use %? Link to comment https://forums.phpfreaks.com/topic/114949-php-parse-error/#findComment-591191 Share on other sites More sharing options...
MadTechie Posted July 16, 2008 Share Posted July 16, 2008 okay, heres yours $suche = array('/[b](.+?)[/b]/i') now i know that you are using the i switch.. but the computer will think you switch is b]/i as you started with a / you must end with a / but your regex requires /, so you can do one of two things $suche = array('/[b](.+?)[//b]/i') //or $suche = array('%[b](.+?)[/b]%i') i find % easier but you can use almost anything ie $suche = array('~[b](.+?)[/b]~i') $suche = array('#[b](.+?)[/b]#i') $suche = array('@[b](.+?)[/b]@i') //etc make sense ? Link to comment https://forums.phpfreaks.com/topic/114949-php-parse-error/#findComment-591194 Share on other sites More sharing options...
Joshv1288 Posted July 16, 2008 Author Share Posted July 16, 2008 now i have this error Fatal error: Smarty error: [in standard/main/header.tpl line 3]: syntax error: unrecognized tag 'config_load' (Smarty_Compiler.class.php, line 590) in /home/h3swat/public_html/Forum/smarty/Smarty.class.php on line 1095 {* Loads the language file at the section of head *} {config_load file="$language/main.conf" section="head"} <!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>{$page_title} - {$page_subtitle}</title> <link rel="stylesheet" type="text/css" href="templates/{$template}/style.css" /> </head> <body> <div id="header"> <div> <h2>{$page_title}</h2> <p>{$page_subtitle}</p> </div> </div> Link to comment https://forums.phpfreaks.com/topic/114949-php-parse-error/#findComment-591219 Share on other sites More sharing options...
MadTechie Posted July 16, 2008 Share Posted July 16, 2008 erm.. thats a Smarty problem, your need to post that problem in the Third Party Section Link to comment https://forums.phpfreaks.com/topic/114949-php-parse-error/#findComment-591224 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.