I’ve built upwards of a dozen sites using Xaraya and a few using Drupal.
Most of my experience with Drupal came a couple years ago, but I’ve been messing with it a bit lately to see where things stand with its development. I’m finding that Drupal’s theming and user management are much improved from a couple years ago and are now just about on par with Xaraya.
I still have a slight preference for Xaraya, in part because it does some things in its core for which Drupal requires add-ons. Also, Xaraya has been doing those particular things — flexible template-based theming and granular user privileges — for a little longer. That’s not a knock on Drupal, which strikes me as a very good CMS these days. I just tend to favor something that’s built from the ground up to do what I want.
Though theming in Drupal is — with the advent of CCK and contemplate — apparently just as flexible as Xaraya’s blocklayout system, I find Xaraya’s XML template code more readable than the PHP in Drupal’s templates. Since I spend a lot of time looking at code, the readability of templates can impact how easy it is to do my job, and the likelihood of mistakes. Also, the less I have to type, the better.
Just to provide a very basic example, I find this…
#$title#
…nicer to look at than this…
<?php print($title); ?>
The advantage becomes more significant when templates are complicated and contain conditional logic, loops, etc.
Here’s a slightly longer comparison, though still pretty simple:
<xar:if condition="count($this) gt 5">
<p>
<a href="#$the_url#">#$this[0]#</a>
</p>
</xar:if>
vs.
<?php if (count($this) > 5) { ?>
<p>
<a href="<?php $the_url; ?>"><? echo $this[0]; ?></a>
</p>
<?php }; ?>
For me the XML/HTML mix is easier on the eyes than the PHP/HTML mix, especially since the former has less intermingling of angle brackets. Note that in the Xaraya example, PHP functions can be used inside the condition statement. Xaraya uses two-letter comparison operators instead of the normal PHP operators.
More Xaraya blocklayout syntax examples at www.xaraya.com.
This thread might be a good read for developers interested in finding out more about changes to the blocklayout compiler in Xaraya 2.0. Much of what is described in the thread is over my head. Release of Xaraya 2.0 is still a ways off as of this writing.


May 2nd, 2008 at 4:54 pm
I’ve been thinking about learning Drupal, but my time is limited, and I feel I’ve become pretty strong with Xaraya over the years. I would hate to have to write conditionals like this in Drupal. My only complaint about Xaraya over the years is the slow pace at which the program improves and the lack of documentation on how to develop with it. Still, one of the attractions is that I can run a search on google for the term “xarmodapifunc” and find about anything I need. The user community seems small, too. Or at least the developer community working on new versions of Xaraya. Your thoughts.
May 8th, 2008 at 10:01 am
Hi Tim,
I’ve done a couple projects with Drupal lately after years of working almost exclusively with Xaraya. I don’t feel strongly that one is better than the other. There are things about Xaraya I miss a little when working with Drupal, and vice versa.
For developing something that’s less like a conventional website and more like a web app, I would go with Xaraya.
For developing a normal website (whatever that is), I’d say it’s a toss-up. Drupal is a little nicer on the back end. In Drupal 6, the ability to re-order fields and menu items by dragging them is very nice.
At times you have to be a bit more adventurous with PHP to use Drupal. For example, in Xaraya you can use the xar:module template tag to easily grab article summaries for display on any page. In Drupal, there is no tag, per se, that you can use for that. Instead you use some PHP to query the database. Here’s a function for getting article summaries in Drupal:
< ?php function get_content($args) {
/*******************/
/***** defaults *****/
$content_type = 'story';
$offset = 0;
$numitems = 1;
/*******************/
/*******************/
extract($args);
$output = '';
$result = db_query_range(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = '$content_type' AND n.promote = 1 ORDER BY n.created DESC"), $offset, $numitems);
while ($node = db_fetch_object($result)) {
$output .= node_view(node_load(array('nid' => $node->nid)), 1);
}
return $output;
}
?>
In Xaraya, the equivalent would be something like…
<xar:module module=”articles” func=”view” type=”user” main=”false” numitems=”1″ offset=”0″ ptid=”12″ />
Now that I’ve done a couple Drupal projects recently, I’ve built up a little library of the functions I use more often, so it’s no longer much of a hindrance. The only concern I have is that maybe in future versions of Drupal my functions won’t work. With Xaraya, I know the block layout tags are going to work in future versions.
The Xaraya community is definitely smaller. That has never been a hindrance with respect to getting support. It’s a very supportive community as you’ve no doubt witnessed. As for further development of Xaraya, it’s hard for me to judge how much is going on at any given time.
-Ryan