By aharown07 on
I'm probably not saying this right. What I've got is a view I've set to display nodes of a particular content type... in a block on my front page. Because it looks nicer, I've got the "rowtype" set to node, so it doesn't use fields.
What I want to do is change what order it prints the fields in compared to front page. Put the meta stuff after rather than before, but still have it before on front page stories.
So what I'm thinking is some kind of conditional in node.tpl.php that looks at the content type maybe? Is that possible? Never attempted anything like this though I've done some cut and paste in node.tpl.php.
Am I on the right track?
Comments
In your node.tpl.php <?php
In your node.tpl.php
If you want to do it based on
If you want to do it based on the fact that the nodes are being shown "in a specific view" (not just the front page) then this code may help: http://drupal.org/node/387036
I tested it out and it works well (you can remove all the extra data printing). I'm not sure how to get it to work for a specific "display" of a view, but hopefully someone can answer that if you need it.
You can definitely use fields in view though when needed... how it "looks" is entirely up to you. Here's another post where I explained how to theme Views fields the way I personally prefer to http://drupal.org/node/368691#comment-1236820 ... with this way you can pretty easily "emulate" your node template if you want. You can also use separate templates for each individual field, but I don't prefer so many template files (rather a single file similar to a node template).
Thanks. I think I should be
Thanks. I think I should be able to do it w/this info!
Edit: actually, the posts you mentioned seem to refer to Views pages.... unless I read wrong. What I'm trying to do is change display of a view in a block on my front page.
I suppose I could use fields and try to style them all, but I'm looking for an easier way. Right now, when I change the row style to fields, the teaser links all disappear.
New working example
Worked on the code a bit more, and discovered about views_get_current_view().
Here is a working example. The View I'm using is a simple View which lists node teasers of Story nodes, and has both a Page display and a Block display added. The Block has been enabled at admin/build/block.
The following code is currently added to node.tpl.php (if appropriate for the actual use-case, ideally it ought to be switched to a preprocess function to keep complex PHP logic separate from the theme files):
I think it get it. Then I'd
I think it get it. Then I'd be pasting in the code from my current node.tpl.php w/the changes I want... in place of "this is the block_1 display", am I right?
Many thanks.