Closed GoogleCodeExporter closed 9 years ago
That data isn't in the item that Sweetcron builds and passes to the plugin. You
can
add it by adding the following after line 67 in
system/application/libraries/sweetcron.php:
67: $new->item_data['categories'] = $item->get_categories();
68: // Add in the dc:publisher.
69: $dcPublisher = $item->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'publisher');
70: $new->item_data['publisher'] = $dcPublisher[0]['data'];
Then, in your blogsearch_google_com.php, you can get to it with:
$item->item_data['publisher']
Original comment by rici...@gmail.com
on 5 Sep 2008 at 4:35
Ok thanks, that really helps to start make sense. I've done it but now I get
blank
pages for my site.
The issue is issue might be in my blogsearch_google_com.php file. Here is what
i've
done:
at line 67 in sweetcron.php i have this:
$new->item_data['categories'] = $item->get_categories();
// Add in the dc:publisher.
$dcPublisher = $item->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'publisher');
$new->item_data['publisher'] = $dcPublisher[0]['data'];
$new->item_data['tags'] = $this->get_tags($new->item_data);
$new->item_data['image'] = $this->get_image($item->get_content());
then in blogsearch_google_com.php i have:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class blogsearch_google_com {
//sample class for google blog search
function pre_db($item)
{
$item->item_data['publisher']
}
}
?>
Missing something there? Also tried with function pre_display($item).
Thanks
Original comment by seanperc...@gmail.com
on 5 Sep 2008 at 4:46
If there's nothing more you want to do with the data itself, you don't need a
plugin
at all. You can just use the data directly in the view. You'll need to add a
feed
specific block to the if statement in the view (_activity_feed.php and/or
single.php
depending on where you want it to show up).
For example, in the default
system/application/views/themes/boxy_but_good/_activity_feed.php, before line
64, you
could add something like this:
<?php elseif ($item->get_feed_domain() == 'blogsearch.google.com'): ?>
<li class="activity_item <?php if ($i % 3 == 0):?> last<?php endif;?>">
<div class="activity_list_inner">
<div class="regular_container blog">
<h2><a href="<?php echo $item->get_permalink()?>"><?php echo
$item->get_title()?></a></h2>
<div>
<?php echo word_limiter(strip_tags($item->get_content()), 25)?>
[<a href="<?php echo $item->get_permalink()?>">continue</a>]
<div style="font-size:10px; font-style:italic">Source: <?php
echo $item->item_data['publisher'];?></div>
</div>
</div>
Original comment by rici...@gmail.com
on 5 Sep 2008 at 5:10
got, thanks man. you rule
Original comment by seanperc...@gmail.com
on 5 Sep 2008 at 5:28
I highly, highly advise against editing the core sweetcron.php library.
the code in Comment 1 will break anyone's fetch if $dcPublisher doesn't return
an array.
Original comment by yongf...@gmail.com
on 5 Sep 2008 at 5:34
Hi Yong, thanks for replying.
What do you recommend? Do this in a new plugin file? please advise.
I also want to pull in the username from each twitter item. I'm doing some
different
things with this setup but I think you'll like it. Its also going to get some
good
press later this week, ive said too much! /runs
Original comment by seanperc...@gmail.com
on 5 Sep 2008 at 5:39
ok this is now fixed in the latest version of the repository.
basically now sweetcron passes the original simplepie object also, when it
calls plugin functions. so the above
code is kind of right, except it belongs in the plugins. here are the files
that changed:
http://code.google.com/p/sweetcron/source/detail?r=79
not fully tested yet though, so it's not released as an official version.
Original comment by yongf...@gmail.com
on 5 Sep 2008 at 5:46
that what we call zawsome
looks like you even updated twitter plugin for original name :)
Original comment by seanperc...@gmail.com
on 5 Sep 2008 at 5:48
Yep, thanks Yong. That's actually how I did it on my side after realizing
there's
probably a lot more data in the item I might want to get to in the plugins.
Original comment by rici...@gmail.com
on 5 Sep 2008 at 6:02
New code is working fine too, can i ask one last thing? I'm pulling in feeds
from
search.twitter.com (formally summize). They have a field for <name>CoreyBurke
(CoreyBurke)</name> for the user name. How can I grab this and use it? From the
docs
it look like that might conflict with something else. Thx
Original comment by seanperc...@gmail.com
on 5 Sep 2008 at 6:02
sean, give me a feed example
Original comment by yongf...@gmail.com
on 5 Sep 2008 at 6:25
sean, I've added a search_twitter_com plugin that adds the name of the original
poster to the item_data array
http://code.google.com/p/sweetcron/source/browse/trunk/system/application/plugin
s/search_twitter_com.ph
p
Original comment by yongf...@gmail.com
on 5 Sep 2008 at 6:57
Original issue reported on code.google.com by
se...@docstoc.com
on 4 Sep 2008 at 6:09