views:

197

answers:

2

The error I'm receiving is: Type mismatch: 'stylesheets'

Stylesheets is defined as:

sub stylesheets(collection)
    for each key in collection.Keys
     response.write(stylesheet(key, collection.Item(key)))
    next
end sub

' returns a link tag for each object in the collection
function stylesheet(asset, media_type)
    if (media_type="") then
     media_type="screen"
    end if
    return "<link href=""" & asset_url(asset) & """ type=""text/css"" media=""" _
        &  media_type & """ />"
end function

And it is being called as such:

<% stylesheets(site_stylesheets) %>

Where site_stylesheets has been defined as:

' stylesheets is a collection of the stylesheets to be included on all pages
Set site_stylesheets = CreateObject("Scripting.Dictionary")
site_stylesheets.Add "css/endoworks.css", "screen"

It has been a long time since I've done any VBScript-ing. I'd really appreciate any help.

A: 

Try removing the parenthesis when calling stylesheets. see this question for more information. I don't think you can use parenthesis when calling a sub with only one parameter.

Try this

<% stylesheets site_stylesheets %>

or this

<% call stylesheets(site_stylesheets) %>
Tester101
A: 

I ended up just placing the loop logic from stylesheets into the header sub[routine]. It works fine now.

@Tester101: I tried your suggestions, but they didn't fix the problem.

Edit: I actually discovered that I had a stylesheets argument in the header subroutine which is where the stylesheets sub was called. So it was trying to execute nothing with an argument of site_stylesheets. Can't believe I missed that.

sholsinger