Page 1 of 2

Second news block / zweiter News Block

Posted: 10. August 2009 11:36
by Kevin
In der Vergangenheit wurde häufiger mal nachgefragt, ob man einen zweiten Newsblock (aktuelle Beiträge) einbinden kann, der aus einem gewählten Forum die Beiträge anzeigt.
Das brauchte ich nun selbst und stelle euch das mal zur Verfügung. Dieser Block ist als FAQ aufgebaut, der die FAQ Beiträge aus einem Forum zieht und gesondert auf dem Portal darstellt. Variable und Namen müsst ihr euch ggf selbst anpassen.
In diesem Block wird die Textansicht verwendet, nicht die kompakte Ansicht. Für die kompakte Ansicht könnt ihr diesen Block als Gedankenanstoß nehmen.
-------------------------------------
In the past some people have asked for an additional news block who is displaying news from a specific forum. Now i needed it myself and want to share the result. This block is build up as a FAQ block, who is getting the posts of a specific forum and display them in a seperate block. You may have to adapt the names and variables yourself.
This block is the textview of the news block - not the compact view. If you want to have the compact view, you may take this block as a "roadmap".

Demo: http://www.harmony-remote-forum.de --> Block Harmony FAQ
Template: prosilver

Benötigte Dateien / Needed files:
additional_news_block_files.zip
(5.76 KiB) Downloaded 1704 times
Du kannst darin ein paar Parameter nach deinen Wünschen anpassen
-------------------------------------
You may adjust a few parameters to your needs in these files:

faq.php

Code: Select all

// Customize
$faq_forum = 35; // Forum we get the FAQ from
$faq_number = 1; // Number of FAQs to be displayed
$faq_length = 0; // Number of chars to be displayed (untill read all appears)    
Der Name des Blocks kann in dieser Zeile in der faq.html geändert werden (ändere Harmony FAQ )
-------------------------------------
The name of the block can be changed in this line in the faq.html (change Harmony FAQ )

Code: Select all

{$C_BLOCK_H_L}<dl><dt>Harmony FAQ</dt></dl>{$C_BLOCK_H_R} 

Benötigte Änderungen am Portal System:
-------------------------------------
Needed changes to the portal system:

root/portal.php

suche / search:

Code: Select all

if ($portal_config['portal_poll_topic']) 
füge davor ein / add before:

Code: Select all

include($phpbb_root_path . 'portal/block/faq.'.$phpEx); 
root/portal/includes/functions.php

suche / search:

Code: Select all

case "news_all":

            $topic_type = '( t.topic_type <> ' . POST_ANNOUNCE . ' ) AND ( t.topic_type <> ' . POST_GLOBAL . ')';
            $str_where = ( strlen($str_where) > 0 ) ? 'AND (' . trim(substr($str_where, 0, -4)) . ')' : '';
            $user_link = ( $portal_config['portal_news_style'] ) ? 't.topic_poster = u.user_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_poster_id = u.user_id' : 't.topic_poster = u.user_id' ) ;
            $post_link = ( $portal_config['portal_news_style'] ) ? 't.topic_first_post_id = p.post_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_id = p.post_id' : 't.topic_first_post_id = p.post_id' ) ;
            $topic_order = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_time DESC' : 't.topic_time DESC' ;

        break; 
füge danach ein / add after:

Code: Select all

        case "faq":

            $topic_type = '( t.topic_type <> ' . POST_ANNOUNCE . ' ) AND ( t.topic_type <> ' . POST_GLOBAL . ')';
            $str_where = ( strlen($str_where) > 0 ) ? 'AND (' . trim(substr($str_where, 0, -4)) . ')' : '';
            $user_link = ( $portal_config['portal_news_style'] ) ? 't.topic_poster = u.user_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_poster_id = u.user_id' : 't.topic_poster = u.user_id' ) ;
            $post_link = ( $portal_config['portal_news_style'] ) ? 't.topic_first_post_id = p.post_id' : (( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_id = p.post_id' : 't.topic_first_post_id = p.post_id' ) ;
            $topic_order = ( $portal_config['portal_news_show_last'] ) ? 't.topic_last_post_time DESC' : 't.topic_time DESC' ;

        break; 
suche / search:

Code: Select all

case "news_all":
             $pagination_type = 'np';
             $anker = '#n';
          break; 
füge danach ein / add after

Code: Select all

          case "faq":
             $pagination_type = 'faq_page';
             $anker = '#faq';
          break; 

Re: Second news block / zweiter News Block

Posted: 4. September 2009 00:18
by kitkat
Hi,
Thanks for guide but can you add for based on subsilver2 theme?
i tried this, but nothing changed

Re: Second news block / zweiter News Block

Posted: 4. September 2009 07:09
by Kevin
I'm sorry, I have absolutely no free time at the moment to do it.
Merge the changes (variable names) in the prosilver template with a original one (e.g. with WinMerge), see how the variable names have been changed and adapt it to subsilver2.
And share the result. ;)

Re: Second news block / zweiter News Block

Posted: 6. September 2009 13:51
by Kharon
? don't understand ..

archive feature does not work .. How can I run the news archive ?


archive feature works here
Demo: http://www.harmony-remote-forum.de --> Block Harmony FAQ



Image
sorry my english

Re: Second news block / zweiter News Block

Posted: 6. September 2009 16:58
by Kevin
This is the responsible part for the archive (in root/portal/includes/functions.php):
Kevin wrote:suche / search:

Code: Select all

case "news_all":
             $pagination_type = 'np';
             $anker = '#n';
          break;  
füge danach ein / add after

Code: Select all

          case "faq":
             $pagination_type = 'faq_page';
             $anker = '#faq';
          break;  

Re: Second news block / zweiter News Block

Posted: 6. September 2009 21:43
by Kharon
okay,I understand

I add this code block .. but it is not working (archive) ?

How will archive be active ?

e.g.
Enable the news archive system:
If enabled the news archive system / page numbers will be displayed.
thank you
sorry my english

Re: Second news block / zweiter News Block

Posted: 6. September 2009 23:57
by Kevin
There is no option in the ACP implemented.

Link to your side?

Re: Second news block / zweiter News Block

Posted: 7. September 2009 20:38
by Kharon
sorry,kevin.. :oops:

it is working :)


Thank you for block

Re: Second news block / zweiter News Block

Posted: 7. September 2009 20:40
by Kevin
Fine, glad to hear it's working! :)

Re: Second news block / zweiter News Block

Posted: 10. September 2009 20:28
by Kharon
I have a question.. How do I make multi-forum (ID's)

// Customize
$faq_forum = 5,7,9; // Forum we get the FAQ from


thank you

Re: Second news block / zweiter News Block

Posted: 10. September 2009 23:58
by Kevin
Kharon wrote:I have a question.. How do I make multi-forum (ID's)
Just like this:

Code: Select all

// Customize
$faq_forum = '5,7,9'; // Forum we get the FAQ from    

Re: Second news block / zweiter News Block

Posted: 9. November 2009 22:39
by Kharon
How can I do by topic ID

// Customize
$faq_topic_ID = '5,7,9'; // Forum we get the FAQ from

thanks

Re: Second news block / zweiter News Block

Posted: 3. May 2010 21:22
by Kharon
bump

viewtopic.php?p=19594#p19594

edit: I changed the above post

Re: Second news block / zweiter News Block

Posted: 3. March 2011 11:26
by Mess
Hmm... I can't seem to get this working. Should it work with the latest portal and 3.0.8?
Would having portal.php outside phpbb's root directory break it?

Re: Second news block / zweiter News Block

Posted: 21. June 2011 21:40
by bayer04forum
Kevin wrote:
root/portal.php

suche / search:

Code: Select all

if ($portal_config['portal_poll_topic']) 
füge davor ein / add before:

Code: Select all

include($phpbb_root_path . 'portal/block/faq.'.$phpEx); 
I also can't get it working (Phpbb 3.08 + Board3 1.6).

All the "includes" of the blocks in the current 1.6 portal.php file are written differently (with a space in the file extension)

Code: Select all

include($phpbb_root_path . 'portal/block/mini_cal.'[b] . [/b]$phpEx);
I tried to adapt that, but it didn't work.

I guess other Variables could have changed too.

Can any expert around here confirm if this is still working or not? Thanks! ;)