Jump to content

Drupal Basic Theming


chiazkiark

Recommended Posts

Hi guys,

 

I'm a PHP developer with about 6 years experience. Been given a tight ass deadline to get some work done, and need to finish this section. I'm stuck on one thing, I just cannot get my head around it.

 

I have a content type called 'About Us'

 

I have a node called about us which loads up node--about_us.tpl.php, inside this I'm using:

 

<?php
$view = views_get_view('board_members');
print $view->preview('default');
?>

 

To pull up parts of a tab functionality, Board Members for example. Now, in my views folder I have views-view--board_members.tpl.php, and this has the following, (I believe "standard" code inside it, that I have C+P'd from another):

 

brrr<?php
/**
* @file views-view.tpl.php
* Main view template
*
* Variables available:
* - $classes_array: An array of classes determined in
*   template_preprocess_views_view(). Default classes are:
*     .view
*     .view-[css_name]
*     .view-id-[view_name]
*     .view-display-id-[display_name]
*     .view-dom-id-[dom_id]
* - $classes: A string version of $classes_array for use in the class attribute
* - $css_name: A css-safe version of the view name.
* - $css_class: The user-specified classes names, if any
* - $header: The view header
* - $footer: The view footer
* - $rows: The results of the view query, if any
* - $empty: The empty text to display if the view is empty
* - $pager: The pager next/prev links to display, if any
* - $exposed: Exposed widget form/info to display
* - $feed_icon: Feed icon to display, if any
* - $more: A link to view more, if any
*
* @ingroup views_templates
*/

$year = $view->args[0];
?>
<div class="<?php print $classes; ?>">
  <?php print render($title_prefix); ?>
  <?php if ($title): ?>
    <?php print $title; ?>
  <?php endif; ?>
  <?php print render($title_suffix); ?>
  <?php if ($header): ?>
    <div class="view-header">
		<div class="item-list">
			<ul class="pager">
				<li class="pager-previous">
					<a href="/investors/statements-and-results/<?php print $year - 1; ?>"><</a>
				</li>
		<?php if($year != date('Y')): ?>
				<li class="pager-next">
					<a href="/investors/statements-and-results/<?php print $year + 1; ?>">></a>
				</li>
		<?php endif; ?>
			</ul>
		</div>
      <div class="view-header-content"><?php print $header; ?></div>
    </div>
  <?php endif; ?>

  <?php if ($exposed): ?>
    <div class="view-filters">
      <?php print $exposed; ?>
    </div>
  <?php endif; ?>

  <?php if ($attachment_before): ?>
    <div class="attachment attachment-before">
      <?php print $attachment_before; ?>
    </div>
  <?php endif; ?>

  <?php if ($rows): ?>
    <div class="view-content">
      <?php print $rows; ?>
    </div>
  <?php elseif ($empty): ?>
    <div class="view-empty">
      <?php print $empty; ?>
    </div>
  <?php endif; ?>

  <?php if ($pager): ?>
    <?php print $pager; ?>
  <?php endif; ?>

  <?php if ($attachment_after): ?>
    <div class="attachment attachment-after">
      <?php print $attachment_after; ?>
    </div>
  <?php endif; ?>

  <?php if ($more): ?>
    <?php print $more; ?>
  <?php endif; ?>

  <?php if ($footer): ?>
    <div class="view-footer">
      <?php print $footer; ?>
    </div>
  <?php endif; ?>

  <?php if ($feed_icon): ?>
    <div class="feed-icon">
      <?php print $feed_icon; ?>
    </div>
  <?php endif; ?>

</div><?php /* class view */ ?>

 

Note, I started the file with brrr, to confirm it was there, lol. Anyway, all this seems to show up is this:

 

    brrr<div class="view view-board-members view-id-board_members view-display-id-default view-dom-id-f9636e94d7d13be92df6a9a964981ff5 contextual-links-region">
      <div class="contextual-links-wrapper contextual-links-processed"><a class="contextual-links-trigger" href="#">Configure</a><ul class="contextual-links"><li class="views-ui-edit first last"><a href="/admin/structure/views/view/board_members/edit/default?destination=node/235">Edit view</a></li>
</ul></div>  
  
  
      <div class="view-content">
        <div class="views-row views-row-1 views-row-odd views-row-first">
      
  <div class="views-field views-field-title">        <span class="field-content"><a href="/first-last">First Last</a></span>  </div>  </div>
  <div class="views-row views-row-2 views-row-even views-row-last">
      
  <div class="views-field views-field-title">        <span class="field-content"><a href="/first-last">First Last</a></span>  </div>  </div>
    </div>
  
  
  
  
  
  
</div>  

 

Please ignore the admin contextual link code. Anyway, I honestly have no idea how to be able to create individual html structures per item, i.e. board member, please could a guru point me in the right direction?

 

Thank you for reading,

 

Charles.

Link to comment
https://forums.phpfreaks.com/topic/268085-drupal-basic-theming/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.