Quotation & Single Quotes throw off my Javascript...

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 19, 2010   (RSS)

By hordak - May 12, 2010

Hi I'm running a slideshow script that gets it's images/captions/etc. The script controller looks like this:

<!-- STEP 2a: Display Uploads for field 'image_gallery' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<script type="text/javascript">
//<![CDATA[
window.addEvent('domready', function(){
// Load your images here
var data = {
<?php foreach ($pr_homepage_bannerRecords as $record): ?>
<?php foreach ($record['banner'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
'<?php echo $upload['filename'] ?>': { caption: '<div class="subhead_gold"><a href="<?php echo $record['link'] ?>"><?php echo $upload['info1'] ?></a></div><?php echo $upload['info2'] ?>' },
<?php else: ?>
'<?php echo $upload['filename'] ?>': { caption: '<div class="subhead_gold"><a href="<?php echo $record['link'] ?>"><?php echo $upload['info1'] ?></a></div><?php echo $upload['info2'] ?>' },
<?php endif ?>
<?php endforeach ?>
<?php endforeach ?>

'marauderPride.jpg': { caption: '<div class="subhead_gold"><a href="http://studentaffairs.centralstate.edu/document_details.php?Marauder-Pride-3">Marauder Pride</a></div>Honesty, hard work, caring and excellence define our pride.' }
};
// Initialize the Slideshow instance
var myShow = new Slideshow('show', data, { captions: true, controller: true, height: 215, hu: 'hp_includes/Slideshow/images/', width: 595 });
});
//]]>
</script>


<div id="show" class="slideshow" style="background: #ddd; border:0; padding:0;">
</div>
<?php if (!$pr_homepage_bannerRecords): ?>

<img src="hp_includes/Slideshow/images/01.jpg" alt="image 1" width="595" height="215" />

<?php endif ?>
<!-- STEP2a: /Display Uploads -->


The Image Slideshow works great UNLESS I want to use Quotation marks or apostrophes in the info1 & info2 fields.

My Question: How do I get CMSB to publish "' as &quot; &lsquo; &rsquo;?

Re: [chris] Quotation & Single Quotes throw off my Javascript...

By hordak - May 19, 2010

Thanks Chris; that did it!

problem solved...