This one's a doozie!

7 posts by 4 authors in: Forums > CMS Builder
Last Post: May 30, 2013   (RSS)

By Toledoh - May 25, 2013

Hi All,

I've got a page displaying here: http://freshrepublic.com.au/2013/portfolio.php

It all works well - except for IE8 (surprise!)

I've tracked it down to a single item...

The following code works fine, except for the final "foreach" loop.

        <?php foreach ($workRecords as $record): ?>
        <li>
            <a href="<?php echo $record['url'] ?>"
            data-largesrc="<?php foreach ($record['images'] as $upload): ?><?php echo $upload['urlPath'] ?><?php break ?><?php endforeach ?>"
            data-title="<?php echo $record['title'] ?>"
            data-description="
                <?php echo $record['content'] ?>
                
                <?php $services = array_combine($record['services:values'], $record['services:labels']);
                
                ?>
                <p>
                <?php foreach ($services as $key => $service): ?>
                  <a href='services.php?<?php echo urlencode($service).'-'.$key; ?>'><span class='sm<?php echo $service; ?>'></a></span>
                <?php endforeach ?>
                </p>
                

                <?php if ($record['details_page']): ?>
                <a href='<?php echo $record['_link'] ?>' class='coloured'>Read More</a><br />
                <?php endif ?>
                <?php if ($record['url']): ?>
                <a href='<?php echo $record['url'] ?>' class='coloured' target='_blank'>View Website</a>
                <?php endif ?>
                
                ">
                <?php foreach ($record['hero_image'] as $upload): ?><img src="<?php echo $upload['urlPath'] ?>" alt="<?php echo $record['title'] ?>" class="ogThumb"/><?php endforeach ?>
            </a>
        </li>
        <?php endforeach ?>

If I replace

<?php foreach ($record['hero_image'] as $upload): ?><img src="<?php echo $upload['urlPath'] ?>" alt="<?php echo $record['title'] ?>" class="ogThumb"/><?php endforeach ?>

with

<img class="ogThumb" alt="Seven Fields" src="/cmsAdmin/uploads/lj-brochure_main.jpg">

it breaks - but only in IE8.

Help?

Cheers,

Tim (toledoh.com.au)

By Mikey - May 25, 2013

I can't say this would work or not, but this may be a temporary solution...

The idea is an if statement that checks to see if the browser is IE8 and if so... use the code that only works in IE8, else use the other code that works in all other browsers.

I googled "php if ie8" and came up with the following link. Of course, you'd need to write it to perform the task you need... http://stackoverflow.com/questions/10597515/is-there-a-way-to-use-if-ie-8-within-php

By Toledoh - May 25, 2013

Good idea Zick.  I'll set up something to bypass that whole display for IE8 - as that image is the important portfolio image - so I can have it fixed.

Cheers,

Tim (toledoh.com.au)

By Toledoh - May 25, 2013

Hey Zick.

I placed a <!--[if !IE 8]> -->...<!-- <![endif]--> around the whole section that doesn't work on IE8, then placed a new section wrapped in <!--[if IE 8]>... <!-- <![endif]-->
This allows me to get the site live at least.

Would still be good to figure out how to display that offending php for IE8 though if anyone has any thoughts.

Cheers,

Tim (toledoh.com.au)

By gregThomas - May 27, 2013

Hi Tim,

It might being caused by this line:

<a href='services.php?<?php echo urlencode($service).'-'.$key; ?>'><span class='sm<?php echo $service; ?>'></a></span>

I think you need to have the closing a tag after the closing span tag like this:

<a href='services.php?<?php echo urlencode($service).'-'.$key; ?>'><span class='sm<?php echo $service; ?>'></span></a>

Cheers

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Steve99 - May 30, 2013

Hi,

I took a quick look at the code at it looks like there are multiple html markup issues that are causing the undesired results.

Without digging deeper, it looks like part of it has to do with the markup used inside of your data-description attribute. Also, part of that markup has the closing span tag outside of the closing "a" tag when it should be inside.

Hope this helps.

- Steve