Jump to content

Parse error: syntax error, unexpected '.', expecting '}


jsuthers

Recommended Posts

Hey im having a little probelm with this script below is my script

 

{include file="admin_header.tpl"}
<h2 align="center">{$LAN_48}</h2>
<div align="center"><form action="options.php?pt=options&pag=options" method="post">
{section name=options loop=$options}
	{$LAN_33}
	<br />
	<input name="name" type="text" value="{$options[options].name}" size="30" maxlength="200" />
	<br />
	<br />
	{$LAN_67}
	<br />
	<textarea name="news" cols="30" rows="2">{$options[options].news}</textarea>
	<br />
	<br />
	{$LAN_57}
	<br />
	<input name="vids_per_page" type="text" value="{$options[options].vids_per_page}" size="2" maxlength="2" />
	<br />


	<br />

	<select name="template">
{php}
if ($handle = opendir('../templates')) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
         echo "<option value='{$options[options].template}'>";
            echo basename($file, ".php");
         echo "</option>\n";
        }
    }
    closedir($handle);
}
{/php}
</select>
		<br />

	{$LAN_58}
	<br />
	<label><input name="lang" type="radio" value="en-gb.inc.php" {if $options[options].lang eq "en-gb.inc.php"}checked="checked"{/if} />English</label>
	<br />
	<label><input name="lang" type="radio" value="fr.inc.php" {if $options[options].lang eq "fr.inc.php"}checked="checked"{/if} />French</label>
	<br />
	{/section}
	<br />
	<input type="hidden" name="options" />
	<input name="submit" type="submit" value="Edit" />
	<br />
	<span class="redsmall">{$LAN_66}</span>
</form>

</div>
</body>
</html>

 

The probelm is with this line

echo "<option value='{$options[options].template}'>";

 

keepts on throwing this up

Parse error: syntax error, unexpected '.', expecting '}'

 

Thank you

well since its part of the smarty templ. engine... ill guess ill give you the cache file....

 

Parse error: syntax error, unexpected '.', expecting '}' in /home/jsuthers/public_html/templates_c/admin/%%B5^B55^B555FBFE%%options.tpl.php on line 64

 

<?php /* Smarty version 2.6.18, created on 2009-12-18 00:07:05
         compiled from options.tpl */ ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "admin_header.tpl", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
?>
<h2 align="center"><?php echo $this->_tpl_vars['LAN_48']; ?>
</h2>
<div align="center"><form action="options.php?pt=options&pag=options" method="post">
<?php unset($this->_sections['options']);
$this->_sections['options']['name'] = 'options';
$this->_sections['options']['loop'] = is_array($_loop=$this->_tpl_vars['options']) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$this->_sections['options']['show'] = true;
$this->_sections['options']['max'] = $this->_sections['options']['loop'];
$this->_sections['options']['step'] = 1;
$this->_sections['options']['start'] = $this->_sections['options']['step'] > 0 ? 0 : $this->_sections['options']['loop']-1;
if ($this->_sections['options']['show']) {
    $this->_sections['options']['total'] = $this->_sections['options']['loop'];
    if ($this->_sections['options']['total'] == 0)
        $this->_sections['options']['show'] = false;
} else
    $this->_sections['options']['total'] = 0;
if ($this->_sections['options']['show']):

            for ($this->_sections['options']['index'] = $this->_sections['options']['start'], $this->_sections['options']['iteration'] = 1;
                 $this->_sections['options']['iteration'] <= $this->_sections['options']['total'];
                 $this->_sections['options']['index'] += $this->_sections['options']['step'], $this->_sections['options']['iteration']++):
$this->_sections['options']['rownum'] = $this->_sections['options']['iteration'];
$this->_sections['options']['index_prev'] = $this->_sections['options']['index'] - $this->_sections['options']['step'];
$this->_sections['options']['index_next'] = $this->_sections['options']['index'] + $this->_sections['options']['step'];
$this->_sections['options']['first']      = ($this->_sections['options']['iteration'] == 1);
$this->_sections['options']['last']       = ($this->_sections['options']['iteration'] == $this->_sections['options']['total']);
?>
	<?php echo $this->_tpl_vars['LAN_33']; ?>

	<br />
	<input name="name" type="text" value="<?php echo $this->_tpl_vars['options'][$this->_sections['options']['index']]['name']; ?>
" size="30" maxlength="200" />
	<br />
	<br />
	<?php echo $this->_tpl_vars['LAN_67']; ?>

	<br />
	<textarea name="news" cols="30" rows="2"><?php echo $this->_tpl_vars['options'][$this->_sections['options']['index']]['news']; ?>
</textarea>
	<br />
	<br />
	<?php echo $this->_tpl_vars['LAN_57']; ?>

	<br />
	<input name="vids_per_page" type="text" value="<?php echo $this->_tpl_vars['options'][$this->_sections['options']['index']]['vids_per_page']; ?>
" size="2" maxlength="2" />
	<br />


	<br />

	<select name="template">
<?php 
if ($handle = opendir('../templates')) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
         echo "<option value='{$options[options].template}'>";
            echo basename($file, ".php");
         echo "</option>\n";
        }
    }
    closedir($handle);
}
?>
</select>
		<br />

	<?php echo $this->_tpl_vars['LAN_58']; ?>

	<br />
	<label><input name="lang" type="radio" value="en-gb.inc.php" <?php if ($this->_tpl_vars['options'][$this->_sections['options']['index']]['lang'] == "en-gb.inc.php"): ?>checked="checked"<?php endif; ?> />English</label>
	<br />
	<label><input name="lang" type="radio" value="fr.inc.php" <?php if ($this->_tpl_vars['options'][$this->_sections['options']['index']]['lang'] == "fr.inc.php"): ?>checked="checked"<?php endif; ?> />French</label>
	<br />
	<?php endfor; endif; ?>
	<br />
	<input type="hidden" name="options" />
	<input name="submit" type="submit" value="Edit" />
	<br />
	<span class="redsmall"><?php echo $this->_tpl_vars['LAN_66']; ?>
</span>
</form>

</div>
</body>
</html>

 

 

that would be this line:

 

echo "<option value='{$options[options].template}'>";

 

change to:

 

echo "<option value='{$options['options']['template']}'>";

 

thinking that should work.

 

unless there's a .template extension in your system, then it'd be:

 

echo "<option value='{$options[options]}.template'>";

 

i've never worked with SMARTY, and i'm wondering how a . got there in the first place.

well that got rid of the error :) thank you for that

 

but what this does is selects the temp. and updates the mysql (which that all works) but what that snip-it is doing is grabs the templete and sets that as the default for the option box... its not grabbing its just going to the first option in the list

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.