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

Forums / Developing with Sitefinity / How to call cufons in master page

How to call cufons in master page

9 posts, 0 answered
  1. sweety
    sweety avatar
    28 posts
    Registered:
    28 Jun 2010
    19 Jul 2010
    Link to this post
    Dear Reader

    I am new in sitefinity, and I have to call cufons in master page and have to call png fix js for IE so how I will call these js in master page.In html cufons and ie fix is working properly.But in Master page how it will called..Pleae suggest...

    I have to call these code in master page...

    <!--[if IE]><link rel="stylesheet" type="text/css" href="common/css/ie.css"><![endif]-->
    <script type="text/javascript" src="common/js/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="common/js/cufon-yui.js" ></script>
    <script type="text/javascript" src="common/js/Avenir_LT_Std_400.font.js"></script>
    <script type="text/javascript" src="common/js/Avenir_LT_Std_700.font.js"></script>
    <script type="text/javascript" src="common/js/Myriad_Pro_700.font.js"></script>
    <script type="text/javascript">
                Cufon.replace(['.rcg_onyx .image_section a'], {fontFamily: 'Avenir LT Std', hover: true});
                Cufon.replace(['.rcg_onyx .image_section .label p '], {fontFamily: 'Avenir LT Stdbold', hover: true});
                Cufon.replace(['#menu ul li a '], {fontFamily: 'Myriad Pro', hover: true});
    </script>
  2. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    19 Jul 2010
    Link to this post
    Hi Sweety,

    You can use the Sitefinity JsLink.

    1. First put this inside your masterpage:
    <%@ Register Assembly="Telerik.Cms.Web.UI" Namespace="Telerik.Cms.Web.UI" TagPrefix="sf" %>

    2. Between the <body> tags put these:
    <sf:JsFileLink ID="lnkMain" runat="server" FileName="~/Assets/Js/main.js" />

    You could also use the <telerik:RadScriptManager>.
    Between the <body> tags insert this:
    <telerik:RadScriptManager ID="scriptManager" runat="server">
       <Scripts>
          <asp:ScriptReference Path="~/Assets/js/main.js" />
       </Scripts>
    </telerik:RadScriptManager>

    As for the Cufon: I'm having better experience with the FontSquirrel generator. Works much better for me!
    http://www.fontsquirrel.com/fontface/generator

    Regards,
    Daniel
  3. sweety
    sweety avatar
    28 posts
    Registered:
    28 Jun 2010
    19 Jul 2010
    Link to this post
    Dear Reader

    I got the following error,Please help...

    Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: The server tag is not well formed.

    Source Error:

    Line 13: </head>
    Line 14: <body>
    Line 15: <sf:JsFileLink ID="lnkMain"runat="server"FileName="~/App_Themes/rcg_pe3/js/jquery-1.3.2.min.js">
    Line 16:     <form id="form1" runat="server">
    Line 17:     <asp:ScriptManager ID="ScriptManager1" runat="server">
  4. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    19 Jul 2010
    Link to this post
    Just make sure you have add space between the attributes and u end the tag with /> or SIMPLY copy paste what Daniel posted for you
  5. sweety
    sweety avatar
    28 posts
    Registered:
    28 Jun 2010
    19 Jul 2010
    Link to this post
    Thanx for reply...

    its working..

    Can you help me in a one more thing..i have to call png fix in my master file.For this I have to call a conditional css for IE, but its not working I have write the following line in head tag...please suggest if its wrong.
    <!--[if IE]><link rel="stylesheet" type="text/css" href="~/App_Themes/rcg_pe3/ie.css"><![endif]-->

    In ie.css i am calling a js in this manner

    .png {behavior: url("~/App_Themes/rcg_pe3/Js/iepngfix.htc")}

    So please suggest this code is not working, so how can I add a css for IE...and how can I use the png fix for my site.
  6. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    19 Jul 2010
    Link to this post
    Hi Sweety,

    You are using this link:
    <!--[if IE]><link rel="stylesheet" type="text/css" href="~/App_Themes/rcg_pe3/ie.css"><![endif]-->

    Which wil not work because you didn't add 'runat="server"'.

    So use this instead:

    <!--[if IE]><link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/rcg_pe3/ie.css"><![endif]-->

    Regards,
    Daniel
  7. sweety
    sweety avatar
    28 posts
    Registered:
    28 Jun 2010
    19 Jul 2010
    Link to this post
    No sir
    Its not working
    I am using the following code in head tag,May be I am missing something else please suggest...

    <head runat="server">
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <!--[if IE]><link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/rcg_pe3/ie.css" ><![endif]-->    
    </head>

  8. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    Registered:
    18 Feb 2004
    19 Jul 2010
    Link to this post
    Try it with a correct closing tag:

    <!--[if IE]><link rel="stylesheet" type="text/css" runat="server" href="~/App_Themes/rcg_pe3/ie.css" /><![endif]-->

    Regards,
    Daniel
  9. George
    George  avatar
    204 posts
    Registered:
    05 Sep 2006
    19 Jul 2010
    Link to this post
    A simple alternative is to add the following in the code behind of your master page

    protected void Page_Load(object sender, EventArgs e)
    {
          if (Request.Browser.Browser.ToLower() == "ie")
        {
            var link = new HtmlLink { Href = "~/App_Themes/rcg_pe3/ie.css" };
            link.Attributes.Add("rel", "stylesheet");
            link.Attributes.Add("type", "text/css");
            Page.Header.Controls.Add(link);
        }
    }


    Best,

    G
Register for webinar
9 posts, 0 answered