Support Forums

Calling a Function

This is a discussion on Calling a Function within the Technical Support forums, part of the Technical Support Forums category; If I put the following into the function.php file then how do I call it from layout.tpl? Code: function findcar() ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

Reply
 
Thread Tools Display Modes
Old 11-24-2010, 06:30 AM   #1
Customer
 
phpretard's Avatar
 
Join Date: Sep 2010
Posts: 17
Rep Power: 1
phpretard is on a distinguished road
Default Calling a Function

If I put the following into the function.php file then how do I call it from layout.tpl?

Code:
function findcar()
{
echo "<div class=\"page_name_auto_complete\" id=\"car_list\"></div>";
echo "<script type=\"text/javascript\">
    new Autocompleter.Local('searchtext', 'car_list',[";
	connect();
    $get = mysql_query("SELECT title FROM class_listings")or die(mysql_error());
    while($r = mysql_fetch_array($get)){
    echo "'$r[title]',";}
    echo "'Try out Advanced Search'],{}";
    echo "); \n</script>";
	free($get);
}
__________________
I guess I must have just blacked out again ... not again!
phpretard is offline   Reply With Quote
Old 11-24-2010, 09:37 AM   #2
curmudgeon
 
Join Date: Mar 2006
Posts: 5,333
Rep Power: 132
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

You dont call php functions from the template you reference variables which contain data the functrion created. The function itself is called from the underlying php script and the output of the function is assigned to a template variable.

Your best bet would be to take the php code you want to call directly from a template and create a plugin.

Writing A Plugin - 68 Classifieds
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
V4.1.x calling featured listings in carousel EnergyFreak Modules / Plugins / Modifications 0 04-14-2010 07:41 PM
Calling Extra Registration Fields bowers01 Technical Support 3 07-28-2008 10:18 AM
Calling URLs with title tags. seymourjames Modules / Plugins / Modifications 18 07-10-2008 10:17 AM
Calling category id and number Tim_A Templates, HTML, CSS, and Design Help 0 02-26-2007 10:15 AM


All times are GMT -4. The time now is 01:18 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0