Jump to content

Recommended Posts

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

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

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.