Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi,
In the past i have always upload images as my news image in pageview but now what I want to be able to do is to be able to either upload an image, add a video(using shortcodes from youtube or vimeo) or audio(using shortcodes from soundcloud). I am planning on using the Mosaic feature but my problem is being able to add shortcodes fields in the template defining region to allow youtube or souncloud files to show on the front-end.
Page view.JPG
Page view.JPG (132.78 KiB) Viewed 195 times

NB: I am able to however use shortcodes to allow me enter shortcodes into the content area.
Any help will be greatly appreciated.
I think you can define three tiles (image, video and audio) where image would have the regular type 'image' region while the other two can be type 'textarea'.

You can then input the shortcode as per usual (can even override the display to actually show the video in the admin-panel, but first try the basic way).

Any problem with this approach? Please try it and let me know.
my problem is being able to add shortcodes fields in the template defining region to allow youtube or souncloud files to show on the front-end.
Here are two ways of doing it.

Using Shortcodes
Install the All-Purpose Embed Shortcode for embedding the code on the front end.
Code: Select all
<cms:editable name='embed_code' label='Embed Code for YouTube, Vimeo, or Soundcloud' type='textarea' no_xss_check='1'/>
<cms:editable name='cover_photo' type='image' />

front end:
Code: Select all
<cms:if embed_code>
    <cms:do_shortcodes>[embed code='<cms:show embed_code/>']</cms:do_shortcodes>
<cms:else/>
    <cms:show cover_photo/>
</cms:if>

Hard Coded Embed Code
With this option you can better control the output on the front end, like the width and height of the iframe. The user uploads the video ID, and Couch enters the ID into your customized embed code.
Code: Select all
<cms:editable name='youtube_id' label='YouTube Video ID' type='text'/>
<cms:editable name='vimeo_id' label='Vimeo Video ID' type='text'/>
<cms:editable name='soundcloud_id' label='Soundcloud Audio ID' type='text'/>
<cms:editable name='cover_photo' type='image' />

On the front end:
Code: Select all
<cms:if youtube_id > 
    <iframe class="frame" width="400" height="225" style="max-width:100%;" src="https://www.youtube-nocookie.com/embed/<cms:show youtube_id />?rel=1&amp;controls=1&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>
<cms:else_if vimeo_id/>
    ...Vimeo embed code goes here...
<cms:else_if soundcloud_id/>
    ...Soundcloud embed code goes here...
<cms:else/>
    <cms:show cover_photo/>
</cms:if>

For your case, I think the second option is better for controlling the layout on the front end. And whichever you choose, I would lazy load the embedded content to keep it from slowing down page loading. *shameless plug* viewtopic.php?f=8&t=11250

I hope that helps with your question.
Wooow! Thanks guys for the immense support. Much love from Ghana. Never ever have I regretted finding Couch CMS.
4 posts Page 1 of 1

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests

cron