Jump to content

kenrbnsn

Staff Alumni
  • Posts

    8,234
  • Joined

  • Last visited

Posts posted by kenrbnsn

  1. Change

    <?php
    echo "<tr class='odd'><td>...</td>";
    ?>

    to

    <?php
    $class = ($class == 'odd')?'even':'odd';
    echo "<tr class='$class'><td>...</td>";
    ?>

    and put

    <?php
    $class = 'even';
    ?>

    before the loop

     

    Or change

    <?php
    echo "<tr class='odd'><td>...</td>";
    ?>

    to

    <?php
    $class = ($i%2 != 0)?'odd':'even';
    echo "<tr class='$class'><td>...</td>";
    ?>

     

    Ken

  2. A more readable version would be to use "{ }" around the variables:

    <?php
    $with=array("<a href='index.html'>index</a>", "<a href='{$xmlcitydata->data->main_backlink_rt_1}/{$xmlcitydata->data->city_name}.html'>{$xmlcitydata->data->city_kw_1_rt_1}</a>");
    ?>

     

    Ken

  3. Please post your code between

    
    

    tags.

     

    This sample code works for me:

    <?php
    for ($i=0;$i<10;++$i) {
    echo "<a href='page{$i}.php'>Page $i</a><br>\n";
    }
    ?>

     

    Ken

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.