if statement in view is causing dwoo error
  • toymachiner62toymachiner62 February 13
    I got a strange problem. I have a dwoo error being caused by the if statement in this snippet


    <?php foreach($categories as $category) : ?>
    <?php if($category): ?>
    <li class="currentPage"><a href="<?php echo $category->title; ?>"><?php echo $category->title; ?></a></li>
    <?php endif; ?>
    <?php endforeach; ?>


    The error message is Parse error: syntax error, unexpected ')' in /Users/tomcaflisch/Sites/CampbellCustomCoatings-new/trunk/campbellcustomcoatings/fuel/application/cache/dwoo/compiled/5595746fa8a972207462dacea8715e3c.d17.php on line 226

    If i remove the "if" and "endif" lines, it works fine. Am i doing something incorrect to cause this error?
  • toymachiner62toymachiner62 February 14
    This is the dwoo that gets generated when i import my view file

    {foreach $categories category }
    {$catId = $category->id}
    {if($catId == 'test') }
    <li class="currentPage"><a href="{site_url("patterns/$catId")}">{$category->title}</a></li>

    <li><a href="{site_url("patterns/$catId")}">{$category->title}</a></li>
    {/if}
    {/foreach}
  • adminadmin February 14
    A couple things to test:
    1. What if you change the conditional to something like this {if $catId == "test"}?
    2. Is the $catId in the site_url function possibly causing the problem?
  • toymachiner62toymachiner62 February 14
    if i change the dwoo to {if $catId == "test"} it works. Is there a bug in the importing of a view file with an if statement or am i doing something goofy?
  • adminadmin February 14
    I'll take a look at the importing with if conditionals. The importing isn't perfect but meant to get a majority of the php code scenarios found when importing view files.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

Categories