Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hi,

So i want to dynamically display a text field in one of my divs i have displaying on a click event using jQuery... Just need a hand passing the fields through and displaying.

Heres my main template (Its a one page website)

Code: Select all
<cms:template title='main site' order='0' clonable='0' dynamic_folders='1' gallery='0' >

<?php

# the main template for the site

include 'templates/site.php';
include 'templates/slider.php';
include 'templates/about.php';
include 'templates/services.php';

?>

</cms:template>


and the snippet for the 'popup' boxes i want to display the certain fields in:

Code: Select all
<cms:editable name='about_section' label='About section' type='group' order='3' />

<cms:editable
name='about_header'
group='about_section'
label="Please enter the sub-heading for the 'about us' section... "
type='text'>
</cms:editable>

<cms:editable
name='about_content'
group='about_section'
label="Please enter the text content for the 'about us' section..."
desc='You can use the editor to format the text, for example bold, italic, underliend etc.'
type='richtext'>
</cms:editable>

<cms:editable name='banner' group='about_section' type='message'>
<div class="cms-block">
<blockquote><h2>The content for the 4 key boxes.</h2></blockquote>
</div>
</cms:editable>

<cms:editable
name='health_popup'
group='about_section'
label="Please enter the text content for the 'health & safety' pop up section..."
desc='You can use the editor to format the text, for example bold, italic, underliend etc.'
type='richtext'>
</cms:editable>

...


So my question is, how do i pass the value from 'health_popup' to my targeted div. Heres the JS:

Code: Select all
$('#b3').click(function(){
        popups.play();
        $('.popup-content').css('background','#58a2d7');
        $('.popup-content').html("<cms:get_custom_field 'health_popup'/>");
    })

    $('.popup-content').click(function(){
        popups.reverse();
    })


I've also tried creating a variable and assigning it to the cms tag but the box is just showing nothing. Maybe i need to use <cms:show>. Any ideas?
Hi,

If you are trying to show the output in the very template the editable region 'health_popup' is defined in, a simple <cms:show health_popup /> would suffice.

If, however, the region is defined in one template and you are trying to show it in another then please see <cms:get_field> here - viewtopic.php?f=5&t=11105

Do a view-source of your page and you should see the output from the region at the place you placed the mentioned tags.

Hope this helps.
2 posts Page 1 of 1