Jump to content

Call to undefined function when using wireRenderFile via AJAX request


a-ok
 Share

Recommended Posts

I've got some AJAX filtering going on – when the user selects a 'filter' it'll send an AJAX request to a ajax.php template and fire the following:

	$filterEndpoint = $this->input->get->filterEndpoint;

	if ($this->input->get->pageTemplate == 'projects') {
		$query = $pages->find("template=projects-filters-single, projects_filters_projects.count>0, include=all, sort=sort, {$filterEndpoint}");
		$itemTemplate = './inc/item__project--filter.inc';
		bd($query);
	}

	$output = '';
	foreach ($query as $item) {
		$output .= wireRenderFile($itemTemplate, array('item' => $item));
	}

	return json_encode(['html' => $output]);

I have an include to a functions.inc file that has a getRatio() function that is included at the top of every template file.

The issue is upon selecting a filter I get a `Call to undefined function getRatio()` error. I have tried to use include_once to the functions.inc file but doesn't seem to make a difference.

Any thoughts?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...