Project

General

Profile

lighty.env variables in Lua

Added by mischa almost 14 years ago

Hi All,

In almost all the Lua examples the same lighty.env variables are always returned in the same way.
I am trying to understand why it is the way it is. Can someone shed some light on this?
Why is the following example:

if (attr) then
lighty.env["uri.path"] = lighty.env["uri.path"] .. ".php"
lighty.env["physical.rel-path"] = lighty.env["uri.path"]
lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
end

Not just:

if (attr) then
lighty.env["uri.path"] = lighty.env["uri.path"] .. ".php"
lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["uri.path"]
end

Which variables need to be set when rewriting urls?

Thanx!


Replies (1)

RE: lighty.env variables in Lua - Added by mischa almost 14 years ago

I have deconstructed drupal.lua at http://high5.net/n/prettyurl/here but it's still unclear to me why "lighty.env["physical.rel-path"]" and "lighty.env["request.orig-uri"]" are set.

if (not file_exists(lighty.env["physical.path"])) then
-- file still missing. pass it to the fastcgi backend
request_uri = removePrefix(lighty.env["uri.path"], prefix)
if request_uri then
lighty.env["uri.path"] = prefix .. "/index.php"
local uriquery = lighty.env["uri.query"] or ""
lighty.env["uri.query"] = uriquery .. (uriquery ~= "" and "&" or "") .. "q=" .. request_uri
lighty.env["physical.rel-path"] = lighty.env["uri.path"]
lighty.env["request.orig-uri"] = lighty.env["request.uri"]
lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
end
end

Anybody some insight?

    (1-1/1)