11
V6-Maniac
Re: NEWS Modules
  • 2006/1/13 21:54

  • V6-Maniac

  • Just popping in

  • Posts: 86

  • Since: 2005/2/15


Okay for now we do not talk about the layout.
Thats up to you when al is finished.
But how do you and new blocks to the news module.
For some it looks mayby overkill in some issues.
But it is neccesery because de News Module will crash if you something else.

Beware...! I added new blocks and deleted the old blocks.
So if you do it my way you only have 5 recente spotlight newsblocks and 1 headlines block.

How did i added new block.

Uninstall the News module first...

----------------------------------------------------------------

First go to your news module root and find the file Xoops_verion.php
And open it with your favorite editor.

Find
// Blocks
$modversion['blocks'][1]['file'] = "news_topics.php";
$modversion['blocks'][1]['name'] = _MI_NEWS_BNAME1;
$modversion['blocks'][1]['description'] = "Shows news topics";
$modversion['blocks'][1]['show_func'] = "b_news_topics_show";
$modversion['blocks'][1]['template'] = 'news_block_topics.html';

$modversion['blocks'][2]['file'] = "news_bigstory.php";
$modversion['blocks'][2]['name'] = _MI_NEWS_BNAME3;
$modversion['blocks'][2]['description'] = "Shows most read story of the day";
$modversion['blocks'][2]['show_func'] = "b_news_bigstory_show";
$modversion['blocks'][2]['template'] = 'news_block_bigstory.html';

$modversion['blocks'][3]['file'] = "news_top.php";
$modversion['blocks'][3]['name'] = _MI_NEWS_BNAME4;
$modversion['blocks'][3]['description'] = "Shows top read news articles";
$modversion['blocks'][3]['show_func'] = "b_news_top_show";
$modversion['blocks'][3]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][3]['options'] = "counter|10|25|0|0|0|0||1||||||";
$modversion['blocks'][3]['template'] = 'news_block_top.html';

$modversion['blocks'][4]['file'] = "news_top.php";
$modversion['blocks'][4]['name'] = _MI_NEWS_BNAME5;
$modversion['blocks'][4]['description'] = "Shows recent articles";
$modversion['blocks'][4]['show_func'] = "b_news_top_show";
$modversion['blocks'][4]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][4]['options'] = "published|10|25|0|0|0|0||1||||||";
$modversion['blocks'][4]['template'] = 'news_block_top.html';

$modversion['blocks'][5]['file'] = "news_moderate.php";
$modversion['blocks'][5]['name'] = _MI_NEWS_BNAME6;
$modversion['blocks'][5]['description'] = "Shows a block to moderate articles";
$modversion['blocks'][5]['show_func'] = "b_news_topics_moderate";
$modversion['blocks'][5]['template'] = 'news_block_moderate.html';

$modversion['blocks'][6]['file'] = "news_topicsnav.php";
$modversion['blocks'][6]['name'] = _MI_NEWS_BNAME7;
$modversion['blocks'][6]['description'] = "Shows a block to navigate topics";
$modversion['blocks'][6]['show_func'] = "b_news_topicsnav_show";
$modversion['blocks'][6]['template'] = 'news_block_topicnav.html';
$modversion['blocks'][6]['options'] = "0";
$modversion['blocks'][6]['edit_func'] = "b_news_topicsnav_edit";

$modversion['blocks'][7]['file'] = "news_randomnews.php";
$modversion['blocks'][7]['name'] = _MI_NEWS_BNAME8;
$modversion['blocks'][7]['description'] = "Shows a block where news appears randomly";
$modversion['blocks'][7]['show_func'] = "b_news_randomnews_show";
$modversion['blocks'][7]['template'] = 'news_block_randomnews.html';
$modversion['blocks'][7]['options'] = "published|10|25|0|0";
$modversion['blocks'][7]['edit_func'] = "b_news_randomnews_edit";


Replace with
// Blocks
$modversion['blocks'][1]['file'] = "news_top.php";
$modversion['blocks'][1]['name'] = _MI_NEWS_BNAME1;
$modversion['blocks'][1]['description'] = "Block 1";
$modversion['blocks'][1]['show_func'] = "b_news_top_show";
$modversion['blocks'][1]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][1]['options'] = "published|10|25|0|0|0|0||1||||||";
$modversion['blocks'][1]['template'] = 'news_block_top1.html';        // news_block_recent.html

$modversion['blocks'][2]['file'] = "news_top.php";
$modversion['blocks'][2]['name'] = _MI_NEWS_BNAME3;
$modversion['blocks'][2]['description'] = "Block 2";
$modversion['blocks'][2]['show_func'] = "b_news_top_show";
$modversion['blocks'][2]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][2]['options'] = "published|10|25|0|0|0|0||1||||||";
$modversion['blocks'][2]['template'] = 'news_block_top2.html';        // news_block_recent.html

$modversion['blocks'][3]['file'] = "news_top.php";
$modversion['blocks'][3]['name'] = _MI_NEWS_BNAME4;
$modversion['blocks'][3]['description'] = "Block 3";
$modversion['blocks'][3]['show_func'] = "b_news_top_show";
$modversion['blocks'][3]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][3]['options'] = "published|10|25|0|0|0|0||1||||||";
$modversion['blocks'][3]['template'] = 'news_block_top3.html';        // news_block_recent.html

$modversion['blocks'][4]['file'] = "news_top.php";
$modversion['blocks'][4]['name'] = _MI_NEWS_BNAME5;
$modversion['blocks'][4]['description'] = "Block 4";
$modversion['blocks'][4]['show_func'] = "b_news_top_show";
$modversion['blocks'][4]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][4]['options'] = "published|10|25|0|0|0|0||1||||||";
$modversion['blocks'][4]['template'] = 'news_block_top4.html';        // news_block_recent.html

$modversion['blocks'][5]['file'] = "news_top.php";
$modversion['blocks'][5]['name'] = _MI_NEWS_BNAME6;
$modversion['blocks'][5]['description'] = "Block 5";
$modversion['blocks'][5]['show_func'] = "b_news_top_show";
$modversion['blocks'][5]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][5]['options'] = "published|10|25|0|0|0|0||1||||||";
$modversion['blocks'][5]['template'] = 'news_block_top5.html';        // news_block_recent.html

$modversion['blocks'][6]['file'] = "news_top.php";
$modversion['blocks'][6]['name'] = _MI_NEWS_BNAME8;
$modversion['blocks'][6]['description'] = "Block 5";
$modversion['blocks'][6]['show_func'] = "b_news_top_show";
$modversion['blocks'][6]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][6]['options'] = "published|10|25|0|0|0|0||1||||||";
$modversion['blocks'][6]['template'] = 'news_block_top6.html';        // news_block_recent.html



Second go to module language map.
Xoopsroot --> Modules --> News --> Language --> English or else.
And open modinfo.php with your favorite editor.

Find
// Names of blocks for this module (Not all module has blocks)
define('_MI_NEWS_BNAME1','News Topics');
define('_MI_NEWS_BNAME3','Big Story');
define('_MI_NEWS_BNAME4','Top News');
define('_MI_NEWS_BNAME5','Recent News');
define('_MI_NEWS_BNAME6','Moderate News');
define('_MI_NEWS_BNAME7','Navigate thru topics');


Replace with
define('_MI_NEWS_BNAME1','Block 1');
define('_MI_NEWS_BNAME3','Block 2');
define('_MI_NEWS_BNAME4','Block 3');
define('_MI_NEWS_BNAME5','Block 4'); //Headlines block article 
define('_MI_NEWS_BNAME6','block 5');
define('_MI_NEWS_BNAME8','block 6');


Third go to your News Module Blocks Template Map.
Xoopsroot --> Modules --> News --> Templates --> Blocks...
And create there 6 new files named:

news_block_top1.html
news_block_top2.html
news_block_top3.html
news_block_top4.html
news_block_top5.html
news_block_top6.html

In news_block_top4 you add the following:
<div class="blockContent"><font size="2">&nbsp;<b>Headlines</b></font><br /><br />
<{if 
$block.displayview==2}>


<
ul id="tabNavigation">
<{foreach 
item=onetab from=$block.tabs}>
    <{if 
$block.current_tab == $onetab.id}>
    <
li class="selectedTab"><a href='#'><{$onetab.title}></a></li>
    <{else}>
    <
li><a href="<{$block.url}>NewsTab=<{$onetab.id}>"><{$onetab.title}></a></li>
    <{/if}>
<{/foreach}>
    <
li class="fixTabsIE"><a href="javascript:void(0);">&nbsp;</a></li>
</
ul>

<{if 
$block.current_is_spotlight}>
    <
div style="border-top: 1px solid rgb(0, 0, 0); background: <{$block.color1}> none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><{$block.spotlight.author}> <{$block.lang_on}> <{$block.spotlight.date}> <{if $block.use_rating}> - <{$block.spotlight.rating}>/10 (<{$block.spotlight.number_votes}>)<{/if}>, <{$block.spotlight.hits}> <{$block.lang_reads}><br /></div>
<{else}>
    <
div style="border-top: 1px solid rgb(0, 0, 0); background: <{$block.color1}> none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">
    <{foreach 
item=onesummary from=$block.smallheader}>
        <{
$onesummary}>&nbsp;
    <{/foreach}>
    <
br /></div>
<{/if}>

<
div id="fullSupport">
    <{if 
$block.current_is_spotlight && $block.tabs.id==0}>
        <
table border=0>
        <
tr>
            <
td colspan='2'><div class="itemBody"><ul><li><{$block.spotlight.title_with_link}></li></ul></div></td>
        </
tr>
        <
tr>
            <
td><{$block.spotlight.image}>&nbsp;</td><td><class="note"><{$block.spotlight.text}></p></td>
        </
tr>
        </
table>
        <
br /><center><hr width='85%'></center>
        <
ul>
            <{foreach 
item=onenews from=$block.spotlight.news}>
                <
li><{$onenews.date}> - <{$onenews.title_with_link}></li>
            <{/foreach}>
        </
ul>
    <{else}>
        <{foreach 
item=onenews from=$block.news}>
            <
div class="itemBody"><ul><li><{$onenews.title}></li></ul><span class="itemStats">&nbsp;&nbsp;<{$onenews.author}> <{$block.lang_on}> <{$onenews.date}> - <{if $block.use_rating}> <{$onenews.rating}>/10 (<{$onenews.number_votes}>)<{/if}>, <{$onenews.hits}> <{$block.lang_reads}></span></div>
            <
class="note"><{$onenews.text}></p>
        <{/foreach}>
    <{/if}>
</
div>
<{else}>
<
table>
    <{if 
$block.spotlight}>
    <
tr>
        <
td><table>
        <
tr>
            <
td colspan=2><font  size="3"><b><{$block.spotlight.title}></b></font><br /> <i><small><font> &nbsp;<{$block.spotlight.author}> - 
            <{if 
$block.sort=='counter'}>
                (<{
$block.spotlight.hits}>)
            <{elseif 
$block.sort=='published'}>
                (<{
$block.spotlight.date}>)
            <{else}>
                (<{
$block.spotlight.rating}>)
            <{/if}></
i></small></font><br />
            </
td>
        </
tr>
        <
tr>
            <
td ><{$block.spotlight.image}></td><td><{$block.spotlight.text}></td>
        </
tr>
        <
tr>
            <
td colspan=><div align='left'>&nbsp;&nbsp;&nbsp;<a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$block.spotlight.id}>">Read More...</a></div></td>
        </
tr>
        </
table></td>
    </
tr>
    <{/if}>

    
</
table>
<{/if}>
<
table>
<
tr>
        <
td>
            
                <{foreach 
item=news from=$block.stories}>
                    <{if 
$news.id != $block.spotlight.id}>        
&
nbsp;&nbsp;<{if $block.sort=='counter'}>[<{$news.hits}>]
                        <{elseif 
$block.sort=='published'}><{else}>[<{$news.rating}>]
                        <{/if}><
a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$news.id}>" <{$news.infotips}>><{$news.title}></a><{$news.teaser}><br />
                    <{/if}>
                <{/foreach}><
br />
            
        </
td>
    </
tr>
</
table></div>



And in news_block_top1 / 2 / 3 / 5 / 6 / the following:
<div class="blockContent"><table>
    <{if 
$block.spotlight}>
    <
tr>
        <
td><table>
        <
tr>
            <
td colspan=2><font  size="2"><b><{$block.spotlight.title}></b></font><br /> <i><small><font> <{$block.spotlight.author}> - 
            <{if 
$block.sort=='counter'}>
                (<{
$block.spotlight.hits}>)
            <{elseif 
$block.sort=='published'}>
                (<{
$block.spotlight.date}>)
            <{else}>
                (<{
$block.spotlight.rating}>)
            <{/if}></
i></small></font><br />
            </
td>
        </
tr>
        <
tr>
            <
td ><{$block.spotlight.image}></td><td><{$block.spotlight.text}></td>
        </
tr>
        <
tr>
            <
td colspan=><div align='left'>&nbsp;&nbsp;&nbsp;<a href="<{$xoops_url}>/modules/news/article.php?storyid=<{$block.spotlight.id}>">Read More...</a></div></td>
        </
tr>
        </
table></td>
    </
tr>
    <{/if}>

    
</
table></div>


Now go and install your News module as you normaly shut do.
And if all is inserted correctly you will have 6 new blocks.

Beware, to show the recent news article you have enable the spotlight selcetion in de block admin.
With the orginal Recente Blocks admin you can give eache block his own category to show.

good look...

12
filesiteguy
Re: NEWS Modules

Cool, will check AMS again. I think I have that on one of my sites.
Kai Ponte
The FileNET Developer Forum || My Site

$question = $bb|!$b(2)...

Login

Who's Online

162 user(s) are online (107 user(s) are browsing Support Forums)


Members: 0


Guests: 162


more...

Donat-O-Meter

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

Latest GitHub Commits