DUPLICATE LISTINGS

12 posts by 3 authors in: Forums > CMS Builder
Last Post: December 1, 2011   (RSS)

Problem is that everything works fine EXCEPT output page displays both test listings TWICE. The code looks to me that something must be deleted but I have tried removing what seemed obvious and just received error messages.

Will very much appreciate your help as I need to get this capability online asap.

CODE WITH APPEARS ON PAGE...

<!-- INSERT PHOTOLINK PHP CODE -->
<?php foreach ($featured_eventsRecords as $record): ?>

<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->




<?php foreach ($featured_eventsRecords as $record): ?>
<b>Date:</b> <?php echo $record['date'] ?><br/><br/>
<b>Event:</b> <?php echo $record['event'] ?><br/>
<b>Location</b>: <?php echo $record['location'] ?><br/>
<b>Address:</b> <?php echo $record['address'] ?><br/>
<b>City or Town:</b> <?php echo $record['town'] ?> VT<br/>


<!-- STEP 2a: Display Uploads for field 'image' (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 -->
<?php foreach ($record['image'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" vspace="7" border="1" /><br/>
<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
<?php endif ?>
<?php endforeach?>
<!-- STEP2a: /Display Uploads -->



<b>Description:</b> <?php echo $record['description'] ?><br/><br/>
<b>Start Time</b>: <?php echo $record['start_time'] ?><br/>
<b>Admission</b>: <?php echo $record['admission'] ?><br/>
<b>Phone:</b> <?php echo $record['phone'] ?><br/>
<b>Your Website Address:</b> <?php echo $record['url'] ?><br/>
<b>Email Address:</b> <?php echo $record['email_address'] ?><br/>
<b>Handicap Accessible:</b> <?php echo $record['handicap_accessible'] ?><br/><br/>
<hr />


<?php endforeach; ?>
<?php if (!$featured_eventsRecords): ?>
</p>

<?php endif ?>






<font color="9933FF" class="medium"></font color="9933FF" class="medium"><br/><font color="000000">
<div align="left"><b></b>






<?php endforeach ?>

OUTPUT TEST PAGE...

http://www.linkvermont.com/test15.php

Bob T.

Re: [weblinks] DUPLICATE LISTINGS

Hi weblinks.

It looks like you have your main FOREACH wrapped in another FOREACH which would cause it to dup.

Delete your outer FOREACH and all should be fine.

Re: [steve99] DUPLICATE LISTINGS

Steve....REPLY....

Did that yesterday and it didn't work... Removed tag directly below... CODE WITH APPEARS ON PAGE...

<!-- INSERT PHOTOLINK PHP CODE -->
<?php foreach ($featured_eventsRecords as $record): ?> REMOVED THIS TAG


Did it again now, still didn't work and delivered the following error message... Parse error: syntax error, unexpected T_ENDFOREACH in /home/linkve5/public_html/test15.php on line 336

Line 336 is a </div> tag.... I tried removing that... nothing![/#000000]

Bob[/#000000]

Re: [weblinks] DUPLICATE LISTINGS

By Steve99 - November 15, 2011 - edited: November 15, 2011

Make sure you delete the outer closing FOREACH.

That would trigger that error.

Try just this:

<?php foreach ($featured_eventsRecords as $record): ?>
<b>Date:</b> <?php echo $record['date'] ?><br/><br/>
<b>Event:</b> <?php echo $record['event'] ?><br/>
<b>Location</b>: <?php echo $record['location'] ?><br/>
<b>Address:</b> <?php echo $record['address'] ?><br/>
<b>City or Town:</b> <?php echo $record['town'] ?> VT<br/>


<!-- STEP 2a: Display Uploads for field 'image' (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 -->
<?php foreach ($record['image'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" vspace="7" border="1" /><br/>
<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>
<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
<?php endif ?>
<?php endforeach?>
<!-- STEP2a: /Display Uploads -->



<b>Description:</b> <?php echo $record['description'] ?><br/><br/>
<b>Start Time</b>: <?php echo $record['start_time'] ?><br/>
<b>Admission</b>: <?php echo $record['admission'] ?><br/>
<b>Phone:</b> <?php echo $record['phone'] ?><br/>
<b>Your Website Address:</b> <?php echo $record['url'] ?><br/>
<b>Email Address:</b> <?php echo $record['email_address'] ?><br/>
<b>Handicap Accessible:</b> <?php echo $record['handicap_accessible'] ?><br/><br/>
<hr />


<?php endforeach; ?>
<?php if (!$featured_eventsRecords): ?>
<?php endif ?>

Re: [steve99] DUPLICATE LISTINGS

Steve...

Fixed !!! Needed to delete one more line and it worked. Thanks much for the complete code.... and the fast response... Have a great day...

Regards,

Bob

Re: [weblinks] DUPLICATE LISTINGS

You're very welcome, Bob. Glad to help.

Take care.

Re: [steve99] MAKE CONTENT OF FIELD A LINK

I forgot how to do this...I have a FIELD which calls for an advertiser to insert his website address... which I wish to make a LINK to be clicked on by a visitor... taking the visitor to the advertisers web site. HOW do I make this field content a link... ie

e.g..... FIELD: Your Website Address: advertiser insterts http://www.linkvermont.com [this being a link]

SEE EXAMPLES OF ADS AT [url "http://www.linkvermont.com/calendar_december2011_WORKING.php"]http://www.linkvermont.com/calendar_december2011_WORKING.php[/#0066cc][/url] Note line that says your website address.

If you provide code please advise me as to precisely where it appears.

If you can possibly reply quickly it will be more than appreciated as I need to get the above examples online today with the web address being a LINK.

Regards,

Bob

Re: [weblinks] MAKE CONTENT OF FIELD A LINK

By Jason - November 30, 2011

Hi Bob,

Try this.

Assuming that your field is called website_address, you could create the link like this:

Website Address: <a href = "<?php echo $record['website_address'];?>"><?php echo $record['website_address'];?></a>

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [steve99] MAKE CONTENT OF FIELD A LINK

Jason...

Thanks for the quick reply but I am "brain dead" when it comes to some code.... Please give me an example of the complete code. The field Label is Website... The field Name is url... Existing Code Below....

<!-- INSERT PHOTOLINK PHP CODE -->
<?php foreach ($featured_eventsRecords as $record): ?> <b>Date:</b> <?php echo $record['date'] ?><br/><br/> <b>Event:</b> <?php echo $record['event'] ?><br/> <b>Location</b>: <?php echo $record['location'] ?><br/> <b>Address:</b> <?php echo $record['address'] ?><br/> <b>City or Town:</b> <?php echo $record['town'] ?> VT<br/> <!-- STEP 2a: Display Uploads for field 'image' (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 --> <?php foreach ($record['image'] as $upload): ?> <?php if ($upload['hasThumbnail']): ?> <img src="<?php echo $upload['thumbUrlPath'] ?>" alt="" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" vspace="7" border="1" /><br/> <?php elseif ($upload['isImage']): ?> <img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/> <?php else: ?> <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/> <?php endif ?> <?php endforeach?> <!-- STEP2a: /Display Uploads --> <b>Description:</b> <?php echo $record['description'] ?><br/><br/> <b>Start Time</b>: <?php echo $record['start_time'] ?><br/> <b>Admission</b>: <?php echo $record['admission'] ?><br/> <b>Phone:</b> <?php echo $record['phone'] ?><br/> <b>Website:</b> <?php echo $record['url'] ?><br/> <b>Email Address:</b> <?php echo $record['email_address'] ?><br/> <b>Handicap Accessible:</b> <?php echo $record['handicap_accessible'] ?><br/><br/> <hr /> <?php endforeach; ?> <?php if (!$featured_eventsRecords): ?> <?php endif ?>


Regards,

Bob