Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm new to Umbraco and so I'm probably making a basic mistake, but here goes:
I have created a simple Document Type, "Hours of Operation", and added 7 textstring properties for each day of the week. I just want to use this to store the hours the shop is open. I enabled "Allow at root" and saved it. Then I went to Content and created an instance of "Hours of Operation" and filled out the 7 fields.
Then I created a new template and called it "Master" with the intentions of making it the master page for all others. While editing the master page, and I try to use the Query Builder, no combination of I want "everything" from "my website" returns any results.
I have verified that the hours of operation are published but nothing I do returns results. Do I need to create a data type or something?
I'm not entirely sure what you're expecting to get back but when you first start the query builder, it should look a little like this:
Here you see I have one result, the Blog is the root of my website. If you have any published(!) content in the root of your site you should see something similar for your Hours of Operation root node. Is that what you're not seeing?
Yes, I am expecting to see something similar to your example. However, when I try I get nothing:
The only thing I can think is that I do not have a template assigned to this document type because I only want the document type to store 7 strings that I can query later and use in a master page.
Hmmm, weird, what does your content tree look like, got a screenshot of that?
Thanks for looking!
One other thought: what template is that content item using? Is there any template attached here?
Other than that you should be able to do something like this:
Layout = null;
// Go to the first node that's found on level 1
var rootNode = Model.Content.AncestorOrSelf(1);
This all depends on the property alias of course (I chose "openingHour1" in this example) but this should work.
To be sure: you need to tell your Hours Of Operation document type that it can use the Master template and if you had not done that yet, you will need to publish the Hours of Operation node again, after selecting the template on the Properties tab.
I think I am asking the wrong question.
What I need, is to display the same information on many pages in different ways.
I would like the source data to be in one location, so that when I change the hours for Monday it changes on Page X, Page Y, etc.
I THINK I need a document so that I can create a content node that will store this information. I had hoped that if I did this, I would be able to simple use the query builder to access that information, but maybe I am mistaken.
How would you go about storing what is essentially 1 row of data in table and then access it anywhere?
I would go about it the exact way I illustrated above. :-) Does that work for you?
Thank you for all of your help -I really appreciate it.
I got it to work finally.
I made a "Home" document type to serve as the root for my site. As a subtype, I made the "Hours of Operation" document type.
Then I created a "Home" content node, and an "Hours" content node. Then when I went back to edit the Home template, the query builder worked as expected.
I have no idea why it worked this way. I surmise I am not allowed to have 2 root content nodes, but it is just a guess.
Anyways, thanks again..
Spent too much time on this...
Thank you your feedback helped
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted