Sample Neighborhood Template
From TechWiki
Here is a sample Drupal template page in PHP for a neighborhood layout. Note: there is a sample rendering of this code at the end of this file. The nominal source file is now_neighbourhood.tpl.
What this code does, is simply to redirect the Drupal neighbourhood content type pages to their actual conStruct record template (namely: now_neighbourhood.tpl)
{attribute->getURI assign='uri'} {php} $uri = $this->get_template_vars('uri'); include_once('./includes/bootstrap.inc'); drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION); $sql = "SELECT * FROM {content_type_neighbourhood} WHERE `field_neighbourhood_uri_value` LIKE '%$uri%'"; $resultset2 = db_query($sql); $nid = db_result($resultset2); global $base_url; if($nid === FALSE || $nid == "") { // If nothing can be found, then we simply display information about this record using the generic template. $_smarty_tpl_vars = $this->_tpl_vars; $this->_smarty_include(array('smarty_include_tpl_file' => "owl_thing.tpl", 'smarty_include_vars' => array())); $this->_tpl_vars = $_smarty_tpl_vars; unset($_smarty_tpl_vars); } header("HTTP/1.1 200 OK"); header("Content-Type: text/html"); header("Location: ".$base_url."/".drupal_get_path_alias("node/".$nid)); {/php}
Sample Rendering
Here is a sample rendering of this neighborhood layout: