New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryAttributes Walk-ThroughAttributes Walk-Through
New Post
1/10/2007 11:27 AM

The question of how to get attributes to show up has come up quite often so below is a copy and paste of Steve's explanation to another user:

Adding/using a custom Attribute:
a. On the Repository Settings page . create your custom attribute ( for example Color .. please note that Attributes are case-sensitive .. I know, bad programming ;) )
b. Select your new Attribute and enter one or more valid values ( for example:  Red, White, Blue, etc)
c. Save your Repository settings.

So, at this point you've defined yoru custom attribute and given it a name and some valid values. Now, there are 3 things you have to do with regards to template

-. edit the form.html/form.xml files ( the upload form ) to allow users to select from the list of valid values when they upload/edit an item
-. edit the template.html/template.xml files ( the list display ) to display the selected attribute values ( if desired )
-. edit the header.html/header.xml files ( the list header ) to allow users to 'filter' the list based on attribute values ( in this example, so that they can only show items where the Color is Red )

So, let's walk through each one
d. open form.html. Verify that there is a tag named [ATTRIBUTES] in the form.html file. If not, add it where you would like the Attrbitues to be displayed. NOTE: At runtime, this tag will be replaced with a set of either checkboxes or radiobuttons ( depending on a form.xml setting we'll talk about in a minute ) for EACH custom attribute.If you defined 2 custom attributes, you don't need 2 [ATTRIBUTES] tags and you can't only display one set of attributes. The [ATTRIBUTES] tag displays selection controls for ALL of the custom attributes for this particular repository.  Decide if you want to allow people to select only one of the valid values ( radiobuttons ) or more than one ( checkboxes ). In the form.xml file, add an Object->Token named ATTRIBUTES and a Setting named Select. Set it to SINGLE for radiobuttons, or MULTIPLE for checkboxes.

This will now display your custom attributes on the upload/edit form and allow the user to select from the list of valid values.

e. edit the template.html/template.xml files. Here you can specify individual attributes if you have more than one. So, in your template.html file, decide where you want to display the selected values and add a tag like this .. [ATTRIBUTE:Color]. Again, make sure the attribute name, in this case Color matches the attribute ( case -sensitive ) that you created on the Setttings page. When rendered, the selected values will be displayed as a comma delimited list. ( for example: Red,White

f. final step. edit the header.html/header.xml files.If you want to allow the user to filter the list by a valid value for a custom attribute, add a tag like this to the header.html file.. [ATTRIBUTE:Color]. Again, case-sensitive. At render time, this will display a drop down list of all the valid values and if the user seelctes one, the list will only show those items where that value is selected. If you have multiple custom attributes, the drop downs are cumulative so if you had Color and Model as custom attributes, you could have 2 drop downs and by selecting values in each one, filter the list to only show Red (color)  Fords (model )

New Post
1/22/2007 1:40 AM
Supposed to be like this? I can't seem to get it to work. From the code, it appears it's supposed to be able to parse it attribute by attribute. How would that work in the xml?

New Post
1/22/2007 1:12 PM
I just stepped through the code and it looks like it might be a bug. The code is pulling its xml information from the header.xml so if you put what you posted into the header.xml file it'll work. Steve, could you verify that this is a bug and not by design?
New Post
1/22/2007 2:43 PM
Its a bug...
New Post
1/22/2007 3:14 PM
Doh!!! Right from the same thread I copied and pasted from.
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryAttributes Walk-ThroughAttributes Walk-Through

These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out