Products

Solutions

Resources

Partners

Community

About

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 ForumsRepositoryRepositoryDisplaying categories specific to a listing in the repository moduleDisplaying categories specific to a listing in the repository module
Previous
 
Next
New Post
4/4/2010 4:45 AM
 

 Alright, after upgrading to DNN 5.3 and installing version 3.1.15 of the Repository module, putting [CATEGORIES] works.  Sorry for the trouble.  I was using 3.1.10 before.  I am not sure whether upgrading DNN or the module itself solved the problem, but it works.

One small question: Categories are now listed delimited with a comma.  Is there any way to put a space after the comma, just to make look prettier?

 
New Post
4/5/2010 1:15 PM
 

This is defined in the source of the project:

For Each item As RepositoryObjectCategoriesInfo In categoryController.GetRepositoryObjectCategories(objRepository.ItemId)
  objCategory = categories.GetSingleRepositoryCategory(item.CategoryID)
  sCategories.Append(objCategory.Category & ",")
Next

You can see it's adding the comma but no space.  To change this you'd have to modify the source of the project to work like you want.  If you're not currently modifying the source then it's probably more work than it's worth for you to install it, make teh change, compile, etc.

 
New Post
4/5/2010 1:48 PM
 

 actually, it should be quite easy to do with jQuery.  You could put a little jquery script in the module footer to find the categories label, then replace all the commas with comma+space

 
New Post
4/5/2010 2:47 PM
 

I posted some sample jquery to reformat the category string, but it only reformatted the first item, so I pulled the post. I'll fix the sample an re-post in a little bit

 
New Post
4/5/2010 3:00 PM
 

Ok, tested this and it works ... :)

Here's how you can modify the format of the Categories value at runtime using jQuery.

1. Modify your template.html, place a div with a class around the Categories tag.

   1:  <div class="categorydiv">Categories: [CATEGORIES]div>


2. Open the Module settings, and expand the Advanced Settings section. You will see a Header and a Footer text area. Whatever you enter in those boxes will be output prior to the module output (Header) or after the module output (Footer).  In the Footer section, enter the following text

   1:  <script type='text/javascript' language='javascript'>
   2:  $(document).ready(function() {
   3:    $(".categorydiv").each(function(){
   4:      $(this).html($(this).html().replace(/,/g,",  "));
   5:    });
   6:  });
   7:  script>


3. Click update.  Now your categories will be separated by a comma and 2 spaces. Feel free to modify the last parameter of the replace method if you want your categories separated by some other combination of characters.

What this does is inject some jquery to the  page right after the repository module's output.  The function will look for items that have the class you assigned to the div you put around your CATEGORIES tag in step 1, then for each one it finds, it will grab the text within the div. It then uses the replace method to look for all commas and replace them with a comma and 2 spaces.

That should do it :)

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsRepositoryRepositoryDisplaying categories specific to a listing in the repository moduleDisplaying categories specific to a listing in the repository module


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