Question about templates, styleblocks and

19 views
Skip to first unread message

Alejandro Hirmas

unread,
Jul 23, 2021, 9:25:13 AM7/23/21
to oTree help & discussion
I am trying to generate a template for a type of page. Now, within that page I added a app_styles and  app_scripts blocks. Now, if the page that extends this template also haves a such blocks, the one from the template dissappears. How should I do it such that this does not happen?

Thanks in advance!

Chris @ oTree

unread,
Jul 23, 2021, 11:30:08 AM7/23/21
to Alejandro Hirmas, oTree help & discussion
There are 3 levels of blocks:

global_scripts
app_scripts
scripts

Any scripts that are specific to the template should go in the “scripts” block. That way they will not overwrite the app_scripts.

Same for styles.

Another approach rather than using blocks is to put the global scripts in an includable template or static file, then include it explicitly in every page that needs it. It’s a bit more repetitive but easier to understand.

Sent from my phone

On Jul 23, 2021, at 7:25 AM, Alejandro Hirmas <janoh...@gmail.com> wrote:

I am trying to generate a template for a type of page. Now, within that page I added a app_styles and  app_scripts blocks. Now, if the page that extends this template also haves a such blocks, the one from the template dissappears. How should I do it such that this does not happen?

Thanks in advance!

--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/a5e600eb-24ba-4ebf-9ee8-c1e27e0d2febn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages