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

system.verbs.builtins.radio.macros.linkToStyleSheet

on linkToStyleSheet (csspath, flUseImportCommand=false) {
	<<Changes
		<<9/15/04; 12:14:24 AM by LL
			<<Created. Generates a link to the CSS file defined.
	
	local (pta = html.getpagetableaddress ());
	local (flFileUrl = pta^.radioResponder.flSameMachine);
	
	if csspath beginswith "/" {
		csspath = string.delete (csspath, 1, 1)};
	local (f = user.radio.prefs.wwwfolder + string.replaceall (csspath, "/", file.getpathchar ()));
	bundle { //correct the case -- the static server is case-sensitive
		local (pc = file.getPathChar ());
		if system.environment.isMac { //MacOS -- convert to a filespec to fix the filename's character-case
			f = string (filespec (f))}
		else { //workaround for windows: use fileloop (f in f) {} to fix the filename's character-case
			fileloop (f in f) {}};
		csspath = string.replaceAll (string.delete (f, 1, sizeOf (user.radio.prefs.wwwfolder)), pc, "/")};
	local (url);
	if flFileUrl {
		url = html.getfileurl (f)}
	else {
		url = radio.upstream.getFileUrl (f)};
	
	local (linktext);
	if flUseImportCommand { //Netscape 4 can't see the style sheet in this case
		linktext = "<style type=\"text/css\">\r@import url(\"" + url + "\");\r</style>"}
	else {
		linktext = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + url + "\"></link>"};
	return (linktext)}



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.