Jump to content

Using a Smarty template in AJAX output


EvanAgee

Recommended Posts

Hey all,

 

I'm using Prototype.js for some AJAX in a project. Typically I just call the PHP and use echo to return the real time results. However, I'm wanting to keep my code and design separate so I'm wondering what the best way to incorporate smarty templates into the mix is? Do I just use $smarty->fetch and echo that output? I haven't been able to get that to work yet. Below is my current code:

 

if ($_GET["action"] == 'search') {
	$html = 'Yeah!';
	$smarty->assign('html',$html);
	$results = $smarty->fetch('/admin/Templates/pages/related_search_results.html');
	echo $results;
	exit;
}

Link to comment
https://forums.phpfreaks.com/topic/126558-using-a-smarty-template-in-ajax-output/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.