Does anyone know how to get all the properties from one tab and filter out any of those items without a value. I want to get a count of those items and then loop through them to display them. The count is necessary as I want to use it for the responsive layout. The reasoning behind this is that admin users can add new properties to the tab without also having to update the Master page and any other partial views, and it will still display nicely in a responsive layout.
I seem to be able to access the property alias using the code below, but I'm stumped trying to filter them down to a specific tab only, and making sure they have a non-blank value in the same query (I can do a check in the output, but I'd like to do it in the initial select via a Where(Property.Value != "") or similar).
@foreach (var child in Model.Content.Properties) { @child.PropertyTypeAlias }
Background:
I created several document types to be used as tabs that contain a bunch of generic properties. I then use this document type in my other document types (home, landing page, text page) as a Document Type Composition.
For example, let's say I have "SocialTab" as the Document Type, this has a tab called "Social" with 6 properties (facebook, twitter, instagram etc). In this case I am only using this as a Document Type Composition on the "Home" document type. I can access the values for the properties directly on my master page with @home.facebook or whatever (as home = @CurrentPage.Site()) but I'd like to avoid calling them all specifically by name... calling the tab by name or by node id is fine though!
Note: I've seen various solutions presented in the forum, but none of them seem to work so I suspect they're for older versions of Umbraco (I'm using 7.2) - or maybe I'm just not calling them correctly.
Just to update my own thread, I still haven't found an answer for getting all the properties from a tab, and I suspect I never will without someone intimately familiar with Umbraco assisting.
But I've found that can achieve exactly what I want by approaching the problem differently... I've been playing with LeBlender to create custom property edtors for the grid, and using it I can create nifty "lists" of items but I can also get the count for the number of items (essential for responsive positioning of elements).
@inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.BlenderModel>
var GridColumns = Model.Items.Count(); <ul class="small-block-grid-@GridColumns"> //Note: using Foundation framework @foreach (var item in Model.Items) { <li> //Do stuff with "item" properties </li> } </ul>
So for the "Social" example in my original post, I just create a property editor with "Link" (a URL) and "Type" (selected from a drop-down to indicate the type it is (Facebook, Twitter etc) which I can either use as a class to show a specific icon, or to select a specifc element should I wish to. Adding a new type is a simple matter of adding to the Type drop-down, and it will display on the front-end immediately. This is far, far better that having to add a whole new property to a tab each time and then needing to edit all the templates to use it.
So thankyou me, for helping me! :P And also to LeBlender for saving my skin at the 11th hour!
Get all properties from a tab
Does anyone know how to get all the properties from one tab and filter out any of those items without a value. I want to get a count of those items and then loop through them to display them. The count is necessary as I want to use it for the responsive layout. The reasoning behind this is that admin users can add new properties to the tab without also having to update the Master page and any other partial views, and it will still display nicely in a responsive layout.
I seem to be able to access the property alias using the code below, but I'm stumped trying to filter them down to a specific tab only, and making sure they have a non-blank value in the same query (I can do a check in the output, but I'd like to do it in the initial select via a Where(Property.Value != "") or similar).
@foreach (var child in Model.Content.Properties) { @child.PropertyTypeAlias }
Background:
I created several document types to be used as tabs that contain a bunch of generic properties. I then use this document type in my other document types (home, landing page, text page) as a Document Type Composition.
For example, let's say I have "SocialTab" as the Document Type, this has a tab called "Social" with 6 properties (facebook, twitter, instagram etc). In this case I am only using this as a Document Type Composition on the "Home" document type. I can access the values for the properties directly on my master page with
@home.facebook
or whatever (ashome = @CurrentPage.Site()
) but I'd like to avoid calling them all specifically by name... calling the tab by name or by node id is fine though!Note: I've seen various solutions presented in the forum, but none of them seem to work so I suspect they're for older versions of Umbraco (I'm using 7.2) - or maybe I'm just not calling them correctly.
Can anyone help? :\
Don't worry schlubadub, I can help! ;)
Just to update my own thread, I still haven't found an answer for getting all the properties from a tab, and I suspect I never will without someone intimately familiar with Umbraco assisting.
But I've found that can achieve exactly what I want by approaching the problem differently... I've been playing with LeBlender to create custom property edtors for the grid, and using it I can create nifty "lists" of items but I can also get the count for the number of items (essential for responsive positioning of elements).
So for the "Social" example in my original post, I just create a property editor with "Link" (a URL) and "Type" (selected from a drop-down to indicate the type it is (Facebook, Twitter etc) which I can either use as a class to show a specific icon, or to select a specifc element should I wish to. Adding a new type is a simple matter of adding to the Type drop-down, and it will display on the front-end immediately. This is far, far better that having to add a whole new property to a tab each time and then needing to edit all the templates to use it.
So thankyou me, for helping me! :P And also to LeBlender for saving my skin at the 11th hour!
is working on a reply...