SDL Tridion taxonomy component count is off - tridion

I am new to Tridion and am facing an issue with the taxonomy.
As storage we are using file system and for taxonomy we have sql db.
Now, we have created State as Category with few keywords inside it. I have created schema and a component and have selected one of the keyword for classification. This associates the keyword with the component.
Now I have used the Tridion control with the uri of the State to retreive the taxonomy. It works fine, but the component count is showing as (0) instead of (1) since only one component is added in the bracket which is the normal behavior of tridion. I have published the taxonomy as well as the component.

You need to publish the Component that is using the Keyword. As far as I can see, the control is counting items on the Content Delivery side; not items in the Content Manager. I set up a simple example using the basic tag:
<tridion:TaxonomyControl
ID="taxBasicProperties"
TaxonomyURI="tcm:1-8-512"
runat="server">
</tridion:TaxonomyControl>
Result without the component published:
Sistema operativo (0)Android (0)iOS (0)Windows (0)
Result WITH component published:
Sistema operativo (1)Android (0)iOS (0)Windows (1)

Related

How do I edit variables and update content of a view component using a button within the same component?

Summary: I have a view component with buttons which need to be able to change the details displayed in the rest of the component on click, but i can't figure out how to update the components content and data using an element within the component.
I am using asp.net razor pages to make a simple UI which displays various info grabbed from a JSON file, no database connection or POST functionality necessary.
I want the block of html that displays the data to be a reusable component, so i don't have to rewrite it every time i want to show a different entry in the file. From my research, there are a few options: HTML components, tag helpers, razor components, partial views, and view components. I chose to use a view component since the other options all seemed either outdated or not capable enough to achieve what i wanted. That is, with the exception of razor components, which require blazor to function fully which would also require me to learn a whole new framework and retrofit my program to work for it.
My view component functions to the point where i can invoke it from Index.cs and the component shows all the data from the first log in the list, as desired.
My intention: the default entryNo value is 0, so the component shows the title and date from the first log entry. When a user clicks the "Next" button (inside the component), entryNo becomes 1, and the component shows the title and date of the second entry in the log file.
ViewComponent.cshtml:
#model FullLog
#{ int entryIndLocal = 0; }
<div>
<div>#Model[entryNo].Title</div>
<div>#Model[entryNo].Date</div>
<button onclick={entryNo++}>Next</button>
</div>
What i've tried:
Setting the entryNo value in the view's .cs file and including a function to increment that value when called. I couldn't figure out how to call the function from the cshtml.
Initialising the entryNo variable from within the cshtml file, with the intention of the adding onclick={#entryNo++}. This didn't work either.

Filter page datasource based on record selection

I seem to be struggling with this. I am working on a project management app in Google App Maker. I am using SQL data models. The portion of the app I am having trouble with is several project detail pages linked with a project list page. I have no trouble going from the project list page to the first project detail page.
I have a table widget in the project list page, and the onClick code for a table row is:
app.datasources.Projects.selectKey(widget.datasource.item._key);
app.showPage(app.pages.ProjectPage);
This filters the first detail page with the primary key of the record in focus. No problem here. When I want to navigate the next detail page that has a different datasource (but I still need to filter using the same primary key) I am struggling.
If someone can guide me in making a button in the first detail page that when clicked gets the _key of the project loaded in that current page and filters another detail page for the same project in focus, (using another data model, let's call it ProjectBudgetPage for example) I would really appreciate the help.
This was one my latest attempts at navigation to other detail pages within a project, this was for an onClick event:
var widgets = widget.parent.descendants;
var projectID = widgets.HiddenProjectID.text;
var projectDataSource = app.datasources.ProjectBudgetView.item;
projectDataSource = projectID;
app.showPage(app.pages.ProjectInfoPage);
which results in: (TypeError) : Cannot read property '__gwt_instance' of undefined
at HeaderProjectTabs.HeaderContainer.InfoTabButton.onClick:5:5
I am not sure if I understood properly but I suggest that you start by checking this official App Maker template available here https://developers.google.com/appmaker/templates/partner-management/ which provides a ready-to-run app you can use to manage an internal list of partners, but you can also customize it with your own needs. I recently used most of the UI and logic of this template and I was able to integrate it with SQL data models and it works really great.
I noticed that for this template they are saving the (widget.datasource.item._key) to a Page custom property which you can access afterwards. Custom properties are page-level properties that store data for a single user session. Custom properties are useful when you need to bind properties of multiple widgets to a single value. More info available here https://developers.google.com/appmaker/ui/binding#custom_properties
In your scenario, you can create a new custom property (string) inside your ProjectInfoPage and then you can add a script to the button onClick event in your ProjectPage to save the _key or any other item to a page property. For example:
app.pages.ProjectInfoPage.properties.ProjectKey = widget.datasource.item._key;
app.showDialog(app.pages.ProjectInfoPage);
Then you can get the “ProjectKey” property by adding this to the onAttach event in your ProjectInfoPage:
var key = app.pages.ProjectInfoPage.properties.ProjectKey;
…
In the onAttach event you can filter the new model or pass the property values to a server script. I believe there are other approaches but I hope this helps!

Can we edit Page Metadata in Tridion using SiteEdit 2009?

In SDL Tridion 2009 SP1 we have Components that are added to Structure Group and Page Metadata which are then output on the Page as a Component Presentation. We have done this to allow users to set global content per site section without the need to add it to every single Page in the Structure Group.
When we output the Component with a Component Template with manual tags we get a red box around the Presentation and the tooltip of the SiteEdit box says “Removed”. When using the exact same Component Template in the Component Presentations tab and rendering that on the page the content is editable.
Is it possible using SiteEdit 2009 to inline edit a component added as Page/Structure Group metadata?
Note: We are aware of an outstanding bug in SDL Tridion 2009 SP1 that when you go to open a component added to Page/Structure Group metadata that it always opens it read-only. Could this be causing the issue?
It is possible to do this but you have to make sure that your markup is correct. I have done this before by marking the SiteEdit Component Presentation as QueryBased which seems to make SiteEdit ignore it's usual rules where the Component must be added in the Component Presentation list
<!-- Start SiteEdit Component Presentation: {
"ID" : "CP1",
"ComponentID" : tcm:32-204298",
"ComponentTemplateID" : "tcm:32-204519-32",
"Version" : "16",
"IsQueryBased" : true}
-->
You need to either:
Expose the metadata of the page in a "visible" area of your page with the correct SE markup
Open the page in CME and edit the Metadata there.
Tridion UI 2012 added a button with "Edit Metadata" functionality, but that's not available for SE 2009
Not through inline editing. You can of course open the Page editing popup and edit the metadata there.
Of course if you want to edit fields of the Component that you've linked in Page Metadata, you can just render out that Component Presentation into the HTML and mark it with the correct SiteEdit commands as Nuno suggests.

How to access componentlink field names in third level?

How to access componentlink field names in third level?
I have a schema which contains a field as embeddable schema, in that embeddable schema, I have a component link which is derived from another schema. How can i retrieve the field of that schema?
It really depends on the purpose of those field(s), perhaps you could provide some more information?
Another option not mentioned here is to write your own C# building block to add these 3rd level components to your package. By doing so you make it a lot simpler to work with them in your DWT layout.
For example if your third-level items are used to generate a list of office locations, you could write a C# block to obtain all the relevant office location components and add them to your package as a component list 'Locations' all you would simply need to do in your DWT is loop those items and provide the display you need.
Personally I don't like to use / add functions into DWT, I try to keep it as simple as possible, again if you can provide more information about your scenario that would generate a better answer for you from the community.
As far as I know, you need a special DWT TBB to get some control over your embedded/componentlinks. Maybe you could use Nuno's Get Extensions ? http://www.sdltridionworld.com/community/extension_overview/dreamweaver_get_extension.aspx
Or use Razor Mediator, perhaps:
http://www.sdltridionworld.com/community/2011_extensions/razormediator.aspx
To prevent having to use either the DGX (as MDa suggests) or write a C# TBB (as John Winter suggests), you can also simply call RenderComponentPresentation to render the linked Component with the template that you want to use.
<!-- TemplateBeginRepeat name="Component.Fields.LinkFieldName" -->
##RenderComponentPresentation(Field, "tcm:1-23-32")##
<!-- TemplateEndRepeat -->
Where tcm:1-23-32 it the TCM URI of a Component Template that simply renders the name of the Component as a hyperlink. Inside the DWT that you use in tcm:1-23-32 you can then simply refer to all fields and properties of the linked Component like Component.Title, Component.Fields.Field1, etc.
Note that the relevant topics have been covered already in these other questions/answers:
rendering the title of a linked component - Looping through the multiple component links to get the schema name of the linked component in Dreamweaver TBB in SDL Tridion 2011
getting values of a linked component - Retrieving values of a linked component in Dreamweaver TBB - and making it SiteEditable
handling nested embedded schemas - How to handle nested repeating regions in Dreamweaver TBBs in SDL Tridion 2011 SP1
If somehow these did not help you enough, I suggest you post the XML of your Component and the DWT that you're trying to make work.
Here a quick sample using C#
Session session = engine.GetSession();
Item componentItem = package.GetByName(Package.ComponentName);
Component component = new Component(new TcmUri(componentItem.GetValue("ID")), session);
ItemFields itemFields = new ItemFields(component.Content, component.Schema);
IEnumerable<ComponentLinkField> ie = itemFields.OfType<EmbeddedSchemaField>().OfType<ComponentLinkField>();
for (IEnumerator<ComponentLinkField> e = ie.GetEnumerator(); e.MoveNext(); ) {
Component linkedComponent = e.Current.Value;
}
By using Linq you can navigate through the fields structure really quick and get results. It will give you the Component Links in the third level, of course you can use the same to go deeper in the structure.

How can I render component link field in a DWT?

I have a schema containing a multi-value field of type component link.
How can I render this field (component link with its template) when I write a DWT TBB for this component?
A Component Link field links to a Component - it does not specify a template. So I'll assume you want to specify the Component Template to use on the DWT.
<!-- TemplateBeginRepeat name="Component.Fields.YourComponentLinkFieldName" -->
#RenderComponentPresentation(Field, "tcm:1-2-32")##
<!-- TemplateEndRepeat -->
So this loops over all values of the multi-value field names YourComponentLinkFieldName and render the Component linked in there with Component Template tcm:1-2-32.
All of these topics are relevant to your question:
Retrieving values of a linked component in Dreamweaver TBB - and making it SiteEditable
How to handle nested repeating regions in Dreamweaver TBBs in SDL Tridion 2011 SP1
Retrieving values of a linked component in Dreamweaver TBB - and making it SiteEditable
I suggest you read them and apply your understanding of them.

Resources