Well my code shows the typical sub template usage. Not the ideas I put forward.Basically I am asking if I wanted to do dynamic templates can I do or more importantly should I do either of the following.1. Dynamically alter the cached template after parsing it in the program to insert a sub template call as needed.2. Have the template just allow a large block of HTML and use the sub template to build that html before passing it to the parent template.If that doesn't make it clearer I can work up the two proposed styles and share via github.
Actually you are hitting on I think my overall problem with my solutions so far and the usage of templates. OK granted this is a side issue to my original post. Anyway all my structs that define content type end up having a variable in them of type template.HTML. Honestly what I would need if I went forward with this solution is something to sanitize that html and only leave some formatting tags and functionality for the <br> tag. The original reason I even went with that was to get a newline through to html/template.
I should mention that as I am trying to approach this experiment from multiple angles I also have some duplicate routes defined to return JSON and process the front end through Angular instead. That may be a better way to handle dynamic templating on that side. Of course I am also a bit new to angular. I had a skeleton angular front end I tested based on a static rendition of the expected output and that worked but it is not working right now against the golang feedback.
I know the problem an it is how my golang is structuring the json return. On my todo list of next items to fix. I know what is wrong with my golang json output however the odd thing is it is based off an restful api example I found from a site http://thenewstack.io/make-a-restful-json-api-go/.My output in json is missing a couple things when I encode it against an array of my struct items. Like the container parent description and commas between the items.So I keep mentioning this in reference to posts but part of the reason I want to be able to do what I am saying is almost more CMS like and be able to dynamically place blocks of data in the layout of the site.KenThe thing that is unclear to me is the actual context how you intend to use it. E.g. what are the security and performance implications, how are the dynamic templates built, who will write the templates, how do the templates get to the blog engine, how are they modified etc.The FuncMap approach https://play.golang.org/p/KsjcjFNkmC ... although... remember that all the templates and "template.HTML" must be trusted, otherwise you'll get a possibility for injection attack.+ Egon
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/CV4_xTCGY8o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.