Is tag stored anywhere other than the url
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
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
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
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;
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