1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Is tag stored anywhere other than the url

Is tag stored anywhere other than the url

5 posts, 0 answered
  1. Jon Ingersoll
    Jon Ingersoll avatar
    32 posts
    Registered:
    12 May 2009
    06 Jun 2011
    Link to this post
    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
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 Jun 2011
    Link to this post
    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
  3. Jon Ingersoll
    Jon Ingersoll avatar
    32 posts
    Registered:
    12 May 2009
    06 Jun 2011
    Link to this post
    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
  4. Jon Ingersoll
    Jon Ingersoll avatar
    32 posts
    Registered:
    12 May 2009
    06 Jun 2011
    Link to this post
    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
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    09 Jun 2011
    Link to this post
    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
5 posts, 0 answered