anjan
New Creator

Share same asset across multiple templates

Hi, It's a .net multipage application built on traditional CMS Crownpeak. There are different templates used for different pages. usually a template consists of input.aspx and output.aspx as common 2 files. I have assets created.  Can assets be shared across templates. Can I access assets of template1 in template2 ?  As of now all assets are being used for corresponding templates only. Please advise. I mean to say how can I access one content across multiple templates ?

0 Kudos
5 Replies
DavidGreenberg
Crownpeak Employee
Crownpeak Employee

Re: Share same asset across multiple templates

Based on your request it sounds as if you are attempting to read data from one asset into another.

 

To do this you need to load the asset using Asset.Load() (https://developer.crownpeak.com/Documentation/CMSAPI/Asset/Methods/Load(String).html)

 

Once you load the asset you can read the content directly from it as you would any other asset.

 

i.e. if you wanted to read the field "results" from a different asset with id 1234 you would use

Asset temp = Asset.Load(1234);

String field = temp["results"];

 

--


David Greenberg
Customer Support Engineer

## If I’ve helped, accept this response as a solution so that other’s can find is more quickly in the future.
## Have thoughts on Crownpeak products? We'd love to hear them. Speak with the Crownpeak Product Team..

0 Kudos
anjan
New Creator

Re: Share same asset across multiple templates

The link is giving 404 error

0 Kudos
DavidGreenberg
Crownpeak Employee
Crownpeak Employee

Re: Share same asset across multiple templates

Hello Anjan,

 

Appologies, the link did not paste correctly:

 

https://developer.crownpeak.com/Documentation/CMSAPI/Asset/Methods/Load(String).html

 

 

--


David Greenberg
Customer Support Engineer

## If I’ve helped, accept this response as a solution so that other’s can find is more quickly in the future.
## Have thoughts on Crownpeak products? We'd love to hear them. Speak with the Crownpeak Product Team..

0 Kudos
anjan
New Creator

Re: Share same asset across multiple templates

still it's giving 404 error

0 Kudos
DavidGreenberg
Crownpeak Employee
Crownpeak Employee

Re: Share same asset across multiple templates

Hello,

 

Appologies https://developer.crownpeak.com/Documentation/CMSAPI/Asset/Methods/Load(String).html

--


David Greenberg
Customer Support Engineer

## If I’ve helped, accept this response as a solution so that other’s can find is more quickly in the future.
## Have thoughts on Crownpeak products? We'd love to hear them. Speak with the Crownpeak Product Team..

0 Kudos