I have created a storelocator.php in my view with the following code :
<?php $dom = new DOMDocument("1.0"); $node = $dom->createElement("markers"); $parnode = $dom->appendChild($node); header("Content-type: text/xml"); foreach ($results as $value){ // ADD TO XML DOCUMENT NODE $node = $dom->createElement("marker"); $newnode = $parnode->appendChild($node); $newnode->setAttribute("name",$value->dealer_name); $newnode->setAttribute("address", $value->address); $newnode->setAttribute("lat", $value->lat); $newnode->setAttribute("lng", $value->lng); $newnode->setAttribute("type", $value->outlet_type); } echo $dom->saveXML(); ?>My Route is:
Route::get('/storelocator','SearchController@showReviews');
my ShowReviews Function
public function showReviews()
{
//$dealer_address = dealer_addresss::lists('dealer_name','address','lat','lng','outlet_type');
//return view('/reviews',compact('dealer_address'));
$results = DB::table('dealer_address')
->get();
//return view('/reviewresults',compact('results'));
return view('/storelocator',compact('results'));
}
All I get is a blank page: When I click on source I am able to the xml content with the data but on hover it says Attempt to use an XML processing instruction in HTML.
What am I doing wrong here ? Any guide would be immensely appreciated.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community