Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function writeListings($file) {
- $getLi = mysql_query("SELECT * FROM listing ORDER BY `id` ASC");
- $getBadge = mysql_query("SELECT * FROM listingtemplate_field ORDER BY `field` ASC");
- // Open the file to get existing content
- $xmlLi = new SimpleXmlElement("<listings></listings>");
- while ($badge = mysql_fetch_assoc($getBadge)) {
- for($i=0;$i<10;$i++) {
- $custom_checkbox = 'custom_checkbox' . $i;
- if($badge['field'] == $custom_checkbox) {
- $custom_checkbox[$i]= $badge['label'];
- }
- }
- }
- while($li = mysql_fetch_assoc($getLi)) {
- if ($li['status'] == 'A' && $li['location_4'] == '885' || $li['location_4'] == '6149') {
- $item = $xmlLi->addChild('listing');
- $item->addChild('id', $li['id']);
- $item->addChild('account', $li['account_id']);
- $item->addChild('promoid', $li['promotion_id']);
- $item->addChild('title', $li['title']);
- $item->addChild('image', $li['image_id']);
- $item->addChild('address', $li['address']);
- $item->addChild('address2', $li['address2']);
- $item->addChild('city', $li['location_4']);
- $item->addChild('state', $li['location_3']);
- $item->addChild('zip', $li['zip_code']);
- $item->addChild('phone', $li['phone']);
- $item->addChild('latitude', $li['latitude']);
- $item->addChild('longitude', $li['longitude']);
- $item->addChild('shortdesc', $li['description']);
- $item->addChild('longdesc', $li['long_description']);
- $item->addChild('attachmenttitle', $li['attachment_caption']);
- $item->addChild('level', $li['level']);
- for($i=0;$i<10;$i++) {
- $custom_checkbox = 'custom_checkbox' . $i;
- if ($li[$custom_checkbox] == 'y') {
- $item->addChild('badge', $custom_checkbox[$i]);
- }
- }
- if ($li['listingtemplate_id'] == 1) {
- setDropDown('custom_dropdown0', 'beverage', 'Coke');
- setDropDown('custom_dropdown0', 'beverage', 'Pepsi');
- setDropDown('custom_dropdown1', 'attire', 'Dressy');
- setDropDown('custom_dropdown1', 'attire', 'Business Casual');
- setDropDown('custom_dropdown1', 'attire', 'Formal');
- setDropDown('custom_dropdown2', 'price', 'Cheap');
- setDropDown('custom_dropdown2', 'price', 'Moderate');
- setDropDown('custom_dropdown2', 'price', 'Pricy');
- }
- }
- }
- file_put_contents($file, prettyPrintXml($xmlLi));
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement