Page 1 of 2
CGUserDirectory search error
Posted: Fri Apr 23, 2010 8:22 pm
by evancelt
Hi. I've got a virgin install of cmsms with the newest building of CGUserDirectory (and dependencies).
I've created two test users with FEU. They display correctly in action=default mode
When I try to run {CGUserDirectory action="search"} I get the following error:
Parse error: syntax error, unexpected T_ENDFOREACH in /home/epugh/carrymeohio.com/1/tmp/templates_c/CGUserDirectory^%%66^66B^66BFE851%%module_db_tpl%3ACGUserDirectory%3Bsearchform_Sample.php on line 105
Any ideas?
Thanks
-Evan
Re: CGUserDirectory search error
Posted: Sat Apr 24, 2010 3:16 pm
by evancelt
Where would I go to check that?
I didn't mess with any settings after the default install.
Re: CGUserDirectory search error
Posted: Sat Apr 24, 2010 3:26 pm
by calguy1000
You have an error in your search template in the CGUserDirectory module.
Re: CGUserDirectory search error
Posted: Sat Apr 24, 2010 3:29 pm
by evancelt
Should I reupload the file and try again? I am theoretically using the "sample" search template
EDIT: I reuploaded the module and the error is still occurring. Could the default search template be messed up in the latest repackaging?
Re: CGUserDirectory search error
Posted: Thu Apr 29, 2010 6:20 pm
by evancelt
I've given that a try and no beans.
Here is an empty page that only calls the search function:
http://carrymeohio.com/1/index.php?page=search1
Any more ideas? It seems like the php isn't parsing the a foreach loop correctly
Re: CGUserDirectory search error
Posted: Thu Apr 29, 2010 7:11 pm
by vilkis
Did you delete cache?
vilkis
Re: CGUserDirectory search error
Posted: Thu Apr 29, 2010 7:24 pm
by evancelt
Thanks for the suggestion, Vilkis, but the error remains after simply clearing cache and also after clearing cache and then resetting search script to default.
Has anyone else had a similar problem?
I'm running the script on dreamhost. Could that be part of the problem?
Re: CGUserDirectory search error
Posted: Thu Apr 29, 2010 9:18 pm
by vilkis
Can you post your search template here?
vilkis
Re: CGUserDirectory search error
Posted: Thu Apr 29, 2010 9:20 pm
by evancelt
Here is the sample search template being used:
Code: Select all
{* search form template *}
{* valid fields are:
{$actionid}ud_submit - (string) for a submit button
{$actionid}ud_cancel - (string) for a cancel button
{$actionid}ud_username - (string) username expression
{$actionid}ud_propvalue - (string) property value
*}
<div id="ud_searchform">
{$formstart}
<div class="row">
<p class="col30">{$mod->Lang('username')}</p>
<p class="col70">
<input type="text" name="{$actionid}ud_username" size="20" maxlength="40"/>
</p>
</div>
{if isset($searchprops)}
{foreach from=$searchprops key='propname' item='data'}
{$data|@debug_display}
<div class="row">
<p class="col30">{$data.fielddefn.prompt}:</p>
<p class="col70">
{if $data.fieldtype == 'text'}
<input type="text" name="{$actionid}ud_propvalue[{$propname}]" size="20" maxlength="20"/>
{else if $data.fieldtype == 'select'}
<select name="{$actionid}ud_propvalue[{$propname}]">
{html_options options=$data.options}
</select>
{/if}
</p>
</div>
{/foreach}
{/if}
<div class="row">
<p class="col30">{$mod->Lang('results_all_any')}?</p>
<p class="col70">
<select name="{$actionid}ud_allany">
<option value="all">{$mod->Lang('all')}</option>
<option value="any">{$mod->Lang('any')}</option>
</select>
</p>
</div>
<div class="row">
<p class="col30"> </p>
<p class="col70">
<input type="submit" name="{$actionid}ud_submit" value="{$mod->Lang('submit')}"/>
</p>
</div>
{$formend}
</div>
{* search form template *}
{* valid fields are:
{$actionid}ud_submit - (string) for a submit button
{$actionid}ud_cancel - (string) for a cancel button
{$actionid}ud_username - (string) username expression
{$actionid}ud_propvalue - (string) property value
*}
<div id="ud_searchform">
{$formstart}
<div class="row">
<p class="col30">{$mod->Lang('username')}</p>
<p class="col70">
<input type="text" name="{$actionid}ud_username" size="20" maxlength="40"/>
</p>
</div>
{if isset($searchprops)}
{foreach from=$searchprop key='propname' item=$data}
<div class="row">
<p class="col30">{$data.fielddefn.prompt}:</p>
<p class="col70">
{if $data.fieldtype == 'text'}
<input type="text" name="{$actionid}ud_propvalue[{$propname}]" size="20" maxlength="20"/>
{else if $data.fieldtype == 'select'}
<select name="{$actionid}ud_propvalue[{$propname}]">
{html_options options=$ud_options}
</select>
{/if}
</p>
</div>
{/foreach}
{/if}
<div class="row">
<p class="col30">{$mod->Lang('results_all_any')}?</p>
<p class="col70">
<select name="{$actionid}ud_allany">
<option value="all">{$mod->Lang('all')}</option>
<option value="any">{$mod->Lang('any')}</option>
</select>
</p>
</div>
<div class="row">
<p class="col30"> </p>
<p class="col70">
<input type="submit" name="{$actionid}ud_submit" value="{$mod->Lang('submit')}"/>
</p>
</div>
{$formend}
</div>
Re: CGUserDirectory search error
Posted: Tue May 04, 2010 9:34 pm
by evancelt
Could it be that short_open_tag is set to off in php.ini?
Re: CGUserDirectory search error
Posted: Tue May 04, 2010 10:44 pm
by vilkis
what is content of file CGUserDirectory^%%66^66B^66BFE851%%module_db_tpl%3ACGUserDirectory%3Bsearchform_Sample.php ?
Check if it this file is deleted after delete cache.
vilkis
Re: CGUserDirectory search error
Posted: Tue May 04, 2010 10:46 pm
by evancelt
The content of that file is:
Code: Select all
<?php /* Smarty version 2.6.25, created on 2010-05-04 14:55:28
compiled from module_db_tpl:CGUserDirectory%3Bsearchform_Sample */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'debug_display', 'module_db_tpl:CGUserDirectory;searchform_Sample', 21, false),array('function', 'html_options', 'module_db_tpl:CGUserDirectory;searchform_Sample', 29, false),)), $this); ?>
<?php $this->_cache_serials['/home/epugh/carrymeohio.com/1/tmp/templates_c/CGUserDirectory^%%66^66B^66BFE851%%module_db_tpl%3ACGUserDirectory%3Bsearchform_Sample.inc'] = '3baefc008ec96625d1b05708ae472daa'; ?>
<div id="ud_searchform">
<?php echo $this->_tpl_vars['formstart']; ?>
<div class="row">
<p class="col30"><?php echo $this->_tpl_vars['mod']->Lang('username'); ?>
</p>
<p class="col70">
<input type="text" name="<?php echo $this->_tpl_vars['actionid']; ?>
ud_username" size="20" maxlength="40"/>
</p>
</div>
<?php if (isset ( $this->_tpl_vars['searchprops'] )): ?>
<?php $_from = $this->_tpl_vars['searchprops']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
foreach ($_from as $this->_tpl_vars['propname'] => $this->_tpl_vars['data']):
?>
<?php echo debug_display($this->_tpl_vars['data']); ?>
<div class="row">
<p class="col30"><?php echo $this->_tpl_vars['data']['fielddefn']['prompt']; ?>
:</p>
<p class="col70">
<?php if ($this->_tpl_vars['data']['fieldtype'] == 'text'): ?>
<input type="text" name="<?php echo $this->_tpl_vars['actionid']; ?>
ud_propvalue[<?php echo $this->_tpl_vars['propname']; ?>
]" size="20" maxlength="20"/>
<?php else: ?>
<select name="<?php echo $this->_tpl_vars['actionid']; ?>
ud_propvalue[<?php echo $this->_tpl_vars['propname']; ?>
]">
<?php echo smarty_function_html_options(array('options' => $this->_tpl_vars['data']['options']), $this);?>
</select>
<?php endif; ?>
</p>
</div>
<?php endforeach; endif; unset($_from); ?>
<?php endif; ?>
<div class="row">
<p class="col30"><?php echo $this->_tpl_vars['mod']->Lang('results_all_any'); ?>
?</p>
<p class="col70">
<select name="<?php echo $this->_tpl_vars['actionid']; ?>
ud_allany">
<option value="all"><?php echo $this->_tpl_vars['mod']->Lang('all'); ?>
</option>
<option value="any"><?php echo $this->_tpl_vars['mod']->Lang('any'); ?>
</option>
</select>
</p>
</div>
<div class="row">
<p class="col30"> </p>
<p class="col70">
<input type="submit" name="<?php echo $this->_tpl_vars['actionid']; ?>
ud_submit" value="<?php echo $this->_tpl_vars['mod']->Lang('submit'); ?>
"/>
</p>
</div>
<?php echo $this->_tpl_vars['formend']; ?>
</div>
<div id="ud_searchform">
<?php echo $this->_tpl_vars['formstart']; ?>
<div class="row">
<p class="col30"><?php echo $this->_tpl_vars['mod']->Lang('username'); ?>
</p>
<p class="col70">
<input type="text" name="<?php echo $this->_tpl_vars['actionid']; ?>
ud_username" size="20" maxlength="40"/>
</p>
</div>
<?php if (isset ( $this->_tpl_vars['searchprops'] )): ?>
<div class="row">
<p class="col30"><?php echo $this->_tpl_vars['data']['fielddefn']['prompt']; ?>
:</p>
<p class="col70">
<?php if ($this->_tpl_vars['data']['fieldtype'] == 'text'): ?>
<input type="text" name="<?php echo $this->_tpl_vars['actionid']; ?>
ud_propvalue[<?php echo $this->_tpl_vars['propname']; ?>
]" size="20" maxlength="20"/>
<?php else: ?>
<select name="<?php echo $this->_tpl_vars['actionid']; ?>
ud_propvalue[<?php echo $this->_tpl_vars['propname']; ?>
]">
<?php if ($this->caching && !$this->_cache_including): echo '{nocache:3baefc008ec96625d1b05708ae472daa#0}'; endif;$_cache_attrs =& $this->_smarty_cache_attrs('3baefc008ec96625d1b05708ae472daa','0');echo smarty_function_html_options(array('options' => $this->_tpl_vars['ud_options']), $this);if ($this->caching && !$this->_cache_including): echo '{/nocache:3baefc008ec96625d1b05708ae472daa#0}'; endif;?>
</select>
<?php endif; ?>
</p>
</div>
<?php endforeach; endif; unset($_from); ?>
<?php endif; ?>
<div class="row">
<p class="col30"><?php echo $this->_tpl_vars['mod']->Lang('results_all_any'); ?>
?</p>
<p class="col70">
<select name="<?php echo $this->_tpl_vars['actionid']; ?>
ud_allany">
<option value="all"><?php echo $this->_tpl_vars['mod']->Lang('all'); ?>
</option>
<option value="any"><?php echo $this->_tpl_vars['mod']->Lang('any'); ?>
</option>
</select>
</p>
</div>
<div class="row">
<p class="col30"> </p>
<p class="col70">
<input type="submit" name="<?php echo $this->_tpl_vars['actionid']; ?>
ud_submit" value="<?php echo $this->_tpl_vars['mod']->Lang('submit'); ?>
"/>
</p>
</div>
<?php echo $this->_tpl_vars['formend']; ?>
</div>
So, there is an extra endforeach in that code. Where did it come from, though? I'm using the default search template
EDIT: I've tried to manually delete this file and it comes back (in this same form) after reloading the page.
Re: CGUserDirectory search error
Posted: Mon May 17, 2010 6:02 pm
by chris..
Hi all,
It's just a -big- typo : template is repeated twice.
Delete half of it and it should be ok.
Re: CGUserDirectory search error
Posted: Mon May 17, 2010 6:52 pm
by vilkis
yep, your code in template is doubled, but I thing that it is not the reason.
I do not use CGUserDirectory, but try to enter the following code to search template:
Code: Select all
{* search form template *}
{* valid fields are:
{$actionid}ud_submit - (string) for a submit button
{$actionid}ud_cancel - (string) for a cancel button
{$actionid}ud_username - (string) username expression
{$actionid}ud_propvalue - (string) property value
*}
<div id="ud_searchform">
{$formstart}
<div class="row">
<p class="col30">{$mod->Lang('username')}</p>
<p class="col70">
<input type="text" name="{$actionid}ud_username" size="20" maxlength="40"/>
</p>
</div>
{if isset($searchprops)}
{foreach from=$searchprops key='propname' item='data'}
{$data|@debug_display}
<div class="row">
<p class="col30">{$data.fielddefn.prompt}:</p>
<p class="col70">
{if $data.fieldtype == 'text'}
<input type="text" name="{$actionid}ud_propvalue[{$propname}]" size="20" maxlength="20"/>
{elseif $data.fieldtype == 'select'}
<select name="{$actionid}ud_propvalue[{$propname}]">
{html_options options=$data.options}
</select>
{/if}
</p>
</div>
{/foreach}
{/if}
<div class="row">
<p class="col30">{$mod->Lang('results_all_any')}?</p>
<p class="col70">
<select name="{$actionid}ud_allany">
<option value="all">{$mod->Lang('all')}</option>
<option value="any">{$mod->Lang('any')}</option>
</select>
</p>
</div>
<div class="row">
<p class="col30"> </p>
<p class="col70">
<input type="submit" name="{$actionid}ud_submit" value="{$mod->Lang('submit')}"/>
</p>
</div>
{$formend}
</div>
vilkis
Re: CGUserDirectory search error
Posted: Sat Jun 05, 2010 12:18 pm
by stevew
I had the same problem as evancelt. There is a duplication in the orig._searchform_template.tpl file, but as Vilkis said, that doesn't seem to be the problem.
I created a new search form template called "test" and pasted in the code suggested by Vilkis. I specified this template in the module call {CGUserDirectory action="search" searchformtemplate="test"} and the search form appears correctly. So this appears to solve the problem. Evancelt?