0 Replies - 1438 Views - Last Post: 16 November 2012 - 12:58 PM Rate Topic: -----

#1 jzm  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 21-March 09

Populating an if statement problem and question

Posted 16 November 2012 - 12:58 PM

How could I get Category->Subcategories->Category->Name and Category->Name data to show if the ListingCategory and Number are the same?

They are going to be used as navigational items at a later date so they need to be separate.


Array Example:

    Array ( 
        [0] => Array ( 
            [ListingId] => SimpleXMLElement Object ([0] => 532712629) 
            [ListingCategory] => SimpleXMLElement Object ( [0] => 0350-5748-3400- ) 
        ) [1] =>


PHP:

$catNum = $this->getTMMemberListings();
		$catPrefix = $catNum[0]['ListingCategory'];
   		
   		$catDetailsXml = simplexml_load_file("url");

   		$query = $catDetailsXml->Subcategories;

   		var_dump($query);

   		foreach ($query->Category as $categoryDetails) {
   				
   				if ($categoryDetails->Number === $catPrefix) 
   				{
   					
   				}
   		}


Structure:

    <Category>
      <Name>Residential</Name>
      <Subcategories>
        <Category>
          <Name>Car parks</Name>
          <Number>1-</Number>
        </Category>
      </Subcategories>
    </Category>


Is This A Good Question/Topic? 0
  • +

Page 1 of 1