What's wrong?
9 posts by 3 authors in: Forums > CMS Builder
Last Post: April 5, 2011 (RSS)
By Toledoh - April 3, 2011
<div id="showcase" class="showcase">
<?php foreach ($home_pageRecord['slides'] as $upload): ?>
<div>
<img src="<?php echo $upload['urlPath'] ?>" width="960" height="400"/>
<div class="showcase-caption">
<?php echo $upload['info1'] ?>
</div>
</div>
<?php endforeach ?>
</div>
yet this stops the page loading?
<div id="showcase" class="showcase">
<?php foreach ($home_pageRecord['slides'] as $upload): ?>
<div>
<img src="<?php echo $upload['urlPath'] ?>" width="960" height="400"/>
<?php if ($upload['info1']): ?>
<div class="showcase-caption">
<?php echo $upload['info1'] ?>
</div>
<? endif ?>
</div>
<?php endforeach ?>
</div>
I'm trying to only show the captions div if a caption (info1) has been entered...
Tim (toledoh.com.au)
Re: [Toledoh] What's wrong?
By Jason - April 4, 2011
I don't see any obvious problem with the code. Does the page page seems to stop when it reaches an upload that has a caption, or one that hasn't? Does this code actually produce an error? Sometimes, errors don't display on the screen and you need to view the page source to see them.
If you could attach a copy of your .php file and send a link to a page where this is not working, we can take a closer look at this. If you don't want to post a link in the forum, you can email it directly to support@interactivetools.com
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: [Jason] What's wrong?
By Toledoh - April 4, 2011
Have a look at the attached - live at;
http://www.smcelc.com.au/web/index.php
http://www.smcelc.com.au/web/index2.php
Thanks for your help!
Tim (toledoh.com.au)
Re: [Toledoh] What's wrong?
By Jason - April 4, 2011
That's a strange one. There are no syntax errors. My best guess is that something happens with your script when the showcase-caption div is missing. You can test this theory by removing the caption code all together and see if you get the same problem.
You could try replacing it with this:
<div class="showcase-caption">
<?php if ($upload['info1']): ?>
<?php echo $upload['info1'] ?>
<? endif ?>
</div>
But this would actually be the same was your original code.
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: [Jason] What's wrong?
By Toledoh - April 4, 2011
Have a look at the attached... they are straight out of the generator - test 3 doesn't work, which is the one with the if statements.
http://www.smcelc.com.au/web/test1.php
http://www.smcelc.com.au/web/test2.php
http://www.smcelc.com.au/web/test3.php
strange!
Tim (toledoh.com.au)
Re: [Toledoh] What's wrong?
By zip222 - April 4, 2011 - edited: April 4, 2011
<? endif ?>
not sure if that would prevent it from working or not.
Re: [zip222] What's wrong?
By Toledoh - April 4, 2011
Sometimes I think I should pack my bags... this is one of those instance.
Thanks! Everything working fine...
Tim (toledoh.com.au)
Re: [Toledoh] What's wrong?
By zip222 - April 4, 2011
Re: [zip222] What's wrong?
By Jason - April 5, 2011
Nice catch zip! That would do it. :)
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/