Unused template causing compiler error [message #24717] |
Wed, 11 May 2005 17:38 |
petej74
Messages: 5 Registered: January 2005
Karma: 0
|
Junior Member |
|
|
Running FUDforum 2.6.12...
Seems that removing all references to the "curtime" template in the default theme caused the template compiler to throw an error.
No source for curtime.tmpl
Poking around in the logic and playing with a theme that still contained curtime references revealed that there may be a logic error here.
If a template like "curtime" that doesn't have a src component is referenced before it is processed, then when resolve_compile() below is called, the file will already exist in the cache and will be ignoed.
If the template isn't referenced, then resolve_compile() below will try to compile it. When it finds that there is no src component (which seems perfectly valid for curtime.tmpl), it exits w/error. Changing the exit() call to a return() call fixed the issue for now without any visible side effects, but maybe I'm misunderstanding something here?
Here's the relevant code from include/compiler.inc...
593 resolve_compile($file);
594 if (isset($GLOBALS['file_cache'][$file]['inline'])) {
595 continue;
505 function resolve_compile($file)
506 {
507 if (isset($GLOBALS['file_cache'][$file])) {
508 return;
509 }
510 resolve_refs($file, $file);
511 resolve_inc_refs($file);
512 if (empty($GLOBALS['file_cache'][$file]['src'])) {
513 exit('No source for '.$file);
514 }
515
516 $GLOBALS['file_cache'][$file]['compiled'] = compile_file($GLOBALS['file_cache'][$file]['src']);
517 }
[Updated on: Wed, 11 May 2005 17:44] Report message to a moderator
|
|
|
|
|
Re: Unused template causing compiler error [message #24749 is a reply to message #24748] |
Thu, 12 May 2005 22:00 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
Move it to a different directory, keeping unused template in the "active" directory is a bad idea anyway. You end up wasting processing time pointlessly compiling that template.
As far as the particular fix for this instance of a bug, your solution is not quite right and I will be looking at an alternative when I am back in the office.
FUDforum Core Developer
|
|
|
|
|
|