Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

The 4th edition of the Campaign Community Lens newsletter is out now!

javascript template: how to include another template?

Avatar

Level 3

I guess what I am looking for is similar to the "include view" in the personalization step, but I can not find my way in the documentation. Unlike include view, I have content A including the id of Content B, and I want the template for content A to run and include the template of content B NOT in the personalization step but in the first run. I do this from a jssp-page with TransformFromId using ncm.publishing, but how can I achive this in the javascript template?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Community Advisor

Hello @RBE_jonas 

This JSSP contents are saved as delivery templates? Can you elaborate more what you want to achieve?
You want to include another JSSP page? you can do that from JSSP to include another page?

 

Marcel Szimonisz

MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/

Avatar

Level 3

Hi Marcel, thank you for picking this up!

 

So, I'm setting up a content template, where the content contains ids of other contents, used like blocks; so one block can be reused and included in several contents together with other blocks like a parent containing several children.

 

I have one template for the parents, and one template for the children. The children template works fine, but in the parent template I would like to call the children template with the child-id, and get a transformed result. Like you can do in JSSP with transformFromId but it is not available in templates.

 

Now I have to have the template load the cild-content, and parse it using functions in the parent template. These functions are already defined in the child-template and keeping them both updated so they look the same is a hassle.

 

Hopes that makes it clear, but please feel free to inquery further if I can be any clearer.

 

Avatar

Community Advisor

This is for JSSP pages right? 

I have found this JSSP might be useful for you 
xtk:themePreview.jssp

They simply inject formPreview  item into the html content

 

Marcel

Avatar

Community Advisor

Ok i think i understand 

You have content templates and want to use them on JSSP page.. okey take a  look at xtk:themePreview.jssp you can reuse that structure. but you will query content templates and simply printing their source html same as in the themePreview.jssp 

[source/html]

 

But you say the function transformFromId should do that. maybe someone else can help here.. i can try to play with the function later 🙂 you can put here what you have so far

 

 

Marcel