Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

In the Event System you're getting only the component as input. It is not part of the rendering process, and it sounds like you're looking for a ComponentPresentation. In layman's terms, you're using the wrong extension point.

On the CM side creating a regular Template Building Block should be more appropriate because rendering is triggered when someone is publishing. You can also check the context of publishing in a TBB (to differentiate between rendering in TemplateBuilding or Preview modes).

Using a Storage Extension is also appropriate for the use case you describe. See Will's post and example of how he did a similar thing for CDN integration: http://sdltridionworld.com/articles/sdltridion2011/tutorials/cdn_integration.aspx and http://www.tridiondeveloper.com/some-thoughts-on-cmscdn-integration.

If you are adamant about doing it CM side and not using either of the above, then you're entering somewhat uncharted waters. What you can try to do is re-create the CP in the Event System by running it against the "News" Component Template:

        BuiltInFunctions f = new BuiltInFunctions();
        string renderedCp = f.RenderComponentPresentation(component.Id.ToString(), "tcm:1-2-32");

Though, I'm not sure the above will work in the context of the Event System. I've only tested it as far as compiling.

Another way you can grab the rendered component presentation is actually by using a Custom Renderer as discussed here: http://stackoverflow.com/questions/14655972/whats-a-non-delivery-custom-rendererhttps://stackoverflow.com/questions/14655972/whats-a-non-delivery-custom-renderer (warning: I don't know if anyone has ever used one though, but it exists).

In the Event System you're getting only the component as input. It is not part of the rendering process, and it sounds like you're looking for a ComponentPresentation. In layman's terms, you're using the wrong extension point.

On the CM side creating a regular Template Building Block should be more appropriate because rendering is triggered when someone is publishing. You can also check the context of publishing in a TBB (to differentiate between rendering in TemplateBuilding or Preview modes).

Using a Storage Extension is also appropriate for the use case you describe. See Will's post and example of how he did a similar thing for CDN integration: http://sdltridionworld.com/articles/sdltridion2011/tutorials/cdn_integration.aspx and http://www.tridiondeveloper.com/some-thoughts-on-cmscdn-integration.

If you are adamant about doing it CM side and not using either of the above, then you're entering somewhat uncharted waters. What you can try to do is re-create the CP in the Event System by running it against the "News" Component Template:

        BuiltInFunctions f = new BuiltInFunctions();
        string renderedCp = f.RenderComponentPresentation(component.Id.ToString(), "tcm:1-2-32");

Though, I'm not sure the above will work in the context of the Event System. I've only tested it as far as compiling.

Another way you can grab the rendered component presentation is actually by using a Custom Renderer as discussed here: http://stackoverflow.com/questions/14655972/whats-a-non-delivery-custom-renderer (warning: I don't know if anyone has ever used one though, but it exists).

In the Event System you're getting only the component as input. It is not part of the rendering process, and it sounds like you're looking for a ComponentPresentation. In layman's terms, you're using the wrong extension point.

On the CM side creating a regular Template Building Block should be more appropriate because rendering is triggered when someone is publishing. You can also check the context of publishing in a TBB (to differentiate between rendering in TemplateBuilding or Preview modes).

Using a Storage Extension is also appropriate for the use case you describe. See Will's post and example of how he did a similar thing for CDN integration: http://sdltridionworld.com/articles/sdltridion2011/tutorials/cdn_integration.aspx and http://www.tridiondeveloper.com/some-thoughts-on-cmscdn-integration.

If you are adamant about doing it CM side and not using either of the above, then you're entering somewhat uncharted waters. What you can try to do is re-create the CP in the Event System by running it against the "News" Component Template:

        BuiltInFunctions f = new BuiltInFunctions();
        string renderedCp = f.RenderComponentPresentation(component.Id.ToString(), "tcm:1-2-32");

Though, I'm not sure the above will work in the context of the Event System. I've only tested it as far as compiling.

Another way you can grab the rendered component presentation is actually by using a Custom Renderer as discussed here: https://stackoverflow.com/questions/14655972/whats-a-non-delivery-custom-renderer (warning: I don't know if anyone has ever used one though, but it exists).

added 172 characters in body
Source Link
Nickoli Roussakov
  • 18.4k
  • 4
  • 31
  • 62

In the event systemEvent System you're getting only the component as input. Sounds It is not part of the rendering process, and it sounds like you're looking for a ComponentPresentation. So what In layman's terms, you're using the wrong extension point.

On the CM side creating a regular Template Building Block should be more appropriate because rendering is triggered when someone is publishing. You can also check the context of publishing in a TBB (to differentiate between rendering in TemplateBuilding or Preview modes).

Using a Storage Extension is also appropriate for the use case you describe. See Will's post and example of how he did a similar thing for CDN integration: http://sdltridionworld.com/articles/sdltridion2011/tutorials/cdn_integration.aspx and http://www.tridiondeveloper.com/some-thoughts-on-cmscdn-integration.

If you are adamant about doing it CM side and not using either of the above, then you're entering somewhat uncharted waters. What you can try to do is create anotherre-create the CP in the event systemEvent System by running it against the a"News" Component Template:

        BuiltInFunctions f = new BuiltInFunctions();
        string renderedCp = f.RenderComponentPresentation(component.Id.ToString(), "tcm:1-2-32");

Though, I'm not sure the above will work in the context of the event systemEvent System. I've only tested it as far as compiling.

Another way you can grab the rendered component presentation is actually by using a Custom Renderer as discussed here: http://stackoverflow.com/questions/14655972/whats-a-non-delivery-custom-renderer (warning: I don't know if anyone has ever used one though, but it exists).

Finally, if you're not constrained to the CM side, then using a Storage Extension may be much more appropriate for your use case. See Will's post and example of how he did a similar thing for CDN integration: http://sdltridionworld.com/articles/sdltridion2011/tutorials/cdn_integration.aspx

In the event system you're getting only the component as input. Sounds like you're looking for a ComponentPresentation. So what you can do is create another CP in the event system by running it against the a Component Template:

        BuiltInFunctions f = new BuiltInFunctions();
        string renderedCp = f.RenderComponentPresentation(component.Id.ToString(), "tcm:1-2-32");

Though, I'm not sure the above will work in the context of the event system. I've only tested it as far as compiling.

Another way you can grab the rendered component presentation is actually by using a Custom Renderer as discussed here: http://stackoverflow.com/questions/14655972/whats-a-non-delivery-custom-renderer (warning: I don't know if anyone has ever used one though, but it exists).

Finally, if you're not constrained to the CM side, then using a Storage Extension may be much more appropriate for your use case. See Will's post and example of how he did a similar thing for CDN integration: http://sdltridionworld.com/articles/sdltridion2011/tutorials/cdn_integration.aspx

In the Event System you're getting only the component as input. It is not part of the rendering process, and it sounds like you're looking for a ComponentPresentation. In layman's terms, you're using the wrong extension point.

On the CM side creating a regular Template Building Block should be more appropriate because rendering is triggered when someone is publishing. You can also check the context of publishing in a TBB (to differentiate between rendering in TemplateBuilding or Preview modes).

Using a Storage Extension is also appropriate for the use case you describe. See Will's post and example of how he did a similar thing for CDN integration: http://sdltridionworld.com/articles/sdltridion2011/tutorials/cdn_integration.aspx and http://www.tridiondeveloper.com/some-thoughts-on-cmscdn-integration.

If you are adamant about doing it CM side and not using either of the above, then you're entering somewhat uncharted waters. What you can try to do is re-create the CP in the Event System by running it against the "News" Component Template:

        BuiltInFunctions f = new BuiltInFunctions();
        string renderedCp = f.RenderComponentPresentation(component.Id.ToString(), "tcm:1-2-32");

Though, I'm not sure the above will work in the context of the Event System. I've only tested it as far as compiling.

Another way you can grab the rendered component presentation is actually by using a Custom Renderer as discussed here: http://stackoverflow.com/questions/14655972/whats-a-non-delivery-custom-renderer (warning: I don't know if anyone has ever used one though, but it exists).

added 172 characters in body
Source Link
Nickoli Roussakov
  • 18.4k
  • 4
  • 31
  • 62

In the event system you're getting only the component as input. Sounds like you're looking for a ComponentPresentation. So what you can do is create another CP in the event system by running it against the a Component Template:

        BuiltInFunctions f = new BuiltInFunctions();
        string renderedCp = f.RenderComponentPresentation(component.IDId.ToString(), "your component template tcm id""tcm:1-2-32");

Though, I'm not sure the above will work in the context of the event system. I've only tested it as far as compiling.

Another way you can grab the rendered component presentation is actually by using a Custom Renderer as discussed here: http://stackoverflow.com/questions/14655972/whats-a-non-delivery-custom-renderer (warning: I don't know if anyone has ever used one though, but it exists).

Finally, if you're not constrained to the CM side, then using a Storage Extension may be much more appropriate for your use case. See Will's post and example of how he did a similar thing for CDN integration: http://sdltridionworld.com/articles/sdltridion2011/tutorials/cdn_integration.aspx

In the event system you're getting only the component as input. Sounds like you're looking for a ComponentPresentation. So what you can do is create another CP in the event system by running it against the a Component Template:

string renderedCp = RenderComponentPresentation(component.ID.ToString(), "your component template tcm id");

Another way you can grab the rendered component presentation is actually by using a Custom Renderer as discussed here: http://stackoverflow.com/questions/14655972/whats-a-non-delivery-custom-renderer (warning: I don't know if anyone has ever used one though, but it exists).

Finally, if you're not constrained to the CM side, then using a Storage Extension may be much more appropriate for your use case. See Will's post and example of how he did a similar thing for CDN integration: http://sdltridionworld.com/articles/sdltridion2011/tutorials/cdn_integration.aspx

In the event system you're getting only the component as input. Sounds like you're looking for a ComponentPresentation. So what you can do is create another CP in the event system by running it against the a Component Template:

        BuiltInFunctions f = new BuiltInFunctions();
        string renderedCp = f.RenderComponentPresentation(component.Id.ToString(), "tcm:1-2-32");

Though, I'm not sure the above will work in the context of the event system. I've only tested it as far as compiling.

Another way you can grab the rendered component presentation is actually by using a Custom Renderer as discussed here: http://stackoverflow.com/questions/14655972/whats-a-non-delivery-custom-renderer (warning: I don't know if anyone has ever used one though, but it exists).

Finally, if you're not constrained to the CM side, then using a Storage Extension may be much more appropriate for your use case. See Will's post and example of how he did a similar thing for CDN integration: http://sdltridionworld.com/articles/sdltridion2011/tutorials/cdn_integration.aspx

Source Link
Nickoli Roussakov
  • 18.4k
  • 4
  • 31
  • 62
Loading