[eluser]matches[/eluser]
Sorry for the basic question.
How can I get the following controllers view to show in the productSearch view at the bottom of this post. Currently it just shows the productResults but not embedded in the productSearch view.
Thanks for the help.
ProductResults Controller
Code:
<?php
class ProductResults extends Controller
{
function ProductResults()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
}
public function showProducts()
{
$searchText = $_REQUEST['searchText'];
$products = array();
$oXML = simplexml_load_file('http://sandbox.api.shopping.com/publisher/3.0/rest/GeneralSearch?apiKey=authorized-key&trackingId=7000610&keyword;=' . $searchText);
foreach ($oXML->categories->category->items->product as $oProduct)
{
echo "<img >images->image->sourceURL . "' />";
echo '<h2>' . $oProduct->name . '</h2>';
echo '<p>' . $oProduct->fullDescription . '</p>';
echo sprintf('<a href="%s" title="%s">%s</a>',
$oProduct->productOffersURL,
$oProduct->name,
'More information'
);
}
}
}
?>
ProductSearch Controller
Code:
<?php
class ProductSearch extends Controller
{
function ProductSearch()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
}
function index()
{
$this->load->view('productSearch/index');
}
}
?>
Product Search View
Code:
<html>
<head>
</head>
<body>
<?=form_open('ProductResults/showProducts');?>
<input type="text" name="searchText" />
<input type="submit" name="submit" />
</form>
<?php $this->load->view('productResults/index'); ?>
</body>
</html>