I use a custom DNN module which with a tabbed bootstrap navigation inside. It was build with Knockout-JS. Now I want to add some pieces of content inside this module, e.g. one html control per navigation tab and some explainatory popovers. I would like to manage that content with DNN if somehow possible.
One possibilty would be to use DNN headless and have my module read the content from DNN. Don't know if this is possible at all.
I am thankful for any ideas about this!
Naively I was thinking about placing a number of html modules on an edit-only page and then import that content (the html content) via a javascript function. I am aware that this does not sound like a plan. Maybe I should add the content to the page (just under my costum module), edit the content there, hide it via css and copy the content into my knockout construct at runtime. I was hoping there is a more elegant solution without employing an actual (additional) headless CMS.
Hi Tim,
Your opening sentence was 'I use a custom DNN module...' but for this to work you probably need to be the developer of the module. For now I will assume that is the case ;-)
Your idea about placing a number of text editors in an edit-view does not sound like a bad idea at all, although I would probably use the settings-view instead. The CK-Editor can be used as far as I recall to allow you to edit the text without concern of html tags etc. but if that is a pain to use other options could be included in your module instead, such as TinyMCE or similar.
Add the required number of editors to your settings-view and store the text in the TabModuleSettings. The texts can be loaded again in the view and placed in the page in a script section to gain access to it from javascript if that is your weapon of choice.
// SETTINGS FILE CODEBEHIND modules.UpdateTabModuleSetting(TabModuleId, "Setting1", myEditor1.Text);
Loading the data in the codebehind of the view module is just as easy as getting the data from an array.
// VIEW FILE CODEBEHND public string MyFirstText { get; private set; } // PageLoad if (Settings.ContainsKey("Setting1")) { this.MyFirstText = Settings["Setting1"].ToString(); }
// VIEW FILE <script> var myFirstText = '<%= MyFirstText %>'; </script>
See the Chris Hammond template to build a module for more details on how to add data in your module from the settings view.
If you are not the developer things will soon become overcomplicated when adding html-modules and keeping track of them and their IDs in your page, so let's hope that is not the case ;-)
# DnnBro
Thank you, DnnBro! I am using Chris Hammonds templates (an age old version) and tried your suggestion with just one Setting. Will totally do for the content pieces in my control! I remember now having used settings for content... but that was about 10 years ago. I can probably expand on your idea a bit and use a collection of settings so I can add new stuff without having to recompile / restart the site.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.