|
|
Rank: Newbie
Joined: 10/21/2008 Posts: 8 Location: UK
|
Hi Guys,
I am sorry I am asking so many questions all over the place.
I have a test server running on XP (still can't get the server 2003 to work) and I have been setting up the templates for the pages.
for each page there will be a footer tab that will hold a "Written By:" and an "Authorised By:". At the moment I have the value for these set up at a text string box, which works fine and displays what I type in the box. What I really want is a dropdown that hold many names for me to choose. I have created a new dropdown in the develpoer section called "Written" and I have input prevalues, I can then choose these on the Footer tab, but when I look at the displyed page I see the value number rather than the text, is there a way to display the text?
Thanks
|
|
 Rank: Umbracoholic
Joined: 9/27/2007 Posts: 1,123 Location: Belgium
|
Hi DanMann, Use GetPreValueAsString() function for that. It lives in the library class as a static method and as such available through both a user control or through xslt. Hope that helps. Regards, /Dirk
level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
Rank: Newbie
Joined: 10/21/2008 Posts: 8 Location: UK
|
Dirk wrote:Hi DanMann,
Use GetPreValueAsString() function for that. It lives in the library class as a static method and as such available through both a user control or through xslt.
Hope that helps.
Regards, /Dirk
Hi Dirk, Could you explain that in terms that someone that knows very little about coding will understand.
|
|
 Rank: Umbracoholic
Joined: 9/27/2007 Posts: 1,123 Location: Belgium
|
Ok, my bad. I'll try to explain a bit more detailed. I'm guessing from your post you've created a datatype to hold the names for the 'Written' dropdown. Each name has a prevalue attached to it, which is an id that gets saved in the published xml. To get to the name that relates to the id found in the published xml, a lookup is required. And there's where the functions comes in. Depending on the version you're using (either v3 or v4), there's a different implementation plan: If you're using a v4 version, you can take advantage of using inline xslt in the template. (Explanation of inline xslt: http://umbraco.org/documentation/books/inline-xslt/how-to-use-it) Code:<umbraco:Item runat="server" field="Written" xslt="umbraco.library:GetPreValueAsString({0})" /> field attribute refers to the alias you're using for the property. If you're still using a pre v4 version, you'll need to use a macro/xlst combo to get to the same result. If you need some assistance on this, let us know. Regards, /Dirk
level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
|
|
Rank: Newbie
Joined: 10/21/2008 Posts: 8 Location: UK
|
This seems a hard way of doing a simple task??
I am using 3.0.6, I have the datatype with a dropdown, I have named it "Written", and the moment I have a dropdown list on a tab called "Footer" and it contains names of people. When I select the name I want, and save, then view the page, I see "Written: 36"
|
|
Rank: Newbie
Joined: 10/21/2008 Posts: 8 Location: UK
|
This is what I have in the <div id='footer'> section
<p><?UMBRACO_GETITEM field="written" insertTextBefore="Written By: "/> <?UMBRACO_GETITEM field="auth" insertTextBefore="Approved By: "/></p> <p><?UMBRACO_GETITEM field="version" insertTextBefore="Version: "/> <?UMBRACO_GETITEM field="updateDate" insertTextBefore="Updated On: " formatAsDate="true"/></p>
|
|
|
Guest |