Monday, November 08, 2010 at 12:05 AM.

system.verbs.builtins.radio.weblog.bloggerApi.rpcHandlers.getTemplate

on getTemplate (appkey, blogid, username, password, templateType) {
	<<Changes
		<<11/20/02; 4:58:32 PM by JES
			<<Entity-encode high-ascii characters.
		<<1/22/02; 6:17:41 PM by DW
			<<Created.
	local (templatename);
	radio.weblog.bloggerApi.checkUser (client, false, username, password);
	radio.weblog.bloggerApi.checkBlogid (blogid);
	
	on encode (s) {
		s = xml.entityEncode (s, false);
		return (s)};
	
	case string.lower (templateType) {
		"main" {
			templatename = "template"};
		"archiveindex" {
			scriptError ("Can't get the archiveIndex template because Radio sites do not have an archiveIndex template.")}}
	else { //error -- the template doesn't exist
		scriptError ("Can't get the " + templateType + " template because it doesn't exist.")};
	local (f, fname);
	fileloop (f in user.radio.prefs.wwwfolder) {
		fname = file.filefrompath (f);
		if fname beginswith "#" {
			fname = string.delete (fname, 1, 1);
			fname = string.nthfield (fname, ".", 1);
			if string.lower (fname) == templatename {
				return (encode (string (file.readwholefile (f)) ))}}};
	scriptError ("Can't get the " + templateType + " template because it doesn't exist.")}



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.