I have a custom jquery rotator that I'm using. I have a view set up, and I've placed that in my page--front.tpl.php using the following code...

<?php
$view
= views_get_view('homepage_rotator');
$args = '';
$thisView = $view->execute_display('block', $args);
print
$thisView['content'];
?>

But in order for this to work, I have to create 3 views templates...
views-view.tpl.php -- to clean up all the extra markup and just print $rows
views-view-unformatted.tpl.php -- to clean up markup and just print $row in a foreach looop
views-view-fields.tpl.php -- so i can specifically put fields and markup where I need them (see below)

<li>
  <div class="output" style="position: relative; width: 1024px; height: 375px; background: tan url('<?php print $file_path; ?>') top left no-repeat;">
    <div style="position: absolute; bottom: 45px; left: 35px;">
      <h1><?php print $fields['title']->content; ?></h1>
      <span class="typekit"><?php print $fields['field_tagline']->content; ?></span>
    </div>
  </div>
</li>

So this works. I just feel dirty doing it this way. I feel like there might be a cleaner way that wouldn't require me to create 3 template files for views. I just don't know what that would be.

I was wondering if anyone had any thoughts on this?

Comments

---

Create a view of fields, add the fields you want to include, then check off "exclude from display". Then add the "Global Custom Text" field, and your code will look something like:

<li>
  <div class="output" style="position: relative; width: 1024px; height: 375px; background: tan url('[field_image]') top left no-repeat;">
    <div style="position: absolute; bottom: 45px; left: 35px;">
      <h1>[title]</h1>
      <span class="typekit">[tagline]</span>
    </div>
  </div>
</li>

That's not a bad idea. Never

That's not a bad idea. Never thought to do that. Hopefully I can disable the other view wrapper items. This might work. Thanks!

nobody click here