Page 1 of 1

FEU - country selector

Posted: Thu Nov 22, 2012 5:02 pm
by macarrier
Hi all!

I'm fairly new to cmsms and I'm trying to make my way around, without great success.

I'm looking for a way to implement a country selector in my FEU user property form.

First, I created a select field in my User Properties. Since there's a country table in my database, I also created a {countrylist} User Defined Tag to query the database and generate the options to my select field. Tho, when i put it my {countrylist} smarty tag inside my option list, it shows {countrylist} as a string, not as a smarty tag.

Is there a way inside the option list to force the use of smarty tag?

Thanks alot for your time.

Re: FEU - country selector

Posted: Thu Nov 22, 2012 5:47 pm
by uniqu3
You will need eval function for that field in your FEU Template.
http://www.smarty.net/docs/en/language. ... n.eval.tpl

Re: FEU - country selector

Posted: Fri Nov 23, 2012 4:43 pm
by macarrier
thanks for your reply uniqu3. It led me on a solution but I'm still having trouble. Here's what I done so far:

-created my User Properties:

Code: Select all

global $gCms;
$db =& $gCms->GetDB();
$sql = 'SELECT * FROM cms_module_cge_countries ORDER BY name';
$r = $db->Execute($sql);
$results = $r->GetRows();

if ($r) {
  foreach($results as $key => $value)
  {
    echo '<option value="'.$value['id'].'">'.$value['name'].'</option>';
    [b]// tried echo $value['name'].'='.$value['id']."\r\n"; but it created a singlew option will all my countries in it.[/b]
  }
} else {
  echo 'query failed';  
}
-afterward, created my field in FEU user property:
it's a dropdown list in I grabbed my User Property {countrylist} as my option.

-lastly, I modified my form template:
I change {$control->control} to {eval var=$control->control}

No, what happens is that my options in my country dropbox looks like this:

<option value="<option value="1">Afghanistan</option>[... up to ...]<option value="238">Zimbabwe</option>">

<option value="1">Afghanistan</option>[.... up to ....]<option value="238">Zimbabwe</option>

any ideas to prevent dupicating?