Copied to clipboard

Flag this post as spam?

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


  • Zlaja 12 posts 32 karma points
    Jan 28, 2014 @ 17:53
    Zlaja
    0

    Can't show child content placeholder in parent. Why?

    Hi,

    Can anyone help me to fix my problem. My problem is like in shown in my code I can't show content from child in parent:

    <asp:Content ContentPlaceHolderId="ContentPlace" runat="server">

    <h1>Biografi</h1>

    <article>

    <asp:ContentPlaceHolder Id="smalltext" runat="server">

    <!-- Insert default "smalltext" markup here -->

    </asp:ContentPlaceHolder>

    </article>

    </asp:Content>

    Sub child:

    <asp:Content ContentPlaceHolderId="smalltext" runat="server">

    <h6>Begginigs</h6>

    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vestibulum molestie lacus. Aenean nonummy hendrerit mauris. Phasellus porta. Fusce suscipit varius mi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vestibulum molestie lacus. Morbi nunc odio, gravida at, cursus nec, luctus a, lorem. Maecenas tristique orci ac sem.</p>

    </asp:Content>

    I want that my article is dynamical, and can reuse "smalltext" template more then ones.

    Hope that was enough clearly what I want.

    Thanks for help.

    Zlaja

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 28, 2014 @ 19:12
    Fuji Kusaka
    0

    Hi Zlaja,

    You need to make use of the Insert Umbraco Page Field within the placeholder

    <umbraco:Item field="smallText" stripParagraph="true" runat="server" />

    Or if you want to make use of Inline Razor

    <umbraco:Macro runat="server" language="cshtml">
            @{
                @Library.StripHtml(Model.smallText, "pre")
       }
        </umbraco:Macro>

    Last thin if you want to make use of the same template, go to the settings section under your docType > Allowed  Templates. Then on your node change the template under properties.

    Hope this is what your after

     

    //fuji

  • Zlaja 12 posts 32 karma points
    Jan 29, 2014 @ 10:59
    Zlaja
    0

    Hi Fuji

    Thanks a lot

    I'am newbie with umbraco, I tried your solutions but can't still fix this. I send you a new code so you can see if I do right.

    <asp:Content ContentPlaceHolderId="ContentPlace" runat="server">

    <h1>Biografi</h1>

    <article>

    <umbraco:Item field="smalltext" stripParagraph="true" runat="server" />

    </article>

    </asp:Content>

     

    subpages is still same.

    <asp:Content ContentPlaceHolderId="smalltext" runat="server">

    <h6>Begginigs</h6>

    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vestibulum molestie lacus. Aenean nonummy hendrerit mauris. Phasellus porta. Fusce suscipit varius mi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vestibulum molestie lacus. Morbi nunc odio, gravida at, cursus nec, luctus a, lorem. Maecenas tristique orci ac sem.</p>

    </asp:Content>

     

     

    Best regards 

    Zlaja

     

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 29, 2014 @ 12:31
    Fuji Kusaka
    0

    Hi Zlaja,

    Did you apply the template to the Node under Content Section > Properties > Temaplate (Choose the template you want to apply to the page). ?

    //fuji

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 29, 2014 @ 12:35
    Fuji Kusaka
    0

    Hang on are you its PersonalText Template which needs to inherit the that content from PersonalInfo right ?

    if so the <umbraco:Item field="smalltext" stripParagraph="true" runat="server" /> should be in PeronalText Template and since PersonalInfo is inheriting the properties from PersonalText you should be albe to retrieve the fields and content in sub pages.

     

    //fuji

  • Zlaja 12 posts 32 karma points
    Jan 29, 2014 @ 13:29
    Zlaja
    0

    Hi Fuji

    Thanks again.

    That I want is that template I have that call personalText to put inside in PersonalInfo.

    When i create like in show in screenshot that use template personaltext in personalinfo. So I can put different text inside properties. So I only use one template but different text. I hope u understand me what I want.

    enter image description here

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 29, 2014 @ 15:10
    Fuji Kusaka
    0

    Ok so under Its under PersonalInfo docType that you will need to Allowed the PersonalText Template. Then make sure to choose the PersonalText Template on the node itself.

    Hope this is what you want to achieve here.

    //fuji

  • Zlaja 12 posts 32 karma points
    Jan 29, 2014 @ 15:53
    Zlaja
    0

    Hi Fuji

    I have done this first in umbraco, but I can't display template from personaltext in personalinfo. That's why I tried to get help from here. I hope you have solution to that, becuse I don't understand why isn't work.

    Best regards Zlaja

  • Zlaja 12 posts 32 karma points
    Jan 29, 2014 @ 16:21
    Zlaja
    0

    Hi Fuji

    I hope my illustration will help little bit on my situation. That's very difficult to describe my problem. I hope that will help now. enter image description here

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 29, 2014 @ 17:15
    Fuji Kusaka
    0

    Can you please display the content of your personalText Template ? ... according to the inheritance from the template tree it looks good to me.

  • Zlaja 12 posts 32 karma points
    Jan 29, 2014 @ 22:21
    Zlaja
    0
    <%@ Master Language="C#" MasterPageFile="~/masterpages/PersonalInfo.master" AutoEventWireup="true" %>
    
    <asp:Content ContentPlaceHolderId="smalltext" runat="server">
    <h6>Begginigs</h6>
    
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vestibulum molestie lacus. Aenean nonummy hendrerit mauris. Phasellus porta. Fusce suscipit varius mi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vestibulum molestie lacus. Morbi nunc odio, gravida at, cursus nec, luctus a, lorem. Maecenas tristique orci ac sem.</p>
    
    </asp:Content>
    
  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 30, 2014 @ 04:39
    Fuji Kusaka
    0

    You need to add the umbracoItem Field within the contentPlaceHolder

    <asp:Content ContentPlaceHolderId="smalltext"runat="server">
    <umbraco:Item
    field="smallText"stripParagraph="false"runat="server"/>
    </asp:Content>
  • Zlaja 12 posts 32 karma points
    Jan 30, 2014 @ 12:32
    Zlaja
    0

    Hi Fuji

    Thanks for your help. That's very strange, why isn't working. Do I need razor script rendering of template personaltext ?

    My code is now like u described. Is this correct maked ?

    <asp:Content ContentPlaceHolderId="smalltext" stripParagraph="false" runat="server">
        <umbraco:Item field="smallText" runat="server"/>
        <h6>Begginigs</h6>
    
        <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vestibulum molestie lacus. Aenean nonummy hendrerit mauris. Phasellus porta. Fusce suscipit varius mi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vestibulum molestie lacus. Morbi nunc odio, gravida at, cursus nec, luctus a, lorem. Maecenas tristique orci ac sem.</p>
    
        </asp:Content>
    
  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 30, 2014 @ 12:43
    Fuji Kusaka
    0

    yes and still you dont get your values ? That is strange or am i missing something here.

    Getting a bite confused now to be honest. :(

  • Zlaja 12 posts 32 karma points
    Jan 30, 2014 @ 13:01
    Zlaja
    0

    Hi fuji

    That is really strange. I don't know do i need something that is run like a render. ex. @foreach() something like that or umbraco:item contains inside a render mechanisme ?

    best regards zlaja

  • Zlaja 12 posts 32 karma points
    Jan 30, 2014 @ 13:28
    Zlaja
    0

    Hi Fuji,

    OOOOhh I think you misunderstood me, that's not what I think. Okay umbraco:Item is understand what is working. I try again what I want.

    I Want to make dynamically "Om mig" page that is parent page showin screenshot Parent page

    and under "Om mig" page have child/sub pages that use same template that calls "personaltext" but input is diffrent in property. Still only using "personaltext".

    I think I need to use razor script to do that.

    I hope now u will understand me what I want.

    best regards zlaja

  • Zlaja 12 posts 32 karma points
    Jan 30, 2014 @ 13:45
    Zlaja
    0

    Hi Fuji figured out ... i maked this script in razor.

        @if (Model.Children.Where("Visible").Any())
    {
        <ul>            
            @foreach (var childPage in Model.Children.Where("Visible"))
            {
                <h6>Test</h6>
    
                <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vestibulum molestie lacus. Aenean nonummy hendrerit mauris. Phasellus porta. Fusce suscipit varius mi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent vestibulum molestie lacus. Morbi nunc odio, gravida at, cursus nec, luctus a, lorem. Maecenas tristique orci ac sem.</p>
    
            }
        </ul>
    }
    

    And get result what i want.

    enter image description here

    Now can I continue!

    Thanks again for your help.

    Best regards Zlaja

Please Sign in or register to post replies

Write your reply to:

Draft