Creating global text content

Jason Delaplain asked on March 30, 2016 21:17

I have been doing research on the best way to create global text strings, so that company products and related text can be managed in one place (for spelling, and page association), but am not finding anything concrete. Do I need to create the text strings in a Resource file, and then associate custom Web Parts to use the Resource file? Thanks.

Correct Answer

Jan Hermann answered on April 1, 2016 11:43

Hello,

Do you mean something like this?

http://devnet.kentico.com/articles/content-blocks

Best regards,
Jan Hermann

1 votesVote for this answer Unmark Correct answer

Recent Answers


Virgil Carroll answered on March 30, 2016 22:41

Jason,

You could do it that way, but it would depend on how manageable you want this to be. Doing resource files are going to keep it limited to a dev updating. Other suggestions, depending on how you need to do this, would be to store the values in a custom table, or a custom module where you could store the strings associated with a a product ID.

Take a look in the SQL side at how Kentico manages Resource Strings in the CMS_ResourceString table and might find a pattern to follow around that.

Hope it helps point you in the right direction.

0 votesVote for this answer Mark as a Correct answer

Laura Frese answered on March 30, 2016 23:05

I agree with Virgil, the data will be easier to manage if it is in a custom table. You can then create transformations and add a repeater to the page to display the data. If you need to use macros to get the data like you can with resource strings, you can write a custom macro method. Some helpful links:
Working with Resource Strings
Creating Custom tables
Create Custom Macro

0 votesVote for this answer Mark as a Correct answer

Jason Delaplain answered on March 30, 2016 23:13

Thanks Virgil and Laura. I'll take a look at these options.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on March 30, 2016 23:34

If you want to use a lot of the out of the box tools like taxonomy (categories, tags, etc.), linked pages, related pages and search abilities, I'd create a new page type and store this content in a folder in the content tree. Then on the pages you want to display it on you can use a repeater some other listing display and display that content based on the taxonomy you've applied or the related page you've setup. This gives you a pretty simple UI to work in and allows the content users to stay in one place to manage the content and it allows you to reuse it pretty easy without a lot of setup or configuration.

Jeroen Furst has a [great post here](http://blogs.jeroenfurst.nl/blog/april-2015/tips-for-maintaining-relationships-(a-k-a-relation) about these features and links to documentation.

2 votesVote for this answer Mark as a Correct answer

Jason Delaplain answered on March 30, 2016 23:53

Thanks Brenden. I do want to use as much out-of-the-box tools as possible. I'm still looking into the options replied here, but here's a scenario: I have a handful of products, and each product may share an attribute such as "Super powerful and special.". I want to manage that string in one place for global consistency, but be able to associate it to one ore more products (or page web part content).

I have some early ideas of how I might use the Page Type/Web Parts/Custom Tables to accomplish it, but will need to learn more.

0 votesVote for this answer Mark as a Correct answer

Laura Frese answered on March 30, 2016 23:55

Have you thought about using Tags?

0 votesVote for this answer Mark as a Correct answer

Jason Delaplain answered on March 31, 2016 00:06

Yea, we will need to use those too lol.

If the tags can be used as macros, that may work for inserting into text content.

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on April 1, 2016 19:25 (last edited on April 1, 2016 19:25)

Hello,

Jan's recommendation is the best solution for your case as you just need a global respository for your resource strings. He himself wrote that article.

https://devnet.kentico.com/articles/content-blocks

Surprisingly it's missing from the documentation or I could not find it?

Thanks, Chetan

0 votesVote for this answer Mark as a Correct answer

Jason Delaplain answered on April 1, 2016 19:30

Thank you Jan. That looks like what I need! I think all the responses can accomplish what I need in different ways, and I am probably going to use them for other things, but content blocks resolves this particular issue.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 4, 2016 16:28

The module Jan provided works, unfortunately, that solution provides a custom module with custom code and requires content editors to write or use macros which not all editors are savvy with. What you're looking for can be accomplished simply, without any custom code using the tools I suggested. Good luck, maybe report back how thing worked out and how your maintenance of upgrades goes.

0 votesVote for this answer Mark as a Correct answer

Jason Delaplain answered on April 4, 2016 16:51 (last edited on April 4, 2016 16:52)

Brenden, I looked into creating a page type and using a repeater to display the stored tree info, but I am not sure (yet) how that would work in the scenario where I am trying to have a word and phrase dictionary where I'm inserting them into various title and content areas.

The content blocks would work because I could create the content blocks by inserting macros to localized resources. Then the content blocks are usable by editors as they don't need to manage the macros in them, but can still utilize the reference to a centrally managed resource string. Again, I still need to actually dive into this to see if it will ultimately work, but so far it does seem like a solution.

In regards to future updates to Kentico-- are you saying that this package would not be retained?

Cheers! Jason

0 votesVote for this answer Mark as a Correct answer

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