Copied to clipboard

Flag this post as spam?

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


  • DonZalmrol 220 posts 833 karma points
    Jun 03, 2015 @ 08:19
    DonZalmrol
    0

    Automaticaly show short version of a range of pages on one overviewpage

    Hi,

    Is it possible to show a short version of let's say different project pages on one overview page.

    So e.g. you have all these different projects and you wish to provide your website visitor to have a landing page of all these projects where they can see them all in a short version (4-5) lines, picture and read more link to the projects listed.

    Then when the page gets too long, there would be pagination put in place.

    Is something like this possible using Umbraco?

    Thanks!

    Laurens

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jun 03, 2015 @ 10:37
    Dennis Aaen
    0

    Hi Laurens,

    Yes it´s possible to a short version of let's say different project pages on one overview page in Umbraco. For an example of this you could setup an new Umbraco installation and choose the starter kit called TxT.

    Or you can find the code that is used for this on GitHub, https://github.com/umbraco/Starterkits/blob/master/Txt/Txt/Views/umbNewsOverview.cshtml, In Umbraco you will also find code snippets that you can use for this. e.g List Child Pages from CurrentPage.

    Hope this helps,

    /Dennis

  • DonZalmrol 220 posts 833 karma points
    Jun 03, 2015 @ 11:41
    DonZalmrol
    0

    Hi Dennis,

    I'm copy-pasting the code in my project.

    In what should I change the foreach loop?

    @foreach (var feature in homePage.umbTextPages.Where("featuredPage"))

    As it now only searches for the featured page of the other project and not mine.

    The site I'm using is test.gregoir.be

  • DonZalmrol 220 posts 833 karma points
    Jun 03, 2015 @ 12:00
    DonZalmrol
    0

    Ok, little bit further.

    But now it's only showing the titles of my (grid) project pages. http://test.gregoir.be/test/

    @inherits UmbracoTemplatePage
    

    @{ // Model.Content is the current page that we're on // AncestorsOrSelf is all of the ancestors this page has in the tree // (1) means: go up to level 1 and stop looking for more ancestors when you get there // First() gets the first ancestor found (the home page, on level 1)

    @* var homePage = CurrentPage.AncestorsOrSelf(1).First(); *@
    
    var homePage = Umbraco.Content(1081).Children.Where("Visible").OrderBy("Name");
    

    }

    Wonderful featured pages

    @foreach (var feature in homePage) {

    @feature.Name

    @* @Umbraco.Truncate(feature.BodyText, 100) *@
    }
  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jun 03, 2015 @ 12:00
    Dennis Aaen
    1

    Hi Laurens,

    Do you have a structure where you have an overview page document type, and under this page you have each product page. Then you should be able to use this snippet of code.

    @{ var selection = CurrentPage.Children.Where("Visible"); }
    
    @if (selection.Any())
    {
        <ul>
            @foreach (var item in selection)
            {
                <li>
                    <a href="@item.Url">@item.Name</a>
                </li>
            }
        </ul>
    }
    

    With this code above you should get a list where it lists each product page name and a link to the product page.

    Hope this helps,

    /Dennis

  • DonZalmrol 220 posts 833 karma points
    Jun 03, 2015 @ 12:05
    DonZalmrol
    0

    Hi Dennis,

    Yes, I have the following structure

    templates -> master -> project page

    partial views -> umbFeatures

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jun 03, 2015 @ 12:10
    Dennis Aaen
    0

    Hi Laurens,

    Okay, and you can get custom properies with

    @{ var selection = CurrentPage.Children.Where("Visible"); }
    
    @if (selection.Any())
    {
        <ul>
            @foreach (var item in selection)
            {
                <li>
                    <a href="@item.Url">@item.PropertyAlias</a>
                </li>
            }
        </ul>
    }
    

    Where the propertyAlias is a field on the product page, it could be the descriptions of the product and so on.

    Hope this helps,

    /Dennis

  • DonZalmrol 220 posts 833 karma points
    Jun 03, 2015 @ 12:26
    DonZalmrol
    0

    Hi Dennis,

    It's coming together now. Thanks for the help so far!

    The truncate option is doing a few freaky things if you browse to test.gregoir.be/test

    The code is:

    @Umbraco.Truncate(@feature.GetGridHtml("bodyText", "mybootstrap"), 500)
    

    Is it also possible to show the image left and the description right?

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jun 03, 2015 @ 12:41
    Dennis Aaen
    0

    Hi Laurens,

    Okay so you are using the grid layout. Then you need to create a row configuration that has an image on the left and the description on the right side.

    I think this https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/built-in-property-editors-v7/Grid-Layout/configuring-the-grid-layout-datatype documenation can help you.

    If you have access to Umbraco TV, there is also a whole chapter about how to work with the grid layout http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/grid-layouts/setting-up-the-datatype/. If not then you can find the different plans here: http://umbraco.tv/plans-signup/

    Hope this helps,

    /Dennis

  • DonZalmrol 220 posts 833 karma points
    Jun 03, 2015 @ 12:46
    DonZalmrol
    0

    Hi Dennis,

    My grid is already configured as such and works as designed. Like you can see here: http://test.gregoir.be/projecten/project-a/

    That's a grid page.

    If I turn off truncate, then I get the whole gridpage, which I do not wish for. I have Umbraco TV. But this is something beyond the already provided information (I think).

    As you can see (and understand) in the provided picture, I have no need for the searchbar and side navigation in the overview pane.

    enter image description here

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jun 03, 2015 @ 12:53
    Dennis Aaen
    100

    Hi Laurens,

    There are some limitions when you are using the grid editor, you can read more about best practices here https://our.umbraco.org/Documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors-v7/Grid-Layout-Best-Practices.

    One of the limitations is All content entered into the grid is stored as a single property value on the content node, as a big JSON object. This means that as soon as the values are stored in the database, there is no managed api to drill into the grid content and target specific cell content - so a grid layout is not a recommended storage of reusable content - it simply wasn't designed for this scenario. If you wish to reuse content in multiple pages, it is still recommended that you store these pieces of content as separate content nodes, so they can be stored, cached and queried as usual.

    /Dennis

  • DonZalmrol 220 posts 833 karma points
    Jun 03, 2015 @ 13:20
    DonZalmrol
    0

    Thank Dennis,

    I'll play around in my grid settings and throw out my sidenavigation from the grid and put it in the template itself. That will probably force my grid to only show project related stuff.

    Cheers,

    Laurens

Please Sign in or register to post replies

Write your reply to:

Draft