1
council
Headline Module
  • 2005/2/2 14:33

  • council

  • Not too shy to talk

  • Posts: 184

  • Since: 2004/12/18


How do you configure the Headline module?

It seems to have a mind of it's own. The default delivers feeds that are mostly the right length except for one that usually includes far too many words.

I want to be specific about the exact amount of characters each feed gives. What do I hack to get this? Also, why doesn't this app come with more controls?

Questions:

UTF-8
ISO-8859-1
US-ASCII

How do these choices change the feed. Also, how do I add css to the feed?

Finally, the "display image" feature doesn't appear to be working. What image does it attempt to get?

Also, is anyone aware of a xoop site that's using this module with success?

Thank you.

Ric

2
LazyBadger
Re: Headline Module

Best choice for configure options - uninstall
And use XHLD - more power and flexibilty, less problems.

Diffeent charset change decoding and final presentation - you have to assing same charset, as defined in feed for accepteable (readable) results.
Image can be omitted in feed, and in this case will show nothing. you can check it by reading feed source - tag hold content of feed's image
You can't add CSS - it's generator's (read - "feed author") task.
I use XHLD instead of default Headline, but they produce visually same results, which you can see at
- front page of XOOPS Themes Exhibition (http://themes.xoops2.ru), 3-rd center-center block
- XHLD module page at XOOPS Modules Proving Ground (http://modules.xoops2.ru/modules/xhld0/)

3
council
Re: Headline Module
  • 2005/2/2 19:16

  • council

  • Not too shy to talk

  • Posts: 184

  • Since: 2004/12/18


Thanks,

Then maybe you can tell me how to configure xhld0?

I've tried it too, and can't figure it out.

I need 400 characters of feed, place at an exact location on a new page, with the css I want. I want each feed to only contain 400 charaters and if there's a way I can include a image that would be nice.

How do I do all that?

Ric

4
council
Re: Headline Module
  • 2005/2/2 21:04

  • council

  • Not too shy to talk

  • Posts: 184

  • Since: 2004/12/18


Ok, here's the xhld0 template for one of it's feeds.

What do I add to it to specify the length of the feed?

also, may I add css here too?

ric


<{html_table loop=$block.feeds cols=$block.cols table_attr='border="0" width="95%" id="xhld"' tr_attr='id="xhld"' td_attr=$block.td_attr}>

5
council
Why are all Headline Modules Half-baked?
  • 2005/2/3 9:08

  • council

  • Not too shy to talk

  • Posts: 184

  • Since: 2004/12/18


I'm sorry, boys, but from best I can tell, none of the headline modules are really ready for prime-time.

Take xhld0 for example: nice improvement over the default Headlines module, but where are the controls? What happens when you want, say, exactly 400 characters of a feed to display instead the set amount that ships with the module?

You're out of luck. And don't try going to the author's website for an answer -- your question will go uuanswered, like mine -- three times.

For example: how do I edit this code to specify the amount of characters I want in my feed:


<{html_table loop=$block.feeds cols=$block.cols table_attr='border="0" width="95%" id="xhld"' tr_attr='id="xhld"' td_attr=$block.td_attr}>

Also, Adding css and images to the feed? Forget about it. No where does it tell if this can be done or how to do it.

Am I missing something?

Has anyone worked got the answers to these questions?

When will someone write a headline module that can really give you the control you need?

ditto xmlnews

Ric

6
council
Re: Why are all Headline Modules Half-baked?
  • 2005/2/3 9:45

  • council

  • Not too shy to talk

  • Posts: 184

  • Since: 2004/12/18


To follow-up... I've included the code from the xhld template below. What do I edit to get the 400 character lenght I need?

Begin here:






























<{section name=i loop=$items}>
<{if $items[i].title != ""}>



<{/if}>
<{if $show_full == true}>
<{if $items[i].category != ""}>



<{/if}>
<{if $items[i].pubdate != ""}>




<{/if}>
<{if $items[i].description != ""}>




<{elseif $items[i].guid != ""}>




<{/if}>
<{if $items[i].content != ""}>




<{/if}>
<{/if}>
<{/section}>
<{$channel.title}>

<{if $image.url != ""}>
<{$image.title}>
<{else}>
 
<{/if}>
<{$lang_lastbuild}> <{$channel.lastbuilddate|default:" "}>
<{$lang_description}> <{$channel.description|default:" "}>
<{$lang_webmaster}> <{$channel.webmaster|default:" "}>
<{$lang_category}> <{$channel.category|default:" "}>
<{$lang_generator}> <{$channel.generator|default:" "}>
<{$lang_language}> <{$channel.language|default:" "}>
<{$items[i].title}>
<{$lang_category}> <{$items[i].category}>
<{$lang_pubdate}>:


<{$lang_description}>: <{$items[i].description}><{if $items[i].guid != ""}>  <{$lang_more}><{/if}>
<{$lang_more}>
<{$items[i].content}>

7
jdseymour
Re: Why are all Headline Modules Half-baked?

I define the amount of text to be shown in my rss feed for my site. Sites usually do not show more than a few lines of text for two reasons:

1. To draw traffic to their site.
2. bandwidth.

The text length is not defined by the rss reader it is done by the feed.

Let me add: If you enter the rss feed address in your browser, you will see the actual XML file output. It is impossible to get any more text than is listed in that file.

8
MadFish
Re: Headline Module
  • 2005/2/3 12:24

  • MadFish

  • Friend of XOOPS

  • Posts: 1056

  • Since: 2003/9/27


You can see the module working with a picture on Crushdepth.net. With the encoding, try opening up the feed you want to hook to, usually the encoding will be specified in the first few lines. Set the headlines module to the same.

9
council
Re: Why are all Headline Modules Half-baked?
  • 2005/2/3 15:19

  • council

  • Not too shy to talk

  • Posts: 184

  • Since: 2004/12/18


Actually, there is a way. This site has a javascript app that does just that:

http://jade.mcli.dist.maricopa.edu/feed/

When done, the code looks like this:






but this involves an rss parser (magpie) and the javascript working together. My problem with it is that it's not as fast as xhld0. I need 20 feeds on my front page.


Now what I'm wondering is if I could hack the xhld0 blocks. Here's the code in these blocks:

Quote:
if( ! defined( 'XHLD_BLOCK_INCLUDED' ) ) { define( 'XHLD_BLOCK_INCLUDED' , 1 ) ; $mydirname = basename( dirname( dirname( __FILE__ ) ) ) ; include_once XOOPS_ROOT_PATH."/modules/$mydirname/include/functions.php"; function b_xhld_show( $options ) { $mydirname = empty( $options[0] ) ? basename( dirname( dirname( __FILE__ ) ) ) : $options[0] ; $cols = empty( $options[1] ) ? 1 : intval( $options[1] ) ; $maxlen = empty( $options[2] ) ? 128 : intval( $options[2] ) ; $extraction = empty( $options[3] ) ? 'A' : $options[3] ; $criteria = new CriteriaCompo(); $criteria->add( new Criteria('headline_asblock', 1) ) ; if( substr( $options[3] , 0 , 1 ) == 'F' ) { // displaying only a feed $criteria->add( new Criteria('headline_id', intval( substr( $options[3] , 1 ) ) ) ) ; } // displaying feeds belongs the specified category (not yet) global $xoopsConfig; $block = array(); $block['feeds'] = array() ; $hlman =& xoops_getmodulehandler('headline', $mydirname); $headlines =& $hlman->getObjects($criteria); $count = count($headlines); for ($i = 0; $i < $count; $i++) { $renderer =& xhld_getrenderer($headlines[$i],$mydirname); if (!$renderer->renderBlock( false , $maxlen )) { if( $xoopsConfig['debug_mode'] > 0 ) { $block['feeds'][] = sprintf(_HL_FAILGET, $headlines[$i]->getVar('headline_name')).'
'.$renderer->getErrors(); } continue; } $block['feeds'][] = $renderer->getBlock(); } $block['cols'] = $cols ; $block['td_attr'] = 'width="'.(100/$cols).'%" valign="top" id="xhld"' ; $block['mod_url'] = XOOPS_URL.'/modules/'.$mydirname ; return $block; } function b_xhld_edit( $options ) { $mydirname = empty( $options[0] ) ? basename( dirname( dirname( __FILE__ ) ) ) : $options[0] ; $mydirname4edit = htmlspecialchars( $mydirname , ENT_QUOTES ) ; $cols = empty( $options[1] ) ? 1 : intval( $options[1] ) ; $maxlen = empty( $options[2] ) ? 128 : intval( $options[2] ) ; $extraction = empty( $options[3] ) ? 'A' : $options[3] ; // make options for extraction $hlman =& xoops_getmodulehandler('headline', $mydirname); $headlines =& $hlman->getObjects(new Criteria('headline_asblock', 1)); $extraction_options = "\n\n" ; foreach( $headlines as $headline ) { $extraction_options .= "\n" ; } $extraction_options = preg_replace( "/(value='$extraction')/" , "\$1 selected='selected'" , $extraction_options ) ; $ret = " "._MB_HEADLINES_COLS.":
"._MB_HEADLINES_MAXLEN.":
"._MB_HEADLINES_EXTRACT.": \n"; return $ret ; } function b_xhld_mixed_show( $options ) { $mydirname = empty( $options[0] ) ? basename( dirname( dirname( __FILE__ ) ) ) : $options[0] ; $maxitem = empty( $options[1] ) ? 10 : intval( $options[1] ) ; $maxlen = empty( $options[2] ) ? 128 : intval( $options[2] ) ; $maxitemafeed = empty( $options[3] ) ? 99 : intval( $options[3] ) ; $block = array(); $hlman =& xoops_getmodulehandler('headline', $mydirname); $headlines =& $hlman->getObjects(new Criteria('headline_asblock', 1)); $count = count($headlines); $items = array() ; for ($i = 0; $i < $count; $i++) { // list( $usec , $sec ) = explode( " " , microtime() ) ; // $starttime = $sec + $usec ; $renderer =& xhld_getrenderer($headlines[$i],$mydirname); $itemsperfeed = empty( $renderer->config["mixed_mode"] ) ? 100 : $headlines[$i]->getVar('headline_blockmax') ; $tmp_data = $renderer->getRawDataAsArray( false , min( $itemsperfeed , $maxitemafeed ) , $maxlen ) ; $dtfmt_short = empty( $renderer->config["dtfmt_short"] ) ? '' : $renderer->config["dtfmt_short"] ; // list( $usec , $sec ) = explode( " " , microtime() ) ; // echo "

" . ( $sec + $usec - $starttime ) . "sec.

" ; if( ! empty( $tmp_data ) ) { $no_pubdate_counter = $i ; foreach( $tmp_data['items'] as $item ) { if( empty( $item['pubdate'] ) ) { $item['pubdate'] = '' ; $no_pubdate_counter += $count ; $sort_weight = - $no_pubdate_counter ; } else { $sort_weight = $item['pubdate'] ; } $items[] = array( 'site_name' => $tmp_data['site_name'] , 'site_url' => $tmp_data['site_url'] , 'site_id' => $tmp_data['site_id'] , 'channel_data' => $tmp_data['channel_data'] , 'image_data' => empty( $tmp_data['image_data'] ) ? array() : $tmp_data['image_data'] , 'title' => $item['title'] , 'link' => $item['link'] , 'sort_weight' => $sort_weight , 'pubdate' => $item['pubdate'] , 'pubdate_utz' => xoops_getUserTimestamp( $item['pubdate'] ) , 'date_short' => date( $dtfmt_short , xoops_getUserTimestamp( $item['pubdate'] ) ) , 'date' => formatTimestamp( $item['pubdate'] , 'm' ) , 'description' => empty( $item['description'] ) ? '' : $item['description'] ) ; } } } // order by pubdate desc usort( $items , create_function( '$a,$b' , 'return $a["sort_weight"] < $b["sort_weight"] ? 1 : -1 ;' ) ) ; $block['maxitem'] = $maxitem ; $block['items'] = $items ; $block['mod_url'] = XOOPS_URL.'/modules/'.$mydirname ; $block['dtfmt_short'] = empty( $dtfmt_short ) ? '' : $dtfmt_short ; return $block ; } function b_xhld_mixed_edit( $options ) { $mydirname = empty( $options[0] ) ? basename( dirname( dirname( __FILE__ ) ) ) : $options[0] ; $mydirname4edit = htmlspecialchars( $mydirname , ENT_QUOTES ) ; $maxitem = empty( $options[1] ) ? 10 : intval( $options[1] ) ; $maxlen = empty( $options[2] ) ? 128 : intval( $options[2] ) ; $maxitemafeed = empty( $options[3] ) ? 99 : intval( $options[3] ) ; $ret = " "._MB_HEADLINES_MAXITEM_MIXED.":
"._MB_HEADLINES_MAXLEN.":
"._MB_HEADLINES_MAXITEMAFEED_MIXED.":\n" ; return $ret ; } } ?>




Ric

Login

Who's Online

246 user(s) are online (57 user(s) are browsing Support Forums)


Members: 0


Guests: 246


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits