FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » FUDforum 3.0+ » Bug in compiler.inc?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Bug in compiler.inc? [message #6145] Thu, 03 October 2002 18:40 Go to next message
holstein   Canada
Messages: 9
Registered: August 2002
Location: Montreal
Karma: 0
Junior Member
I think I've found a bug in the function resolve_refs in the file compiler.inc.

I tried to add a new template to isolate the login procedure (but leave the actual template alone, so that if something go wrong with my code, users will fall out on fud login procedure). I saw that compile_all read files from ['DATA_DIR'].'/thm/default/tmpl', so I put my duplicate template there. But it was not parsed until I changed this :

- - -8<- - -
else if (! is_file($file2) ) {
if ( defined('debug') )
echo "opening $file1 to resolve refs<br>\n";
$str = filetomem($file2);
$GLOBALS['CURFILE'] = $file2;
}

TO ;
else if ( is_file($file2) ) {
<snip>
- - -- 8<- -

Judging by the debug message, I guessed that this is what was in effect intended.

Is that right?

I've come to this because I want to merge the login phase for my site with the login for fudforum. I digged around and I figure that the best way was to duplicate the file .../forum_data/src/login.php.t and have it wrap-up the actual login checking/cookie setting in a function I could call from my code. I came to duplicate the login.tmpl file because I could not make :
{PHP_FILE: input: login.php.t; output: login.php;}
{PHP_FILE: input: my_login.php.t; output: my_login.php;}

to work. Is it because it is not possible to call PHP_FILE twice in template? It still does not work with my modification to resolve_refs. my_login.php is generated only when call from a different .tmpl file.


Is there a simpler way to achieve what I want to do, ie be able to set the fud cookies from my code? I bet that I am not the only one who is interested in this...

Thanks for any help
Re: Bug in compiler.inc? [message #6148 is a reply to message #6145] Thu, 03 October 2002 23:30 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
That is indeed a bug, thank you for reporting it, the fix is in the latest CVS.

You should only use the '{PHP_FILE: input: my_login.php.t; output: my_login.php;}' once. This directive tells the template compiler that the source script 'my_login.php.t' should be used in combination with the currently opened template to build 'my_login.php'. If you wish to include the source code of other files (.inc.t files) use the {REF: file_name.tmpl} parameter.


FUDforum Core Developer
Re: Bug in compiler.inc? [message #6164 is a reply to message #6148] Fri, 04 October 2002 13:50 Go to previous messageGo to next message
holstein   Canada
Messages: 9
Registered: August 2002
Location: Montreal
Karma: 0
Junior Member
Does the {REF: file_name.tmpl} tag will also force a file to be compiled?
And when you say "[PHP_FILE is] used in combination [..]to build..", you mean that the file won't be include, but in fact "merge" in the template? So this is a way to "embed" the called file in the template, vs. REF that is translate in a PHP include call?

The main purpose of all this is to be able to set the cookies need by Fud into my code : does the way I want to do it seems "clean" from the point of view of a developper? Like I said, I suspect that maybee someone else could want to do this, so if my solution is clean enough for you, I would happily send you my patch.

Thanks a lot for your help!
Re: Bug in compiler.inc? [message #6170 is a reply to message #6164] Fri, 04 October 2002 16:01 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
{REF: file_name.tmpl} neans that the source of file_name.inc.t will be inlined into the current file.
So, if you need to use cookies, you need to add {REF: cookies.tmpl} into your .tmpl file.


FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Question: Message counter
Next Topic: Member count decreasing
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 18:47:01 GMT 2024

Total time taken to generate the page: 0.03088 seconds