+1-888-365-2779
Try Now
More in this section

Forums / Set-up & Installation / Style Sheet Change

Style Sheet Change

4 posts, 0 answered
  1. mexner
    mexner avatar
    98 posts
    Registered:
    06 Apr 2006
    28 Jun 2007
    Link to this post
    Hello,

    Just downloaded and installed v3.0 SP 1.  And I followed the instructions to replace the BIN and SiteFinity folder.

    Our client has requested that the site we develop be ADA compliant which means we need to be able to switch our style sheets, like this.

    I've attempted this from several different angles and have arrived at the conlusion that I can't complete this inside Sitefinity right now.....I'm hoping you might have some other ideas.

    Thought #1:
    Inside SF, Select a template, Click on Properties, and add the neccessary HEAD tags.  After doing this many times, it appears that this functionality is NOT working.  Whatever I put in the HEAD tags, never renders in the page output.

    Thought #2:
    Create a custom user control with the neccessary javascript and links to the appropriate style sheets.  The problem with this approach is that the style sheets MUST be in a certain order.  The default ( or main style sheet) must go FIRST, then the alt style sheet, then the java script.

    No matter how/where I place my control in the HEAD, sitefinity always renders the default style sheet AFTER my control.

    So I'm kinda stuck in that I can't add code to the HEAD section in the way I need to for ADA compliance.

    Any suggestions? Or when this will be fixed?
    Thanks!
  2. Bob
    Bob avatar
    330 posts
    Registered:
    24 Sep 2012
    28 Jun 2007
    Link to this post
    Hi Chris,

    Indeed, adding head tags within templates is not working. Though you can add head tags at the page level. Another alternative is to declare the head links in the master page markup. We will fix it for the next release.

    Thank you for reporting this issue, your Telerik account has been updated.

    Sincerely yours,
    Bob
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. mexner
    mexner avatar
    98 posts
    Registered:
    06 Apr 2006
    28 Jun 2007
    Link to this post
    Thanks for the reply Bob. 

    Is their any method for me to access (programatically) the head links in the master page?

    I know I can add whatever static text I wish into the head on the master page...but the problem is that SF will dynamically add the theme info (style sheet) immediately before the closing head tag and AFTER all my markup in the head section.

    I need to find a way to insert my code immediately before the closing head tag, and after SF's code.

    Is this possible?

    ---
    <head>
    site finity inserts theme code here....(auto)
    insert my custom code here
    </head>

    Thanks bob!
  4. Bob
    Bob avatar
    330 posts
    Registered:
    24 Sep 2012
    29 Jun 2007
    Link to this post
    Hello Chris,

    Of course you can add and remove controls from the header of page programmatically. I suppose this how you did it in your user control. Unfortunately, there is no easy way to control the order in which the child controls are rendered. Below is the reflected implementation of RenderChildren method of System.Web.UI.HtmlControls.HtmlHeader control:

    protected internal override void RenderChildren(HtmlTextWriter writer)  
    {  
        base.RenderChildren(writer);  
        if (this._title == null)  
        {  
            writer.RenderBeginTag(HtmlTextWriterTag.Title);  
            if (this._cachedTitleText != null)  
            {  
                writer.Write(this._cachedTitleText);  
            }  
            writer.RenderEndTag();  
        }  
        if (this.Page.Request.Browser["requiresXhtmlCssSuppression"] != "true")  
        {  
            this.RenderStyleSheet(writer);  
        }  
    }  
     
     


    As you can see, all child controls are rendered first and then the title is written to the output stream. Also, all style sheets form themes are handled by ASP.Net not Sitefinity. So the only way to control how the head is rendered is to implement a control adapter for HtmlHeader control. Please see MSDN documentation for reference on how to implement control adapters.

    By the way, there is no web standard that regulates the order of the tags in the head. I really don’t see why you need the links to be after the title element and in a particular order. I looked at the JavaScript and the function setActiveStyleSheet disables all style sheets except the one specified in the parameter. I’m not sure if this is desirable as usually multiple style sheets are defined for a page.

    Though, this sounds like a good feature for Sitefinity and we will consider providing an easy way of adding alternate style sheets.


    Sincerely yours,
    Bob
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
4 posts, 0 answered