Yii Framework Forum: Dropdown List Target Source - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Dropdown List Target Source

#1 User is offline   stonebird19 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 27-February 14

Posted 27 February 2014 - 08:10 AM

I have taken over the build of a site: www.leadassist.co.uk/register.

The 'Company' dropdown list is currently pointing at an SQL database which holds only a portion of the data that I require. The site is currently linked to an XML web service which holds all of the data that I need, but I cannot get this particular field - the 'Company' dropdown - to point at it.

I am only just finding my feet with this framework, hence my query. Does anyone know where I would set the target source for the dropdown list to look at the XML service instead of the SQL? As mentioned, I know that the XML is functioning because it is pulling the data in another part of the site.

If I need to supply anything, let me know.

Cheers!
0

#2 User is offline   mrtain 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 29-November 11

Posted 26 March 2014 - 08:19 AM

View Poststonebird19, on 27 February 2014 - 08:10 AM, said:

I have taken over the build of a site: www.leadassist.co.uk/register.

The 'Company' dropdown list is currently pointing at an SQL database which holds only a portion of the data that I require. The site is currently linked to an XML web service which holds all of the data that I need, but I cannot get this particular field - the 'Company' dropdown - to point at it.

I am only just finding my feet with this framework, hence my query. Does anyone know where I would set the target source for the dropdown list to look at the XML service instead of the SQL? As mentioned, I know that the XML is functioning because it is pulling the data in another part of the site.

If I need to supply anything, let me know.

Cheers!



Without looking too deep into it, I'd suggest you read the contents of the xml file into an array, then create a fresh array based on your required values, something like:

$list = array();
$xmlValue = array(1,2,3);// your xml fields
foreach($xmlValue as $key=>$value)
{
 $list[$key] = $value;
}
return $list;

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users