Is tag stored anywhere other than the url

Posted by Community Admin on 04-Aug-2018 14:45

Is tag stored anywhere other than the url

All Replies

Posted by Community Admin on 06-Jun-2011 00:00

I'm setting up a page on our site that will be filtering new, events, blogs, etc... on tags. We'll also have a couple of our custom controls that will need to filter.

I'm wondering if Sitefinity controls are just reading the tag from the URL "-in-Tags/Tags/tagname/" or if it's also being store in the session.

-Jon

Posted by Community Admin on 06-Jun-2011 00:00

Hi Jon ,

We read the url by using TaxonomyEvaluator class which defines the way that the url is formatted.

Regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 06-Jun-2011 00:00

Ivan,

Thank you for the quick response!  From the API it looks like I'll want to use Evaluate or ParseTaxonomyParams do you have a suggestion on which one is better? All I care about it getting the name of the tag.

-Jon

Posted by Community Admin on 06-Jun-2011 00:00

i'm trying to use the ParseTaxonomyParams method to get the tag but I'm getting an error:

string tagname = "";
string taxonomyName = "Tags";
if (Request.Url.AbsolutePath.Contains("-in-Tags/Tags/"))
    Telerik.Sitefinity.Web.UrlEvaluation.TaxonomyEvaluator tagEval = new Telerik.Sitefinity.Web.UrlEvaluation.TaxonomyEvaluator();
    tagEval.ParseTaxonomyParams(Telerik.Sitefinity.Pages.Model.UrlEvaluationMode.UrlPath, Request.Url.AbsolutePath, "-in-Tags/Tags/", out tagname, out taxonomyName);
return tagname;

It's giving me a null exception: Value cannot be null, Parameter name: pattern.

I'm only guessing at some of values I need to send the method, so any advice would be appreciated.  Thanks,

-Jon

Posted by Community Admin on 09-Jun-2011 00:00

Hello Jon,

Check whether the tagEval is null. If it is null create it as shown below



TaxonomyEvaluator taxonomyEval = this.GetConfiguredTaxonomyEvaluator();


private TaxonomyEvaluator GetConfiguredTaxonomyEvaluator()
       
            var taxonomyEval = new TaxonomyEvaluator();
            var dataConfig = Telerik.Sitefinity.Configuration.Config.Get<DataConfig>();
            var config = dataConfig.UrlEvaluators["Taxonomy"];
            taxonomyEval.Initialize(config.Parameters);
            return taxonomyEval;
       


then call

taxonomyEval.ParseTaxonomyParams("UrlEvaluationMode", "url", "UrlKeyPrefix", out taxonName, out taxonomyName);

Kind regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed