For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > November 2004 > default_template_handler_func example in docs not working









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author default_template_handler_func example in docs not working
Dc

2004-11-23, 3:59 pm

hi everyone.

when i try to use the default template handler function to write templates
on the fly...

(as suggested in the docs at:

http://smarty.php.net/manual/en/template.resources.php

), smarty tells me that _write_file() doesn't exist with error:

Fatal error: Call to undefined function: _write_file()

I copied the function:

function
make_template($resource_type,$resource_n
ame,&$template_source,&$template_tim
estamp,&$smarty_obj){
if($resource_type=='file'){
if(!is_readable($resource_name)){
// create the template file, return contents.
$template_source = "This is a new template.";
$template_timestamp = time();
// there seems to be a problem with this write_file function
$smarty_obj-> _write_file($resource_name,$template_sou
rce);
return true;
}
}else{
// not a file
return false;
}
}

I couldn't find the _write_file function anywhere in my smarty source code.

I am using version 2.5.0 so I wonder if that has anything to do with this
error. but, I checked the change log for anything that looked relevant and I
didn't see anywhere that _write_file had been renamed. I also checked the
core files and found other write_file functions, but none seemed easily
adaptable to this technique.

Any one using this technique and or this code? Is there an easy answer or
debug path I should follow?

Thx,
dan
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com