0

im building a clone youtube site and the templates have smarty code every-time i try to add a style to it or even change the bg color of the template i get this error. could someone show me an example on what im supposed to do. and how it should look in the code.

here what i did

mohrt
can you should me an example with the top code

the was in a style tag on the php page.

Now the login page in login.php i tried to put html code above it like so:

<!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=utf-8" />
<title>Poetry Battles</title>
<script language="javaScript" src="main.php"></script> 
<style type="text/css">
<!--
#header {
	position:absolute;
	left:87px;
	top:0px;
	width:800px;
	height:20px;
	z-index:1;
	background-color: #0d0600;
}
#content {
	position:absolute;
	left:3px;
	top:29px;
	width:1000px;
	height:1300px;
	z-index:-1;
	background-image: url(intro%20bg.png);
	background-repeat: no-repeat;
}
#footer {
	position:absolute;
	left:9px;
	top:1346px;
	width:990px;
	height:50px;
	z-index:3;

then

>?php


info


?>

thats when i got the error and had to take the style out. thats what happens when i try to modify any of the templates with a style i want my site to be a browish color

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

4
Contributors
11
Replies
12
Views
7 Years
Discussion Span
Last Post by WoW Me Web Girl
0

What is going on with these lines?

z-index:3;

then

>?php


info


?>

Doesn't really look right.
You have not closed the <style type="text/css"> or <!-- , you are missing a } to indicate that you have finished the styles for #footer and PHP is opened with <?php not >?php I also have no idea why you have a random then and info in there either...

0

that wasn't my actual code because when i got the error message i changed it back. it was just an example but in the code i did code the tags and i put the word then to just show you that after my html code i put my php script.

0

If this code is in a default smarty template then the curly brackets (from the stylesheet) denote a template variable. Either change the curly brackets, use {literal} or put the CSS in a separate file. Note that using javascript in a smarty template has the same issue.

0

my bad !! okay this is the error
Fatal error: Smarty error: [in login.tpl line 3]: syntax error: unrecognized tag: font-family: Trebuchet MS; font-size: 14px; color: #996633; (Smarty_Compiler.class.php, line 455) in /home/poetryba/public_html/include/smarty/libs/Smarty.class.php on line 1092

this is my code

<style type="text/css">
<!--
body,td,th {
	font-family: Trebuchet MS;
	font-size: 14px;
	color: #996633;
}
body {
	background-color: #0d0600;
}
a:link {
	color: #996633;
}
a:visited {
	color: #996633;
}
a:hover {
	color: #00FFFF;
}
a:active {
	color: #996633;
}
--></style>

{if $inactive_user eq '1'}

<div align="center">
     <a href="{$base_url}/resend_activation_mail.php">Resend activation e-mail</a>
</div>

{else}

<div id="login_box1">

    <div class="section bg2">
    
        <div class="hd">
            <div class="hd-l">
                Information of {$site_name}
            </div>
        </div>
        
        <div class="margin-1em">
            
            {literal}<h2>What is {$site_name}?</h2>                 
            
            <p>{$site_name} is a way to get your videos to the people who matter to you. With {$site_name} you can:</p>
            
            <ul>
                <li>Show off your favorite videos to the world</li>
                <li>Blog the videos you take with your digital camera or cell phone</li>
                <li>Securely and privately show videos to your friends and family around the world</li>
                <li>... and much, much more!</li>                
            </ul>
            
            <p class="signup"><a href="{$base_url}/signup/">Sign up Now</a> and open a new account.</p>
            
            <p>To learn more about our service, please see our <a href="{$base_url}/pages/help.html">Help</a> section.</p>
        </div>
    
    </div>

</div> <!-- login_box1 -->

<div id="login_box2">
  
    <div class="section bg2">
    
        <div class="hd">
            <div class="hd-l">
                  {$site_name} Log In
            </div>
        </div>
        
        <form method="post" action="{$base_url}/login/" id="login-form">
        
            <div>
                <label for="user_name">User Name:</label>
                <input type="text" id="user_name" size="22" name="user_name" value="{$user_name}" />
            </div>
             
            <div>
                <label for="password">Password:</label>
                <input type="password" id="password" size="22" name="user_password" />
            </div>

            <div class="forget-passsword">
                <a href="{$base_url}/recoverpass.php">Forgot your password?</a>
            </div>
            
            <div class="submit">
                <input type="submit" value="Log In" name="action_login" />
                <input type="checkbox" name="autologin" />Remember
           </div>
        
        </form>
    
    </div> 
    
</div> <!--login_box2 -->

{/if}

im trying to change the look of my login.tpl

they have all these special tags it will not let my make changes to the templates.

this is a youtube clone script that uses smarty tags.

thanks
jamika

0

this is the php script in the error line 455 is the red color
(Smarty_Compiler.class.php, line 455)

/* Split tag into two three parts: command, command modifiers and the arguments. */
        if(! preg_match('~^(?:(' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp
                . '|\/?' . $this->_reg_obj_regexp . '|\/?' . $this->_func_regexp . ')(' . $this->_mod_regexp . '*))
                      (?:\s+(.*))?$
                    ~xs', $template_tag, $match)) {
          line 455  $this->_syntax_error("unrecognized tag: $template_tag", E_USER_ERROR, __FILE__, __LINE__);
        }
        
        $tag_command = $match[1];
        $tag_modifier = isset($match[2]) ? $match[2] : null;
        $tag_args = isset($match[3]) ? $match[3] : null;

        if (preg_match('~^' . $this->_num_const_regexp . '|' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '$~', $tag_command)) {
            /* tag name is a variable or object */
            $_return = $this->_parse_var_props($tag_command . $tag_modifier);
            return "<?php echo $_return; ?>" . $this->_additional_newline;
        }

        /* If the tag name is a registered object, we process it. */
        if (preg_match('~^\/?' . $this->_reg_obj_regexp . '$~', $tag_command)) {
            return $this->_compile_registered_object_tag($tag_command, $this->_parse_attrs($tag_args), $tag_modifier);
        }

        switch ($tag_command) {
            case 'include':
                return $this->_compile_include_tag($tag_args);

            case 'include_php':
                return $this->_compile_include_php_tag($tag_args);

            case 'if':
                $this->_push_tag('if');
                return $this->_compile_if_tag($tag_args);

            case 'else':
                list($_open_tag) = end($this->_tag_stack);
                if ($_open_tag != 'if' && $_open_tag != 'elseif')
                    $this->_syntax_error('unexpected {else}', E_USER_ERROR, __FILE__, __LINE__);
                else
                    $this->_push_tag('else');
                return '<?php else: ?>';

            case 'elseif':
                list($_open_tag) = end($this->_tag_stack);
                if ($_open_tag != 'if' && $_open_tag != 'elseif')
                    $this->_syntax_error('unexpected {elseif}', E_USER_ERROR, __FILE__, __LINE__);
                if ($_open_tag == 'if')
                    $this->_push_tag('elseif');
                return $this->_compile_if_tag($tag_args, true);

            case '/if':
                $this->_pop_tag('if');
                return '<?php endif; ?>';

            case 'capture':
                return $this->_compile_capture_tag(true, $tag_args);

            case '/capture':
                return $this->_compile_capture_tag(false);

            case 'ldelim':
                return $this->left_delimiter;

            case 'rdelim':
                return $this->right_delimiter;

            case 'section':
                $this->_push_tag('section');
                return $this->_compile_section_start($tag_args);

            case 'sectionelse':
                $this->_push_tag('sectionelse');
                return "<?php endfor; else: ?>";
                break;

            case '/section':
                $_open_tag = $this->_pop_tag('section');
                if ($_open_tag == 'sectionelse')
                    return "<?php endif; ?>";
                else
                    return "<?php endfor; endif; ?>";

            case 'foreach':
                $this->_push_tag('foreach');
                return $this->_compile_foreach_start($tag_args);
                break;

            case 'foreachelse':
                $this->_push_tag('foreachelse');
                return "<?php endforeach; else: ?>";

            case '/foreach':
                $_open_tag = $this->_pop_tag('foreach');
                if ($_open_tag == 'foreachelse')
                    return "<?php endif; unset(\$_from); ?>";
                else
                    return "<?php endforeach; endif; unset(\$_from); ?>";
                break;

            case 'strip':
            case '/strip':
                if (substr($tag_command, 0, 1)=='/') {
                    $this->_pop_tag('strip');
                    if (--$this->_strip_depth==0) { /* outermost closing {/strip} */
                        $this->_additional_newline = "\n";
                        return '{' . $tag_command . '}';
                    }
                } else {
                    $this->_push_tag('strip');
                    if ($this->_strip_depth++==0) { /* outermost opening {strip} */
                        $this->_additional_newline = "";
                        return '{' . $tag_command . '}';
                    }
                }
                return '';

            case 'php':
                /* handle folded tags replaced by {php} */
                list(, $block) = each($this->_folded_blocks);
                $this->_current_line_no += substr_count($block[0], "\n");
                /* the number of matched elements in the regexp in _compile_file()
                   determins the type of folded tag that was found */
                switch (count($block)) {
                    case 2: /* comment */
                        return '';

                    case 3: /* literal */
                        return "<?php echo '" . strtr($block[2], array("'"=>"\'", "\\"=>"\\\\")) . "'; ?>" . $this->_additional_newline;

                    case 4: /* php */
                        if ($this->security && !$this->security_settings['PHP_TAGS']) {
                            $this->_syntax_error("(secure mode) php tags not permitted", E_USER_WARNING, __FILE__, __LINE__);
                            return;
                        }
                        return '<?php ' . $block[3] .' ?>';
                }
                break;

            case 'insert':
                return $this->_compile_insert_tag($tag_args);

            default:
                if ($this->_compile_compiler_tag($tag_command, $tag_args, $output)) {
                    return $output;
                } else if ($this->_compile_block_tag($tag_command, $tag_args, $tag_modifier, $output)) {
                    return $output;
                } else if ($this->_compile_custom_tag($tag_command, $tag_args, $tag_modifier, $output)) {
                    return $output;                    
                } else {
                    $this->_syntax_error("unrecognized tag '$tag_command'", E_USER_ERROR, __FILE__, __LINE__);
                }
0

now is the last part of the error message
Smarty.class.php on line 1092
line 1092 in highlighted green

/**
     * trigger Smarty error
     *
     * @param string $error_msg
     * @param integer $error_type
     */
    function trigger_error($error_msg, $error_type = E_USER_WARNING)
    {
        trigger_error("Smarty error: $error_msg", $error_type);
    }
0

Hi - put a {literal}before <script> tag and {/literal} after </script>
It should work then.
Reason for problem: in css u use {} curly braces for your styles, but the curly braces means a lot to our smarty engine.....it might think thats a smarty tag....but no its our css code...hence we have to tell smarty that this code is not smarty code and it can just ignore it...

Hope this helps
Thanks
Prabhakar
Web Developer - Trainee

0

it finally worked . there is a css folder with about 7 different style sheets and i had to go in and change them with the {literal} code you gave me. thanks everyone for all your help i really appreciate.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.