Пример #1
0
/**
 * this IS an API call, to make new variables available to the theme the name is constructed:
 * function [theme name]_preprocess_[template name with '-' replaced by '_']
 */

function skinology_preprocess_views_view_fields__showsite_blogs__block_1(&$variables) {
  skinology_preprocess_showsite_cast_fields($variables);
  // Earl D: this builds the link URL as relative to the show site for which the post was written
  //get the nid
  $nid = $variables['fields']['nid']->content;
  // build an absolute url, which will be relative to the show site on which the block is displayed
  $link_url = url('node/'.$nid, array('absolute' => true));
  // get the base url of the show site for which the post was written
  $show_base_url = oxygen_helpers_show_id_to_url($variables['fields']['name_1']->content);
  // replace the base url in the link
  $show_url = preg_replace('|^http://.+\.oxygen.com|', $show_base_url, $link_url);
  $variables['external_url'] = $show_url;
}
<?php
$targetPath = "node/";
$targetPath .= $row->nid;
$targetPath = drupal_get_path_alias($targetPath, $path_language = '');
$targetPathSegments = explode('/', $targetPath);
$targetPathRoot = oxygen_helpers_show_id_to_url($targetPathSegments[0]);

$targetPathUrl = $targetPathRoot . "/" . $targetPath;
?>


<div class="attach-row clear-block more-blogs-row">
  <div class="bloglist-row-image-frame png">
	  <a href="<?php print $targetPathUrl ?>"><img alt="" src="<?php print $episodic_image ?>" class="bloglist-row-image" /></a>
  </div>
  <div  class="bloglist-row-text">
    <div class="bloglist-row-name"><?php print $cast_member_short_bio ?></div>
    <div class="bloglist-row-title"><?php print $fields['title']->content ?></div>
    <div class="bloglist-row-date">Blog date <?php print $fields['created']->content ?></div>
    <div class="bloglist-row-teaser"><?php print $fields['teaser']->content ?></div>
    <span class="bloglist-row-read-more"><?php print $fields['view_node']->content ?></span>
    <span class="bloglist-row-flag"><?php if ($fields['ops_1']->content) print '| '. $fields['ops_1']->content ?></span>  
    <span class="bloglist-row-flag"><?php if ($fields['ops']->content) print '| '.  $fields['ops']->content ?></span>
  </div>
</div>