Monday, November 08, 2010 at 12:03 AM.
system.verbs.builtins.html.getSiteFolder
on getSiteFolder (adrPageTable) {
<<Return the folder path for the root of this site.
<<If there is no folder specified, return a path in the Websites or Temporary Items folder.
<<Thursday, May 21, 1998 at 1:31:24 AM by PBS
<<Changes:
<<Saturday, May 30, 1998 at 5:24:36 PM by PBS
<<Support for ftpSite subtables named after templates.
<<06/17/00; 7:43:14 PM by PBS
<<If this is a dynamic page, don't create the Websites folder or a folder for this site on disk.
try {return (adrPageTable^.siteRootFolder)};
local (adrFtpSite = html.getSiteTable (adrPageTable));
local (templateName = html.getCurrentTemplateName (adrPageTable));
local (flPreview = (defined (adrPageTable^.flPreview) and adrPageTable^.flPreview));
local (folder);
if not flPreview {
if templateName != "Default" {
try {folder = adrFtpSite^.[templateName].folder};
try {table.assign (@folder, adrFtpSite^.[templateName].folder ())}}; //it might be a script
if folder == nil {
try {folder = adrFtpSite^.folder};
try {table.assign (@folder, adrFtpSite^.folder ())}}}; //it might be a script
if folder == nil { //get Websites folder or Temporary Items folder
if string.lower (adrPageTable^.fileWriter) == "file" {
local (flCreate = true);
if defined (adrPageTable^.requestHeaders) { //PBS 06/17/00: don't create Websites folder if this is a dynamic page
flCreate = false};
folder = html.getWebsitesFolder (flCreate)}
else {
case sys.os () {
"WinNT";
"Win95" {
folder = file.getSpecialFolderPath (file.getSystemDisk (), "Temp", true)};
"MacOS" {
folder = file.getSpecialFolderPath (file.getSystemDisk (), "Temporary Items", true)}}};
local (siteName = nameOf (adrPageTable^.adrSiteRootTable^));
if file.exists (siteName) and siteName contains file.getPathChar () { //the root is a guest database
siteName = file.fileFromPath (siteName);
if string.lower (siteName) endsWith ".root" {
siteName = string.mid (siteName, 1, sizeOf (siteName) - 5)}};
if string.lower (siteName) != "websites" {
folder = folder + siteName};
if not defined (adrPageTable^.requestHeaders) { //PBS 06/17/00: don't create folder if this is a dynamic page
file.sureFolder (folder)}};
if not (folder endsWith file.getPathChar ()) {
folder = folder + file.getPathChar ()};
adrPageTable^.siteRootFolder = folder; //save folder in page data table
return (folder)}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.