Thursday, March 17, 2011 at 10:04 AM.

scripting2Suite.server.getBaseUrl

on getBaseUrl (username) {
	<<Changes
		<<3/16/11; 4:05:46 PM by DW
			<<If using staticText method, add the username at the end of the url.
		<<3/16/11; 3:01:18 PM by DW
			<<Transitioning to the new staticText way of managing stuff.
		<<7/10/10; 5:07:30 AM by DW
			<<Get the url of the home page of the user's blog.
	local (adrdata = scripting2suite.inituser (username), baseurl);
	local (adrsystemdata = scripting2suite.init ());
	if adrsystemdata^.prefs.statictext.prefs.enabled {
		local (adrloc);
		for adrloc in @adrsystemdata^.prefs.statictext.locations {
			if adrloc^.prefs.enabled and adrloc^.prefs.flDefault {
				if adrdata^.prefs.flBlogInRootDirectory {
					return (adrloc^.prefs.url)}
				else {
					return (adrloc^.prefs.url + username + "/")}}};
		scripterror ("Can't get the baseurl for the site because there is no default \"staticText\" location.")}
	else {
		if adrdata^.prefs.ftp.enabled {
			baseurl = adrdata^.prefs.ftp.url}
		else {
			if adrsystemdata^.prefs.ftp.enabled {
				baseurl = adrsystemdata^.prefs.baseurl + username + "/"}
			else {
				if adrdata^.prefs.localfolder.enabled {
					baseurl = adrdata^.prefs.localfolder.url}
				else {
					baseurl = adrsystemdata^.prefs.localfolder.url}}};
		return (baseurl)}};
		<<old code
			<<if adrdata^.prefs.ftp.enabled
				<<return (adrdata^.prefs.ftp.url)
			<<else
				<<local (adrsystemdata = scripting2suite.init ())
				<<return (adrsystemdata^.prefs.ftp.baseurl + username + "/")
bundle { //test code
	dialog.alert (getbaseurl ("amyloo"))}



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.