}
}
} else {
- // handle the purls
- var newPurlPath = mainPath+"/"+path.basename(purl.pathname.replace(/\/$/, ""))+".js";
+ // handle the purls... we taje the pathname, drop the beginning "/", then drop every after the next "/"
+ // so we end up with a purl of "abcd" from a url:
+ // http://host/abcd/qewr/asdf/asdf/asdf/asdf/asdf/
+ // and will load mainPath/abcd.js
+ var newPurlPath = mainPath+"/"+path.basename(purl.pathname.replace(/^\//, "").replace(/\/.*$/, ""))+".js";
console.log("attempting to require: ", newPurlPath);
try {
var newPurlClass = require(newPurlPath);
if(typeof purlClass.layout == "undefined") {
console.log("set via undefined");
- purlLayout = layouts.standard();
+ purlLayout = layouts.standard(request, response);
} else {
// find and resolve the layout
- purlLayout = purlClass.layout();
+ purlLayout = purlClass.layout(request, response);
}
// now we should have a layout and a class