I would like to have the link that appears in the aggregator block that opens a new blog entry form with the title of the item already in the form, to also appear on all of the item list pages. From what I've found on this site, it was apparently set up that way, and then it was decided to remove the link from a later Drupal version because it was thought to be not useful. IMHO it would have been better to give an option to turn it on or off in order to leave the decision about its usefulness to the admin for each site.

In any case, my php skills are not up to the task of figuring out how to get it back, so I'd be appreciative to anyone who can point me in the right direction or help with a code snippet.

Thanks

Comments

RWWood’s picture

No takers, or did I post it in the wrong forum?

WorldFallz’s picture

You're in the right place-- but response times can vary and as this forum is entirely volunteer, not every post gets a response.

That said, create a file named 'aggregator-item-tpl.php' in your theme's directory and place the following inside:

<div class="feed-item">
  <h3 class="feed-item-title">
    <a href="<?php print $feed_url; ?>"><?php print $feed_title; ?></a>
  </h3>

  <div class="feed-item-meta">
  <?php if ($source_url) : ?>
    <a href="<?php print $source_url; ?>" class="feed-item-source"><?php print $source_title; ?></a> -
  <?php endif; ?>
    <span class="feed-item-date"><?php print $source_date; ?></span>
    <span class="blog-it"><?php print l('Blog it!','node/add/blog', array('attributes' => array('title' => t('Comment on this news item in your personal blog.'), 'class' => 'blog-it'), 'query' => "iid=$item->iid", 'html' => TRUE)); ?></span>
  </div>

<?php if ($content) : ?>
  <div class="feed-item-body">
    <?php print $content; ?>
  </div>
<?php endif; ?>

<?php if ($categories) : ?>
  <div class="feed-item-categories">
    <?php print t('Categories'); ?>: <?php print implode(', ', $categories); ?>
  </div>
<?php endif ;?>

</div>

Then clear the drupal cache and adjust to suit if desired.

RWWood’s picture

I finally figured out how to mimic the code in the Agregator News block. Using your code, I changed a bit of it so the blog it link only shows if a user is authorized to post blogs.

  <?php if ($user->uid && module_exists('blog') && user_access('create blog entries')) : ?>
    <span class="blog-it"><?php print l('Blog it!','node/add/blog', array('attributes' => array('title' => t('Comment on this news item in your personal blog.'), 'class' => 'blog-it'), 'query' => "iid=$item->iid", 'html' => TRUE)); ?></span>
  <?php endif; ?>
WorldFallz’s picture

Excellent! FYI-- this kind of logic usually goes in the template.php file and then you just <?php print $blogit ?> in the tpl.php file. imo it's fine where it is, i just don't want to teach you 'incorrectly', lol.

RWWood’s picture

I know that's the "right" way to do it, but I'm still trying to figure out which functions can be overridden in the template.php file and which can't. I'm under the impression that only theme_function_name type functions can be overridden by changing the name to my_theme_name_function_name. Then I'm way in the dark about which variables can be used in the tpl.php file with a print statement. Slowly I'm starting to "get it," though.

Thanks for your help.

drupert55’s picture

Hello.

I don't see the 'blog it' icons in Feed Aggregator.

I created the file and placed it inside the admire_gray theme folder then cleared the drupal cache via Performance and the Firefox browser's cache.

How to get this feature activated?

Thanks.

ee97083’s picture

Hi,

I think you should try to create a file named aggregator-item.tpl.php in your theme's directory. If you create a file 'aggregator-item-tpl.php' nothing happens.

Regards