Help how to use block code correctly

there are 2 templates named A, B
in A, I want invoke block code in B
how to do that.

I tried use
{{ block “code_in_b” . }}{{ end }} in A
and B writhed
{{ define “code_in_b” }} {{ end }}
but can’t invoke code in B

I down’t know how to do. please tell me correct way. thanks a lot

Block definitions can be made only in a baseof.html template:

have any other way?
actually my target is multiple code fragments in one file are fully reuse(invoke) to template.
my imagine: if code is
//code start
this is code content
//code end
then use {{ code }} can reuse it in other templates
if have other way is ok.
thanks

No there is no other way for blocks, they are first placed in the baseof.html and then can be defined/overriden in children templates.

Perhaps Partial Templates suit your project’s structure better.

oh. I’m read it. as you see. more code segment more partial templates. it cause management problems.
thanks for help. I’d think to use partial templates if not another way.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.