unexpected T_ENDFOREACH

2 posts by 2 authors in: Forums > CMS Builder
Last Post: April 8, 2008   (RSS)

By Mohaukla - April 8, 2008

Could you look at a test page I have http://efreewillmar.org/youthtest.php
It is returning an error message.
Its a listed view of WMV's that will be uploaded by the client. I do not see what is causing the problem.

Here is the section of code that is causing the error.
<?php
require_once "C:/Webspace/resadmin/mmoyers/efreewillmar.org/www/cmsAdmin/lib/viewer_functions.php";
$options = array(); // NOTE: see online documentation for more details on these options
$options['tableName'] = 'about_us_004'; // (REQUIRED) MySQL tablename to list record from. Example: 'article';
$options['titleField'] = 'title'; // (optional) MySQL fieldname used in viewer url for search engines. Example: 'title' would display: viewer.php/article_title_here-123
$options['viewerUrl'] = 'about_us_004Page.php'; // (optional) URL of viewer page. Example: '/articles/view.php';
$options['perPage'] = ''; // (optional) The number of records to display per page. Example: '5'; Defaults to 10.
$options['orderBy'] = 'title'; // (optional) Fieldnames to sort by. Example: 'field1, field2 DESC, field3';
$options['pageNum'] = ''; // (optional) Page number of results to display. Example: '1'; Defaults to ?page=# value, or 1 if undefined
$options['where'] = ''; // (ADVANCED) Additional MySQL WHERE conditions. Example: 'fieldname = "value"'
$options['useSeoUrls'] = ''; // (ADVANCED) Set this to '1' for search engine friendly urls: view.php/123 instead of view.php?123 (not supported on all web servers)
list($listRows, $listDetails) = getListRows($options);
?>
<div align="center">
<?php foreach ($listRows as $record): ?>
<?php if ($record): ?>
<?php foreach (getUploads($options['tableName'], 'upload_videos', $record['num']) as $upload): ?><?php if ($upload['extension'] == 'wmv'): ?>
<br/>
<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" width="320" height="290">
<param name="FileName" value="<?php echo $upload['urlPath'] ?>">
<param name="AutoStart" value="False">
<param name="ShowControls" value="True">
<param name="ShowStatusBar" value="False">
<param name="ShowDisplay" value="False">
<param name="AutoRewind" value="True">
<embed type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
autostart="True" filename="<?php echo $upload['urlPath'] ?>"
src="<?php echo $upload['urlPath'] ?>"
width="320" height="290" showcontrols="True" showstatusbar="False" showdisplay="False" autorewind="True"> </embed>
</object>
<br/>
<span class="style7"><?php echo $upload['info1'] ?><br/>
<br/>
<?php echo $upload['info2'] ?></span><br/>
<br/>
<?php endforeach ?>
<?php endif ?><?php endforeach ?>


Thanks for your help on this,
Michael Moyers



Owner of Just Rite Design Inc. A growing network of professionals in web design, graphic design, flash development, programming, and audio & video productions.



"Due to budget constraints, the Light at the end of the tunnel will be temporarily out!"

Re: [justritedesign] unexpected T_ENDFOREACH

By Dave - April 8, 2008

Hi Michael,

It's the extra <?php if ($upload['extension'] == 'wmv'): ?> tag you have on the end. It doesn't have a closing <?php endif ?> tag. You can either add a <?php endif ?> before the first endforeach or just replace the if tag with this:

<?php if ($upload['extension'] != 'wmv') { continue; } ?>

Which basically says, if it's not a wmv file, continue with the next one and skip this one.

Hope that helps. Let me know if you need more detail with the code or anything like that.
Dave Edis - Senior Developer
interactivetools.com