Display taxonomie seperatly from Model.Content

Topics: Customizing Orchard
May 13, 2013 at 5:03 PM
Hey everyone,

I have a Content Type "Employee" which has a few text fields and also a Taxonomy field.

Now I don't display my content with Display(Model.Content) but seperatly as for example:

@Model.ContentItem.Employee.Email.Value This is makes it easier to style.

Now I was wondering how i can display the Taxonomy shape seperatly like the email field.

Kind regards,

Borrie
Developer
May 13, 2013 at 5:25 PM
If you're talking about displaying the shape emitted by the TaxonomyFieldDriver, then the easiest way is to use Placement.info to designate that shape to a local zone, e.g. "Tags" or any other name that makes sense. Then, in your content template, render that zone, e.g.:
@Display(Model.Tags)
Easy as pie.
May 13, 2013 at 5:37 PM
Skywalker,

Thanks for your answer, I don't know exactlty how to put it in the placement info, maybe weird but I never work with that file, I always overwright stuff in the code...

When I add this to my view file (which works in the overwritten view from shapetracer: Views/Fields.Contrib.TaxonomyField-Domeinen-url-team.cshtml

@{
var terms = (IEnumerable<Contrib.Taxonomies.Models.TermPart>)Model.Terms;
string name = @Model.ContentField.Name;
}
<div id="actiefindomeinen"><b>Actief in volgende domeinen:</b></div> @if (Model.Terms.Count > 0) {
<p class="taxonomy-field"> @* <span class="name">@name.CamelFriendly():</span> *@ @(new HtmlString( string.Join(", ", terms.Select(t => Html.ItemDisplayLink(t.Name, t.ContentItem ).ToString()).ToArray()) )) </p> }

I get: Operator '>' cannot be applied to operands of type 'ClaySharp.Clay' and 'int'

I don't know how this can be possible...
Developer
May 13, 2013 at 8:06 PM
Interesting. What happens if you cast Model.Terms.Count to an int first? E.g.
@if(((int)Model.Terms.Count) > 0 { ...
May 13, 2013 at 8:50 PM
Skywalker,

Then I get Object reference not set to an instance of an object...

What I'm wondering, this maybe a very basic question even though I've made a few fully custom made sites with Orchard. (I normally program the whole modules from scratch so I have full control)

For this project I've used standard Orchard tools via the Gui.

I've created a content type employee that has an email, name, telnr, and taxonomies.

What would be the standard way to fully customize this html and css wise.

For example I want to display the name first, have email and telephone number float next to each other and display the taxonomies somewhere where I'dd like to.

If you use display(model.content) everything is generated and text fields have a span class name and value so you can't even use css to style them.

Am I missing something completely (Probably I am :) ) and what is the standard way to do this?

Borrie