Hi,

I'm using the frontpage.module which means I need to manually invoke certain blocks to display them. The following format has worked for me for Views.module blocks and Tagadelic blocks, but doesn't seem to work for the standard Aggregator.module, any thoughts what I'm doing wrong?

I'm trying to display the latest news from the 1st feed I added (which has a CSS id of #block-aggregator-feed-1).

$block = module_invoke('aggregator-feed', 'block', 'view', 1);
print $block['content'];

Thanks,

Alex

Comments

mooffie’s picture

It should be:

$block = module_invoke('aggregator', 'block', 'view', 'feed-1');
print $block['content'];
any thoughts what I'm doing wrong?

First, you need to call the aggregator module, not the non-existent aggregator-feed module. Second, this specific module expects block IDs of the form feed-n or category-n.

When you see a string of the form "#block-aggregator-feed-1" you should keep in mind that is stands for "#block-some_module_name-some_block_id".

ALT83’s picture

Perfecto thanks! :)

texas-bronius’s picture

This thread has answered my initial question (how to invoke a particular block when not using a real theme) and whetted my appetite for a step further: I'm using the simplenews module, and following your snippet, I now successfully see the output of the simple news module block on the page:

<?php
  $block = module_invoke('simplenews', 'block', 'view', 'newsletter-1');
  print $block['content'];
?>

but how to get the module to actually receive and process the subscription's form post?

This is for a one-time, front_page-only bandage page while the rest of the site is being developed behind the scenes.

--
http://drupaltees.com
80s themed Drupal T-Shirts

texas-bronius’s picture

quick update here.. I think module_invoke is enough (right?), and that I'm actually having problems with the configuration of the module itself. I will post back here if I discover anything new, but if anyone sees my folly based on what I provided, I am of course all ears!

--
http://drupaltees.com
80s themed Drupal T-Shirts

safetypin’s picture

Any idea why this wouldn't work? I'm using this code inside a block, to pull in several different block views of news feeds and display them in a single (manually added) block. This works fine with views, but I also can't find any way to bring the aggregated news items into a view. This code works perfectly if I have views set up for local stories, but I'm trying to do the same thing with stories from another site.

<ul class="front-page-news">
<li id="alumni-tab" class="active"><a href="#" onclick="news_swap('alumni-news-block','alumni-tab');return false;">Alumni</a></li>
<li id="athletic-tab"><a href="#" onclick="news_swap('athletic-news-block','athletic-tab');return false;">Athletics</a></li>
</ul>
<?php
$alumni = module_invoke('aggregator', 'block', 'view', 'feed-2');
$athletics = module_invoke('aggregator', 'block', 'view', 'feed-3');
?>
<div id="alumni-news-block">
<?php print $alumni['content'];?>
</div>
<div id="athletic-news-block" style="display:none">
<?php print $athletics['content'];?>
</div>

P.S. I'm running d5.10.

safetypin’s picture

i uhm.. forgot to change the input method to php. *head-smack*

phpsharma’s picture

Nice to archive
sharma chelluri

AntiNSA’s picture

You guys are so smart! Can you check out my thread @ http://drupal.org/node/325545 it is about this rss feed stuff which is killing me.

rewted’s picture

How would you display the content of ../aggregator/sources/1 ?