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

Home » Imported messages » comp.lang.php » empty __FILE__ in quercus
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
empty __FILE__ in quercus [message #169672] Wed, 22 September 2010 12:45 Go to next message
Thorsten Kiefer is currently offline  Thorsten Kiefer
Messages: 1
Registered: September 2010
Karma: 0
Junior Member
Hi,
I use quercus through the java scripting api.
My problem is that I cannot set the __FILE__ constant.
I tried to set it in the bindings and in the ScriptContext.
Neither works.
Is there a way to tell quercus the file path throught the scripting api ?

Best Regards
Thorsten
Re: empty __FILE__ in quercus [message #169674 is a reply to message #169672] Wed, 22 September 2010 13:47 Go to previous messageGo to next message
Erwin Moller is currently offline  Erwin Moller
Messages: 228
Registered: September 2010
Karma: 0
Senior Member
On 9/22/2010 2:45 PM, Thorsten Kiefer wrote:
> Hi,
> I use quercus through the java scripting api.
> My problem is that I cannot set the __FILE__ constant.
> I tried to set it in the bindings and in the ScriptContext.
> Neither works.
> Is there a way to tell quercus the file path throught the scripting api ?
>
> Best Regards
> Thorsten

Hi,

Are you sure you should be able to set that 'magic constant'?
I wouldn't know how to change its value using 'normal' PHP.
Many of these constants change during the script execution, so I am
unsure what it means that you set them.
(See the __LINE__ example below from the php website.)

And many of these magic constants are produced by the environment of PHP.

http://php.net/manual/en/language.constants.predefined.php
==============================================================
PHP provides a large number of predefined constants to any script which
it runs. Many of these constants, however, are created by various
extensions, and will only be present when those extensions are
available, either via dynamic loading or because they have been compiled
in.
There are seven magical constants that change depending on where they
are used. For example, the value of __LINE__ depends on the line that
it's used on in your script.
==============================================================

If PHP/quercus cannot fix it for you, you could maybe use something like
$_SERVER["SCRIPT_NAME"] instead.
But that would mean you have to change the PHP scripts of course...

Or maybe you better ask the quercus developers.

Just my 2 cent.
Good luck.

Regards,
Erwin Moller

--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
Re: empty __FILE__ in quercus [message #169678 is a reply to message #169672] Wed, 22 September 2010 15:47 Go to previous message
alvaro.NOSPAMTHANX is currently offline  alvaro.NOSPAMTHANX
Messages: 277
Registered: September 2010
Karma: 0
Senior Member
El 22/09/2010 14:45, Thorsten Kiefer escribió/wrote:
> I use quercus through the java scripting api.
> My problem is that I cannot set the __FILE__ constant.
> I tried to set it in the bindings and in the ScriptContext.
> Neither works.
> Is there a way to tell quercus the file path throught the scripting api ?

I've never heard about Quercus but according to Google it appears to be
a PHP interpreter written in Java.

Whey you say "set", is it a typo or do you really mean so?

In the original PHP specification, you cannot modify constants after
they've been defined. And __FILE__ is a magic constant: it's not really
"constant" (its value changes depending on the file where it's read) but
it's already set for you by PHP.

If you actually meant "get", then it's an entirely different issue I
have no clue about, sorry.


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Feed RSS and accented and other special chars
Next Topic: How do we manage large code sets in PHP?
Goto Forum:
  

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

Current Time: Thu Nov 28 23:47:03 GMT 2024

Total time taken to generate the page: 0.02602 seconds