Kentico - Insert reusable numbers in text on multiple pages

radhu4884 matrix asked on December 28, 2018 11:09

Not sure if the title is clear enough but here's what I want. Throughout my site, I have some numbers that are repeatedly used on multiple pages - such as we're serving 1,000 clients in 80 major cities in the world. Before Kentico, I can store these numbers (1,000 and 80) as constants and can call/insert them onto the page text wherever and whenever I want easily. With Kentico, I'm not sure how to do it yet. Is there something equivalent? Thanks for your input!

Recent Answers

David te Kloese answered on December 28, 2018 11:52 (last edited on December 10, 2019 02:31)


This seems like a good fit with the Localization features:

You could add a key like mycomp.constants.nroclients and set it to 1.000. Doesn't matter if you have just 1 language.

In code you can use it as:

string localizedResult = ResHelper.GetString("mycomp.constants.nroclients");

In the admin interface you could use



{% GetResourceString("mycomp.constants.nroclients") |(identity)GlobalAdministrator%}

if the field allows macro's to be resolved.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on December 28, 2018 15:10

If you want editors to be able to manage these values you can create a content only page type with a few fields in it. For instance, SettingType, SettingTitle, SettingValue. Type could be a list of whatever values you want but allow you to draw them out using a query like WHERE SettingType = 'clients'

Then place those "pages" under a folder called "settings" in the content tree. This will allow the content editors to edit them as needed.

We've also setup custom tables to handle things like this but found it to be easier to work with the content only page type.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.