Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Carl-Fredrik Johansson 3 posts 23 karma points
    Feb 17, 2011 @ 22:06
    Carl-Fredrik Johansson
    0

    Nested Masterpages doesnt show images on third level

    I have a problem!

    I have created a main Masterpage that contain some images, from that masterpage I've nested to another masterpage.

    If I create a page using the nested masterpage template on top level and second level the pictures are in the page but if I create a page under the second level the images from the main masterpage is not shown.

    Firstpage.aspx = Images OK

         Secondpage_UnderFirstPage.aspx = Images OK

                     Thirdpage_UnderSecondPage.aspx = Images Not OK

    Im not sure if the problem lays in the CSS or in the Template

    Thanks in advance

    Best Regards

    Carl from Sweden

    This is the code:

    __________________________________________________________

    Main Masterpage

    <%@ Master Language="C#" AutoEventWireup="true" %>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
        1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
      <head runat="server" >
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

        <link href="~/css/BIT_css.css" rel="stylesheet" type="text/css" />
            
    </head>
    <body>
    <div class="div_main">
      <div class="div_left_tab">
        <img src="Masterpages/Ram_Vanster.jpg" width="97" height="850" />
      </div>
      <div class="div_top_tab">
        <img src="Masterpages/Ram_Top.jpg" width="556" height="83" />
      </div>
      <div class="div_right_tab">
        <img src="Masterpages/Ram_hoger.jpg" width="97" height="850" />
      </div>
      <div class="div_logo_tab">
        <img src="Masterpages/Logo.jpg" width="94" height="21" />
      </div>
      <div class="div_link_tab">
        <a href="/home.aspx">HOME</a><umbraco:Macro Alias="BIT_top_navigation" runat="server"></umbraco:Macro>
      </div>
      <div class="div_bild_tab">
        <asp:Contentplaceholder id="Photo"  runat="server" >

        </asp:Contentplaceholder>
      </div>
      <div class="div_left_text_tab">
        <asp:Contentplaceholder id="Main"  runat="server" >

        </asp:Contentplaceholder>
      </div>
      <div class="div_right_text_tab">
        <asp:Contentplaceholder id="Sub"  runat="server" >
          <BIT_large_body_style>
            <br/>
          </BIT_large_body_style>
          
        </asp:Contentplaceholder>
      </div>
    </div>
    </body>
    </html>

    ________________________________________________________________________

    And the nested masterpage

    <%@ Master Language="C#" MasterPageFile="~/masterpages/BIT_Main.master" AutoEventWireup="true" %>

        <asp:Content ContentPlaceHolderID="Photo"  runat="server" >
          <img src='<umbraco:Item field="photo" runat="server"></umbraco:Item>'/>
        </asp:Content>

        <asp:Content ContentPlaceHolderID="Main"  runat="server" >
          <umbraco:Item runat="server" field="bodyText"/>
        </asp:Content>

        <asp:Content ContentPlaceHolderID="Sub"  runat="server" >
       
        </asp:Content>

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Feb 17, 2011 @ 22:13
    Jan Skovgaard
    0

    Hi Carl

    What images does not get listed?

    Those you refer to in the nested template? Or those you're referncing with the hardcoded path?

    If it's in the nested template then try adding recursive="true" to your umbraco:Item declaration so it looks like this:

          <img src='<umbraco:Item field="photo" runat="server" recursive="true"></umbraco:Item>'/>

    Hope this helps.

    /Jan

  • Carl-Fredrik Johansson 3 posts 23 karma points
    Feb 17, 2011 @ 22:35
    Carl-Fredrik Johansson
    0

    Oh Sorry, thank you for fast answer, the image in the nested page gets in place, its the "hardcoded path" images in the main masterpage which are not viewed for example   <img src="Masterpages/Ram_Vanster.jpg" width="97" height="850" />.

    If I view the source code of a page on the third level I can see that the path to the image is in place in the page, but the image is not viewed in the browser.

    I've noticed when I compare the source code from first and second level

    <link href="/css/BIT_css.css" rel="stylesheet" type="text/css" />

    but on the third level

    <link href="../css/BIT_css.css" rel="stylesheet" type="text/css" />

    I dont know if this means anything.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Feb 17, 2011 @ 22:43
    Jan Skovgaard
    0

    Hi Carl

    I had a suspicion that was the real issue...

    Ok, this should be simple to fix.

    Instead of     <link href="~/css/BIT_css.css" rel="stylesheet" type="text/css" /> you should use     <link href="/css/BIT_css.css" rel="stylesheet" type="text/css" /> (your CSS file is located in the CSS folder in the root folder, right?)

    And then also make absolute path for the images adding / as the first thing in the path. Like <img src="/Masterpages/Ram_Vanster.jpg" width="97" height="850" />

    This should help.

    /Jan

  • Carl-Fredrik Johansson 3 posts 23 karma points
    Feb 17, 2011 @ 23:06
    Carl-Fredrik Johansson
    0

    That worked! Thanks alot!

    //Carl

Please Sign in or register to post replies

Write your reply to:

Draft