Jump to content

how to load or call php file in tpl?


Recommended Posts

Hi 

 

i have php code that i need to load in header.tpl, my code is an native way of coding style. now i put it under controllers and my question is how do i call my php code into my tpl same as like include?

 

 

shop/controllers/front ->mycode.php

 

shop/themes/default-bootstrap/->header.tpl

Link to comment
Share on other sites

i have php file function for visitors that i need to link it into tpl, and i place the php file into shop/controllers/front ->visitors.php  and i dont know if it is correct. and now i have no idea how to get the said function from php that i need to link in tpl file. shop/themes/default-bootstrap/->header.tpl

 

 

please any idea for it, and i really2x need you each help..

Edited by jaysondotph (see edit history)
Link to comment
Share on other sites

you can use your code as a static function in FrontController

 

you can create there function:

 

public static function myFunction(){

// your php code 

return "value";

}

 

then in header tpl you can use:

 

{FrontController::myFunction()}

 

you will see there result of your myFunction :) (return value)

Link to comment
Share on other sites

Hi vekia, i notice that there are two redundant output instead one. i wright my code something like this

 

php controller:

public static function ocs_visitors()
	{
	  return include 'visitors.php';
	}

header.tpl

{IndexControllerCore::ocs_visitors()}

and what is the possible solution on this or what is the cause of this kind of error? 

Link to comment
Share on other sites

×
×
  • Create New...