General
Getting & Giving Support
Administration
Design
- Tut. - Layouts and Themes
- Tut. - Navigation cookbook
- Tut. - How To section
Reference Material
Plugin Development
- Tut. - Writing a plugin
- Ref. - List of Events
- Ref. - Enabling cron jobs
- Ref. - PHPDoc
Core Development
- Ref. - PHPDoc
Press information
Wolf CMS books section
odd_even()
This simple function returns either “odd” or “even” (in that order) in turn. This helps especially in the production of tables, or in any case where alternating values need to be produced.
For example, used in a foreach
loop of this kind (note the “class” in the paragraph tag):
<?php foreach ($articles as $article): ?> <p class="<?php echo odd_even(); ?>"><?php echo $article->title(); ?></p> <?php endforeach; ?>
the odd_even()
function would produce this output:
<p class="odd">Yesterday</p> <p class="even">Penny Lane</p> <p class="odd">Help!</p> <p class="even">Eleanor Rigby</p> ...
This function has an alias as even_odd()
which produces identical output.
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2