Forum OpenACS Development: can use variable ::template::head::links ?

I'm trying to read all the css files added into a page, so that I can generate a list with all css involved in creating that page.

Looking how template::head::prepare_multirows does it, I'm using variable ::template::head::links, but it seems to return an empty array.

Can I use that variable, or any other method?

Collapse
Posted by Dave Bauer on
Hmmm. yes you should be able to access it. The question is whether this array is populated when you are looking for it.
Collapse
Posted by Michael Cordova on
I have found 2 issues in head-procs.tcl:

  1. links content is deleted after being used, as a trick, in order not to use them later... :

    line 479: set links($name) ""

    ...

    line 488: if {$links($name) ne ""} {

    "later" means the next block where only alternate stylesheets are processed

    I think it's more clear to change the second if from this:

    if {$links($name) ne ""} {
    to this:
    if {$links($name) eq "alternate stylesheet"} {

  2. The array links is removed at the end of the script

    line 501: unset links

I have changed that lines in my code, and now I can access to ::template::head::links.

Collapse
Posted by Dave Bauer on
Ok, we HAVE to delete the namespace variables or you will be weird bugs.

I am not sure what you are trying to accomplish to reuse those variables. Perhaps you code should run before the multirow call?

Collapse
Posted by Michael Cordova on
What I can to do is activate the CSS button of the developer support toolbar. I use a lot this toolbar, and I work a lot with CSS. So, I find very useful this button for development stages.