I am trying display the content from taxonomy by using Ektron CMS with ASP .Net
By using the taxonomy path i got the id and trying to display the content.
But i am getting content as null.
Please let me know the possible solutions to solve this.
Waiting for experts answers.
Thanks,
In my development environment, I have the following taxonomy:
const string eventsTaxonomyPath = "\\Upcoming Events";
const long eventsTaxonomyId = 89;
It sounds like you already found this method (or something like it) in what I like to call the "Legacy API":
var taxonomyApi = new Ektron.Cms.API.Content.Taxonomy();
var taxonomyId = taxonomyApi.GetTaxonomyIdByPath(eventsTaxonomyPath);
Without any info on what version you're on, I'll assume it's a recent (8.5+) version. The Framework API makes it really easy to get the content from a given taxonomy. Below are a couple of ways that work on v9.0 and will most likely work in anything 8.5+ -- in the developer briefing webcast the only major change for the Framework API in v9 was the inclusion of the e-commerce namespace.
Getting the full taxonomy tree via the TaxonomyManager:
var taxonomyItemManager = new Ektron.Cms.Framework.Organization.TaxonomyManager();
var taxData = taxonomyItemManager.GetTree(eventsTaxonomyId, includeItems: true);
Getting all the content recursively from a given taxonomy folder via the ContentManager:
var contentManager = new Ektron.Cms.Framework.Content.ContentManager();
var criteria = new ContentTaxonomyCriteria();
criteria.AddFilter(eventsTaxonomyPath, true);
criteria.ReturnMetadata = true;
var content = contentManager.GetList(criteria);
The potential downside to the ContentManager way is that you lose the hierarchical taxonomy structure. The upside to using the ContentManager is that you can tell it to include all the metadata for each content block. That's not possible with the TaxonomyManager or TaxonomyItemManager.
My guess is that the "Get Content By Taxonomy" function you are using by default does not fetch the content. You can either-
a) Use the ID to get the content via the content manager API
b) Investigate if the function you are using has an override to include content.
Related
I want to import data from a third-party module into 2sxc as content within a razor script.
IEnumerable<IDictionary<string, object>> GetData ()
{
...
}
var data = GetData();
App.Data.Create ("ContentTypeName", data);
The code above imports data into the App, but it is not linked to a content block. How do I create a new content block or access the current content block and link that data to it?
Requires a bit deeper knowledge of how Content items get attached to a module instance. There are good articles and docs on that. The key is understanding ContentGroups, so in a View, you are inside a module, and therefore your ContentGroup can be accessed like this (2sxc v9.43.x code, it may be different after ~v10.25.x):
var cGroups = App.ContentGroupManager.GetContentGroups();
var cgGuid = Dnn.Module.ModuleSettings["ToSIC_SexyContent_ContentGroupGuid"];
System.Guid cgG = Guid.Parse(cgGuid.ToString());
ContentGroup myCG = App.ContentGroupManager.GetContentGroup(cgG);
<p>My ContentGroup has #myCG.Content.Count() Entities</p>
Hopefully that gives you enough to search on and figure out from there.
Also, if you want to do it manually, that is what the Replace and Add Existing (blue 2sxc buttons) do. They show you ALL the items in the ContentType and give you to option to add an existing slot/item or replace the current item in it's slot.
In order to insert an article to Drupal there are thee ways of doing that:
by admin panel - really slow and not feasable if talking about 400 articles
by pure sql - number of tables that have to maintained and calculated (content, core, cat etc.) is quite high and it's not really reliable
by using drupal API - that's something that I was trying to implement but can't find a good documentation on it. What I'm trying to achieve is to use drupal classes and insert content (ie. running a PHP file with (catid,title,introtext....))
Example: what i want to add node in xyz.com/drupal site but my php code should be run in irankmedi.com
Can you please point me into direction where I can find some info on how to manage articles and categories this way?
Thanks in advance
If your request is very specific and you can't find a module that does what you need it shouldn't be too difficult to make a module on your own and import (create drupal) content from your code. Should be something like this:
Create a php file that will do the job.
At start of your script include standard Drupal's bootstrap code so you'll have all Drupal's functionality available in your script
Make code that will read content (from database or feed or something else).
Use Drupal api to insert node programatically:
https://www.drupal.org/node/1388922
Call your script manually or set cron to call it on specific time periods.
First you have to read RSS feed in drupal custom module. Then, following code can create node programatically.
$node = new stdClass();
$node->type = 'blog'; // This type should exist
node_object_prepare($node); // Sets some defaults.
$node->language = LANGUAGE_NONE; // The language of the default
$node->title = "testnode";
$node->body[LANGUAGE_NONE][0]['value'] = "Body";
node_save($node); // function that actually saves node in database
I would like to get and display the itemxml of the selected item from the Tridion CME.
I was able to get the Itemxml from my VM server when i give the tcm id in the browser.
However, i would like to get the same information from Tridion GUI Extension.
I am able to get the selected item tcm id. Is there any way to get the itemxml using coreservice?
or is there any other way to get this?
At the moment there's no way you can get Item XML through core service. Item XML you have seen was provided to you by TCM Protocol handler that might not be there in future versions. If you want to show item XML in CME - take a look at this extention by Yoaw:
http://sdltridionworld.com/articles/sdltridion2011/tutorials/GUIextensionIn8steps.aspx
Also, keep in mind that not all properties of an item might be exposed in Xml, sometimes you have more info in Data object
Take a look at the PowerTools, it has an ItemXML viewer (written by Robert Curlette) for all items in SDL Tridion
http://code.google.com/p/tridion-2011-power-tools/wiki/ItemXML
The XML is loaded on a tab using JavaScript as follows:
ItemXmlTab.ItemXmlTab.prototype.updateView = function ItemXmlTab$updateView()
{
if (this.isSelected())
{
var xslPath = $ptUtils.expandPath("/PowerTools/Client/ItemXml/ItemXmlTab.xslt", true);
$xml.loadXsltProcessor(xslPath, function (value)
{
var xmlSource = $display.getItem().getXml();
// Filter out all spacing characters
xmlSource = xmlSource.replace(/\t|\n|\r/g, "");
var html = $xml.xsltTransform(value, $xml.getNewXmlDocument(xmlSource), null);
$dom.setOuterHTML($("#itemXml"), html);
});
}
};
You can view the source code of the extension at http://code.google.com/p/tridion-2011-power-tools/source/browse/#svn%2Ftrunk%2FPowerTools.Editor%2FPowerTools%2FClient%2FItemXml%253Fstate%253Dclosed
You can get the item XML via CoreService, but this will get you the Tridion R6 (2011) Xml format, which is not the same you would see before.
Sample code available here.
I tend to have a page "GetItemXml.aspx" on my Tcm servers that I then call with a Uri as a parameter, and then this page would return the Item Xml.
Article written by Yoav Niran (Url in the post of user978511) is perfect for your requirement.
if you are still facing any issue and in hurry to get it working just perform below steps -
1- Download the extension.
2- Apply the steps 7 and 8 of this article to configure this extension.
I’m very new to programming with RSS feeds to please forgive me if this sounds like a really general question.
Is it possible to take multiple RSS feeds from multiple sites and combine them as a single object to show to the end user?
For example, could I take the latest news headlines from one site, the latest blog updates from a totally different site and combine them into a single list to show the user?
I have seen this sort of question asked before and it seems like its possible, but the slight twist is I want to let the user add any feed that they want from any source
I’m looking to do this in ASP.NET
Many thanks!
You can use the SyndicationFeed class to work with RSS feeds in .Net.
You probably want to do something like this (untested):
var allItems = new List<SyndicationItem>();
foreach(var feedUrl in whatever) { //In your list of urls
using(var reader = XmlReader.Create(url))
allItems.AddRange(SyndicationFeed.Load(reader).Items);
}
var newFeed = new SyndicationFeed(items);
//Do something with newFeed
You should add error handling in case one of the feeds is unavailable or invalid.
It is possible, yes.
For a good example of this kind of thing in action, check out Yahoo! Pipes.
This would probably be a good application of LINQ to XML, but I'll leave the implementation up to you.
How do I create an rss feed in ASP.Net? Is there anything built in to support it? If not, what third-party tools are available?
I'm thinking webforms, not MVC, though I suppose since this isn't a traditional page the difference may be minimal.
The .NET Framework 3.5 has added a SyndicationFeed Class which allows you to create and/or consume feeds in Atom 1.0 and RSS 2.0 formats.
SyndicationFeeds Class on MSDN
For built-in, there's nothing stopping you from using XmlDocument or XDocument (3.5) to build up the required XML for RSS. It's more work than it's worth though.
I use the Argotic Syndication Framework and serve the feeds through Generic Handlers (.ashx) with the content type set to text/xml.
The RSSToolkit is also nice. It comes with an RSSDataSource control if you're into that sort of thing. It also includes a control that will automatically insert the meta tag required for feed autodiscovery in browsers. I found the build provider for creating feeds to be a little kludgey however.
Here's an RSS framework created by a Microsoft developer: ASP.NET RSS Toolkit
Use one of the libraries available for generating the actual RSS. For example: http://www.rssdotnet.com/
If you check the code examples page at the bottom:
http://www.rssdotnet.com/documents/code_examples.html
you will find the code for clearing the content type in an ASP.net Page and outputting the RSS.
Something along the lines of (not tested, not compiled, just typed):
public void PageLoad()
{
// create channel
RssChannel _soChannel = new RssChannel();
// create item
RssItem _soItem = new RssItem();
_soItem.Title = "Answer";
_soItem.Description = "Example";
_soItem.PubDate = DateTime.Now.ToUniversalTime();
// add to channel
_soChannel.Items.Add(_soItem.);
// set channel props
_soChannel.Title = "Stack Overflow";
_soChannel.Description = "Great site.. jada jada jada";
_soChannel.LastBuildDate = DateTime.Now.ToUniversalTime();
// change type and send to output
RssFeed _f = new RssFeed();
_f.Channels.Add(channel);
Response.ContentType = "text/xml";
_f.Write(Response.OutputStream);
Response.End();
}
Hope that helps.
You could take a look at Argotic. It is a really cool framework.
http://www.codeplex.com/Argotic
Create an HTTP Handler to create a RSS feed