Can I use asp.net angle bracket notation to access umbraco values?
I was trying to build up my meta keyword element in my code and want to include any custom keywords per page and then bolt on some standard ones on the end. I did not want to use a macro as its a bit over kill (and you end up with lots of them) and its a one shot wonder on this site, it won't get used again.
Dirk I tried your solution but it kept throwing an error, then after reading Petr link I see why, you had single quotes in your umbraco tag I was using doubles! Tried it again and it worked.
So many solutions, still none of them feel "funky" though...
I would like to see someone come up with a chainable class, or a series of overloads for something like GetItem that does all the features that the <umbraco:item../> tag accomplishes.
Can I use asp.net angle bracket notation to access umbraco values?
I was trying to build up my meta keyword element in my code and want to include any custom keywords per page and then bolt on some standard ones on the end. I did not want to use a macro as its a bit over kill (and you end up with lots of them) and its a one shot wonder on this site, it won't get used again.
Then I tried using something like this:
<umbraco:Item field="metaKeywords" textIfEmpty="" insertTextBefore="<meta name="keywords" content="" insertTextAfter="my default keywords here" />" case="lower" htmlEncode="true" stripParagraph="true" runat="server"></umbraco:Item>
But I simply find this really counter intuitive and I simply HATE writing element code encoded inside another element, its just all wrong.
So how best to do it. In ASP.net or Class ASP I'd do something like this:
<meta name="keyword" content="<%= page.metaKeywords %> my default keywords here" />
Is this doable? If so how to do you get to the umbraco page object and is there any docs on whats available.
More importantly is this the "umbraco way"? Am I missing a handy shortcut that I can't find in the docs?
Cheers
Pete
Pete,
Can't you just use
Hope this helps.
Regards,
/Dirk
@Dirk try look at http://www.richardsoeteman.net/CommentView,guid,90e0ca4a-0e98-4962-9d86-5381d57e6ae7.aspx#commentstart
Dirk I tried your solution but it kept throwing an error, then after reading Petr link I see why, you had single quotes in your umbraco tag I was using doubles! Tried it again and it worked.
So many solutions, still none of them feel "funky" though...
Use umbraco.library...
@Casey: Great idea, I'm thinking about nodeFactory, but getitem is right way :-)
@Petr,
nodeFactory would be a great option as well.
I would like to see someone come up with a chainable class, or a series of overloads for something like GetItem that does all the features that the <umbraco:item../> tag accomplishes.
The latter probably being the most fool-proof.
Thats more like it Casey, thats exactly the kind of thing I was after! Is it good practise though?
is working on a reply...