Mixing binary and non-binary content types?

Would it be possible to mix binary and non-binary content fields within the same content type? I am thinking this would be possible with two publishing templates and two publishing contexts but I am not sure if it will work. This would work similarly to how the fast forward implementation creates a picture and thumbnail file from one content type. Has anyone attempted something like this?

Basically the idea would be the same principle as if the item were linked within a slot associated to the full page template for a non-binary content type, if a file were uploaded then publish and display the photo as if it were within a slot.

The scenario to use this approach is when the binary file wouldn’t be referenced without the supporting non-binary information. I think this would be the case with a contact’s picture. When a user searches for a contact name (i.e. john smith), I would rather them be presented with the contact content type full page template and a snippet template for the binary photo associated with the same content type rather than being presented with two different content types (file and contact). This would ensure a one to one mapping for the contact, enforce sizing standards for a contact photo, and reduce clutter for the returned search results.

Another use for this would be for newsletter content types that would rather publish their newsletter within a pdf.

We have mixed binary and non-binary items on some of our content type to account for legacy items being in .txt for, and the newer items in HTML. we have two templates (binary and HTML), and use a dispatch template to determine which one to select. It does make your content editor longer, but you can at least keep all related content items together in one CT.

-Raj

Raj,

I think I missed a key word in your post, since re-reading your response I see that you are using a binary or a non-binary. I am trying to have binary and non-binary content mixed within the same full page template.

I thought I had it working until I started looking closer. When the snippet is referenced in a slot the link is pointing to the item but a blank page is returned without a console error.

The snippet link is populated with:

http://cmserver.erau.edu/Rhythmyx/assembler/render?sys_revision=1&sys_siteid=307&sys_authtype=0&sys_contentid=5271&sys_variantid=599&sys_folderid=1089&sys_context=0

If I replace the variant id with the template name, the page appears correctly.

http://cmserver.erau.edu/Rhythmyx/assembler/render?sys_revision=1&sys_siteid=307&sys_authtype=0&sys_contentid=5271&sys_template=erauPgFacility&sys_folderid=1089&sys_context=0

I then added a dispatch template to see if this helped resolve the issue but this did not have an effect on the generated links. It seems like this should work.

The code generating the link is the standard way:

$rx.location.generate($sys.assemblyItem)

Does anyone have an idea why the location would be given a variantid rather thana template?

Does sys_variantid=599 correspond to erauPgFacility. Ie. in workbench, if you click on erauPgFacility and look at the properties (0-4-xxx) is xxx 599? If not is it the id to the the binary template for Facilty?

We are doing something similar where we have a content type called “resources” that publishes a binary object and also an html page. The “default template” is PgResource and our binary template is PgResourceBn. We had to name the binary template a name that comes after (alphabetically) the html page because we wanted $rx.location.generate($sys.assemblyItem) to point to PgResource and not PgResourceBn (which it would if we called it BnResource).

Once you have both templates published, the next step to mix the binary and non-binary content should be simple by referring to the binary template. Say if it is an image, use $rx.location.generate($sys.assemblyItem, “PgResourceBn”) to get the url of the published binary item to embed on the page.

I am not sure how a dispatch template would help us because we need both PgResource and PgResouceBn published out and from what i can tell a dispatch template chooses one.

Update: i know that the above way works for images, but we have not worked out getting multimedia in terms of sounds (mp3 etc) and videos to work within our flash player on preview within RX. YMMV.

Hope this helps.

I don’t think you can mix binary and non-binary content in the same template, but you can create both binary and non-binary templates in the manner that Jit describes.

Of course, you will need different location schemes for the two templates, because they both must publish, and the file locations must be different.

You do not need to use multiple contexts in order to implement this functionality (although if you need more than one for some other reason, there’s no problem with using more than one context). In fact, using multiple contexts makes linking between the non-binary and binary files somewhat more complicated. The simple formula that Jit gives in his post won’t work if you have multiple contexts.

Dave

Dave makes a very good point, you do need two location schemes. The following location scheme for the binary template with the content type works quite well for us:


if($sys.item.getProperty('rx:item_file_attachment_ext').String.length()>0){ if ($sys.crossSiteLink) {$prefix = $sys.site.url;} else {$prefix = "";} {$prefix + $sys.pub_path + $sys.template.prefix + $sys.item.getProperty('rx:sys_title').String + $sys.template.suffix + $sys.item.getProperty('rx:item_file_attachment_ext').String;}} else{{'/empty-placeholder.tmp';}}

note that this code takes into the case where you haven’t uploaded the attachment (and hence the extension field would not be populated) and just makes one file on the root /empty-placeholder.tmp…(as opposed to having lots of empty files scattered throughout the web server directory). We don’t have a problem with multi-threaded publishing, but Dave might be able to comment on that (ie would you get an io error because that file already exists?)

For some reason erauImageThumb was being selected from rx.location generation as the default template, thats where the variant 599 came into play. I did not know you could specify the template within the binding like that, as soon as I added that everything worked correctly.

We do have one template for the binary and one for the non-binary so it looks like everything is working.

Thanks for your help!