Hi folks,

I build a view to list my blog entries.

Since I want to edit directly on the
page, without going to administer->content->blog entry,
it would be great to have a tab with an edit field, right
like I have it in my page.tpl.php,which is spit out
by:

if ($tabs2): print '<ul class="tabs secondary">'. $tabs2 .'</ul>'; endif;

To theme my view I have an extra views-view-row-node--blogentries.tpl.php
But I don't know where I can put such a edit-tab inside this file?

Any ideas how to do that?

Thanks alot,

Best,
Soezkan

Comments

jpshayes’s picture

In views, you can add the field "Node: Edit link".

It will only appear for users that have administer nodes permissions

soezkan’s picture

Thanks for replying.

But how can I manage that when I use Row style: Node?

Best,
Soezkan

jpshayes’s picture

copy the node.tpl.php file from your theme directory.
Rename it node-blog.tpl.php
edit node-blog.tpl.php
put this code right after the first open div (or were ever you want)

<?php if ($teaser && user_access('administer nodes')): ?>
<span class="quick-edit-link">
<?php print l('edit post' , 'node/' . $nid . '/edit'); ?>
</span>
<?php endif; ?>

Upload node-blog.tpl.php to your theme directory
Flush cache by going to admin > settings > performance and clicking on the button that says clear cached data.

Now, any user that has the permission to administer nodes. When they view a blog teaser should get an edit link (depending on were you put the code provided above) somewhere in that teaser.

dman’s picture

jpshayes’s picture

Never used that one before, looks useful

soezkan’s picture

Super!!! Now I can edit each node in the view! Thanks alot :)

<?php if ($content && user_access('administer nodes')): ?>
<span class="quick-edit-link">
<?php print l('edit post' , 'node/' . $nid . '/edit'); ?>
</span>
<?php endif; ?>

all the best,
Soezkan