1

I have a custom object "Article" which can have an image or a youtube video or an audio. Because of mixed nature of these contents how can I display based on some condition

image(<img src="../img" />),

embed video (<iframe> src=".//video" </iframe>)

and audio(<audio> <source src="/audio.mp3</source></audio>) contents using data repeater.

For Example:

        <div class="article" media="image">
            <img src="images/sample/sample1.jpg" />
        </div>
        <div class="article" media="video">
            <iframe> src="http://www.youtube.com/watch?v=sOQLVm0-8Yg" </iframe>
        </div>
        <div class="article" media="audio">
            <audio controls> <source src="../vidoe.mp3" </source> </audio>
        </div>
1

You cannot use conditions in data repeater because data repeater simply iterates record according to criteria provided in its edit dialog. Anything you write between will repeat no of times equal to records.

Site.com is a code less working environment and require a lot of home work before doing project on this. Generally it need to find some javascript hack for it or will need to hardcode values in panels.

To display content you have to start from schema as when record iterate it should render output of one record as <img src="../img" /> and for some other as <iframe> src="http://www.youtube.com/watch?v=sOQLVm0-8Yg" </iframe> . For this you can use formula field on custom object and which build required text (html text) then iterate that formula field using data repeater.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.