| Ticket UUID: | 970878 | |||
| Title: | Ability to add stylesheet | |||
| Type: | RFE | Version: | None | |
| Submitter: | coldstore | Created on: | 2004-06-11 05:06:41 | |
| Subsystem: | html | Assigned To: | welch | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2006-06-14 05:19:00 | |
| Resolution: | Closed By: | andreas_kupries | ||
| Closed on: | 2006-06-13 22:19:00 | |||
| Description: |
Something like the following would enable people to add
stylesheets, which would be a good thing.
proc ::html::stylesheet {href} {
variable page
lappend page(meta) "<link rel='stylesheet'
type='text/css' href='$href'>"
return ""
}
| |||
| User Comments: |
andreas_kupries added on 2006-06-14 05:18:59:
Logged In: YES user_id=75003 Committed the implementations, after reworking them to be a bit simpler. I am bailing out on the javascript-in-body issue. sigzero added on 2006-06-14 03:20:15: Logged In: YES user_id=1339209 Addendum: For the html::js (and I am not sure how) it needs to know whether it is in the <head> section or the <body> section I am thinking. You don't embed a .css file in the body of the html but you *can* with .js files. robert_hicks added on 2006-05-25 04:08:34: Logged In: YES
user_id=1528214
I would like this added as well plus a way to add a
javascript script. I have coded the following and tested
using TclHttpd server.
# ::html::css
#Create the text/css tag and tuck it away for usage
#
# Arguments:
#hrefThe location of the css file to include the filename
and path
#
# Results:
#HTML for the section
proc ::html::css {href} {
variable page
::set html ""
append html "<link rel=\"stylesheet\" type=\"text/css\"
href=\"[quoteFormValue $href]\">\n"
lappend page(css) $html
return ""
}
# ::html::js
# Create the text/javascript tag and tuck it away for usage
#
# Arguments:
#hrefThe location of the javascript file to include the
filename and path
#
# Results:
#HTML for the section
proc ::html::js {href} {
variable page
::set html ""
append html "<script language=\"javascript\"
type=\"text/javascript\" src=\"[quoteFormValue
$href]\"></script>\n"
lappend page(js) $html
return ""
}
I then changed the ::html::head section to include these
like meta tags:
# ::html::head
#
#Generate the <head> section. There are a number of
#optional calls you make *before* this to inject
#meta tags - see everything between here and the bodyTag proc.
#
# Arguments:
#titleThe page title
#
# Results:
#HTML for the <head> section
proc ::html::head {title} {
variable page
::set html "[openTag html][openTag head]\n"
append html "\t[title $title]"
::if {[info exists page(author)]} {
append html "\t$page(author)"
}
::if {[info exists page(meta)]} {
::foreach line $page(meta) {
append html "\t$line\n"
}
}
::if {[info exists page(css)]} {
::foreach style $page(css) {
append html "\t$style\n"
}
}
::if {[info exists page(js)]} {
::foreach script $page(js) {
append html "\t$script\n"
}
}
append html "[closeTag]\n"
}
| |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki