Hi,
tried your (very interesting) solution but couldn't get it to work... I have the following function in the eform.inc.php, already with your code but not sure if it's implemented right...
When I try it as above with a eForm Call like:
[!eForm? &formid=`tell_form` &subject=`Tell Tickets` &from=`mailaddrfrom` &to=`mailaddrto` &sendAsHTML=`1` &tpl=`@FILE:assets/templates/.../forms/tell/tell-tpl.html` &report=`@FILE:assets/templates/.../forms/tell/tell-email.html` &thankyou=`@FILE:assets/templates/.../forms/tell/tell-thanks.html`!]
it just says: @FILE:assets/templates/capitalfm/forms/tell/tell-tpl.html
where the form would be...seems to be broken somewhere but I don't see it^^
function efLoadTemplate($key){
global $modx;
if( strlen($key)>50 ) return $key;
$tpl = false;
if( is_numeric($key) ) { //get from document id
//try unpublished docs first
$tpl = ( $doc=$modx->getDocument($key,'content',0) )? $doc['content'] :false;
if(!$tpl )
$tpl = ( $doc=$modx->getDocument($key,'content',1) )? $doc['content'] : false;
} elseif ($key) {
//Mod to read template chunks out of external files per @FILE
$fpos = strpos($key, '@FILE');
if ($fpos !== false) { //Eol: get from file
$tpl = file_get_contents($modx->config['base_path'].trim(substr($key, $fpos+5)));
} else {
$tpl = ($doc=$modx->getChunk($key)) ? $doc : false;
}
//elseif( $key ){
//$tpl = ( $doc=$modx->getChunk($key) )? $doc : false;
//try snippet if chunk is not found
if(!$tpl) $tpl = ( $doc=$modx->runSnippet($key) )? $doc : false;
}
return $tpl;
}
thanks for any help!
EDIT: I think it's something around the last few lines after the commented-out //elseif the last } should somehow be commented out too but when I do it I get a syntax error...tried different things but I dont get it =/