Copied to clipboard

Flag this post as spam?

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


  • Mr A 216 posts 278 karma points
    Jul 02, 2012 @ 12:53
    Mr A
    0

    Modifying Razor Script to display 2 properties of document type

    Hi,

    I have got a document type [homepage] , where i have got 4 sections each section has a short description and long description. The short description is being displayed on the homepage while the long description should be displayed on another page when the read more link is clicked.

    The test website is on http://acellr.tangent-design.com , where short discription is being displayed with a read more link. Can anyone assist me on how can i show long description of the 4 sections when readmore is clicked on another template. Currently i am using the following razor script on homepage:

    <div class="midCenter">

    <div class="header1">@Model.ThompageMidContent</div>

    <p>@Model.ThompageMidShortContent</p>

    <div class="more">

    <a href="#" >READ MORE Link to long description</a>         

    </div>

    </div>

    <div class="midCol1">

    <div class="header1">@Model.ThomepageMidCol1</div>

    <p>@Model.ThomepageMidCol1ShortContent</p>

    <div class="clear"> </div>

    <div class="more"><a href="" > READ MORE Link to long description</a></div>

    </div>

    <div class="midCol2">

    <div class="header1">@Model.ThomepageMidCol2</div>

    <p>@Model.ThomepageMidCol2ShortContent</p>

    <div class="more"><a href="" > READ MORE Link to long description</a>

    </div>

    </div>

    <div class="midCol3">

    <div class="header1">@Model.ThomepageMidCol3</div>

    <p>@Model.ThomepageMidCol3ShortContent</p>

    <div class="more"><a href="" > READ MORE Link to long description</a>

    </div>

    </div>

    Document alias for long description is : ThompageMidLongContent etc. Any suggestions or advice will be highly appreciated

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 02, 2012 @ 13:26
    Fuji Kusaka
    0

    Hi,

    What you could probably do is instead of having 2 different fields for the descriptions, use only one field and truncate your text in your razor file and just insert the umbraco field in the template itself.

    Razor File

    var  yourChoice = newsItem.Children.OrderBy("createDate descending");
    foreach(var page in yourChoice)
                    {
                         @Library.Truncate(@Library.StripHtml(page.Description), 100)
                     }

    Template 

    <umbraco:Item field="Description" runat="server" />

    Hope it helps

    //fuji

  • Mr A 216 posts 278 karma points
    Jul 02, 2012 @ 14:11
    Mr A
    0

    how would i link readmore to that template , as i have got 4 sections going into that template, so for instance if i click on readmore for section one , the template should show description for that section viceversa

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 02, 2012 @ 14:22
    Fuji Kusaka
    0

    Where are the short description from the url you sent? Is it the one at the bottom with "WHAT IS EMOTIONAL LITERACY?"

     

  • Mr A 216 posts 278 karma points
    Jul 02, 2012 @ 14:30
    Mr A
    0

    short description is the one which is currently being displayed on website for instance proven credentials[header], do you some time....[short description] , readmore [link to long description on which the question is based], same structure for other 3 columns[what is emotional literacy][why we need emotional..][how does emotional..] . long description should be displayed when read more is clicked on the site , but i dont know how to link the longdescription property to that link to show that on another template.

Please Sign in or register to post replies

Write your reply to:

Draft