Hacker News new | ask | show | jobs
by vl 5973 days ago
I'm using PHPTal right now to achieve more or less same effects, but it's not the easiest solution - it becomes a bit cumbersome for long fragments.

XHP looks very promising because it solves one of my problems with PHPTal - generating complex content in the loop (in PHPTal having multiple conditions in loop is possible, but not exactly elegant)

For example:

  <?php
    $list = <ul />;
    foreach ($items as $item) {
      if ($item->bold) {
        $list->appendChild(<li><b>{$item}</b></li>);
      } else if ($item->foobar) {
        $list->appendChild(<li><i>{$item}</i></li>);
      } else {
        $list->appendChild(<li>{$item}</li>);
      }
    }
  ?>