Integrate dynamic code to template?


#1

Hello,

since some hours I am reading here in the forum to find a solution for my template problem…

We have a running webshop which has a header / left navigation and a footer.
We want to integrate discourse as smooth as possible for the users.

My question now is if it is possible to get some dynamic content to be rendered in template.

My suggestion is to make a small crawler on my own page to get the HTML for header/footer/navi each day.

My problem now is how to get this HTML in the template for discourse?
Has somebody some idea?

Thanks in advance!


(Dean Taylor) #2

Discourse doesn’t use templates quite as you describe them - however there are theme settings and now “theme components” which may be helpful to review.

If you are trying to change the Discourse theme settings via API calls you are likely going to need to reverse engineer the API calls as currently there is no documentation other than the code for this, see this topic:


#3

hm, not the answer I hoped for :wink:

But I don’t think that I have to go via the API…
The parts of code I want to change are rendered in first view.
E.g. I want to replace some HTML Code in Header or in Main.

Perhaps there is a way to replace some code at rendering time? Or include something to the header?
Perhaps I can edit the .erb files via shell?

One solution is to replace code via jQuery, but this could look ugly for users…


#4

@DeanMarkTaylor Digging into this… we are also trying to do something similar and I wonder if you have some insight. The goal is to, server-side:

  1. Hit an internal service to get header markup
  2. Add that “latest and greatest” markup to the and

The head markup from that service includes some custom functions we use for tracking, etc and want to keep it up to date rather than hardcoding it via the Admin/Customize/Theme panel.

Thoughts?