By kabaman on
hi
i wrote my own teaser-list for my custom modules content-type
because for some reasons i dont want to list the node-teasers by taxonomy terms
i want to list them by content-type
i also dont want to use the views.module
so. it would be a great help for me if you could tell me if the following code is the right thing to generate a list of nodes
<?php
function _blog_teaserlist() {
$output = '';
// get a paged list of nodes of specific content-type
$result = pager_query(db_rewrite_sql(
"SELECT nid FROM {node} WHERE status = 1 AND type = 'blog' ORDER BY sticky DESC, changed DESC"
),variable_get('blog_teaser_maxdisp', 5));
while ($nodeid = db_fetch_object($result)){
// load node data
$node = node_load($nodeid->nid);
// add themed teaser
$output .= theme('node', $node, true, false);
}
return $output;
}
?>
if this is a valid way to generate a list of nodes in teaser view how can i create a rss feed out of it
i tried node_feed() but it doesent seem to generate valid feed urls
do i have to preprae something beforehand
thanx for any help
Comments
Pretty good
I'd say there are some readability problems, but that's totally up to you.
One thing you might want to do is:
Sorry, I don't RSS so I can't answer that part.
Nancy W.
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in your database
NancyDru
thanx for your quick reply >
thanx for your quick reply
> I'd say there are some readability problems, but that's totally up to you.
you mean my bad english or the code ?
> return $output . theme('pager', NULL, variable_get('blog_teaser_maxdisp', 5));
yes. i forgot to post it because its in another section of my code
best wishes
format_rss_channel
I've never done this, but I quick search of the code and I found format_rss_channel, see events and views modules for examples of its usage.
my solution
thanx for your reply
i use now node_feed which is calling format_rss_channel
here is my solution which works for me
adapted version
forgot to say that i just adapted the original blog_feed_last() function of blog.module
its the trick
thanx kab , i wanted to show a rss feed which will include all the post for a specific taxonomy of blog , your solution did the trick for me . thanx again.