Jump to content
InvisionCommunity.de - Der Deutsche Invision Community Support
Sign in to follow this  
Digger

News auf Webseite

Recommended Posts

Salü,

ich habe die Forum als News mit Hilfe der ssi_templates in meine Homepage außerhalb des Boards eingebaut. Dazu habe ich die Datei news.html benutzt. Es funktioniert auch, aber ich stelle mir das noch etwas anders vor.

Momentan ist es so, daß jedes Topic, was ich erstelle als neue News auf meiner News-Seite erscheint. Ich möchte aber gerne, daß die News eines Tages zusammen gefaßt erscheint.

Also wie zum Beispiel hier bei Planet3DNow.

Da sieht es so aus:

Datum (nur einmal)

Thema 1

postet by

Thema bla bla bla....

Thema 2

postet by

Thema bla bla bla....

Thema 3

postet by

Thema bla bla bla....

Bei mir ist es halt:

Datum

postet by

Thema 1

Thema bla bla bla....

Datum

postet by

Thema 2

Thema bla bla bla....

Wißt Ihr, was ich meine?

Meine news.html sieht so aus

<table cellpadding='4' cellspacing='1' border='0' width='100%' bgcolor='#505050' style='font-family:Verdana;font-size:12px'>

<tr>

 <td align='left' background="Grafiken/tile.gif" bgcolor='#6464D2'><font color="#FFFFFF"><b>{post_date} by {member_name}</b></font></td>

</tr>

<tr>

 <td align='left'bgcolor='#E6E6FF'>

 <b>{topic_title}</b>

 <br><br>

 <table style='border:0px dotted gray;width:100%;font-family:Verdana;font-size:11px'><tr><td>{post}</td></tr></table><br>Kommentare: {comments} :: <a href='{view_all_link}'>Kommentare ansehen</a>

 </td>

</tr>

</table>

<br>

Könnt Ihr mir sagen, was ich da ändern muß?

Danke, Euer Digger

Share this post


Link to post

Das sollte ohne Probleme funktionieren, nur muß man die ssi.php ein wenig anpassen. Ich schau mal, ob ich dir morgen mal eine Anleitung dementsprechend bastel. ;)

Share this post


Link to post

Laß Dir ruhig Zeit, auf ein paar Tage kommt es nicht an! :)

Zeit hab ich mir gelassen und es sind ein paar Tage mehr geworden, hab dich aber nicht vergessen. ;)

Datei ssi.php

Suche:

	case 'news':
 do_news();
 break;
Darunter einfügen:
	case 'newssum':
 do_news_summary();
 break;
Suchen:
//+-------------------------------------------------
// GLOBAL ROUTINES
//+-------------------------------------------------
Darüber einfügen:
function do_news_summary()
{
global $DB, $ibforums, $root_path, $templates_dir, $std, $max_show;

$dateformat = "%d.%m.%Y";

if ( (! $ibforums->vars['news_forum_id']) or ($ibforums->vars['news_forum_id'] == "" ) )
{
 fatal_error("No news forum assigned");
}

require $root_path."sources/lib/post_parser.php";

$parser = new post_parser();

$perpage = intval($ibforums->input['show']) > 0 ? intval($ibforums->input['show']) : 10;

$perpage = ( $perpage > $max_show ) ? $max_show : $perpage;

// Load the template...

$template = load_template("news_summary.html");

preg_match( "#\[TOP\](.+?)\[/TOP\]#is", $template, $match );

$top    = trim($match[1]);

preg_match( "#\[ROW\](.+?)\[/ROW\]#is", $template, $match );

$prow  = trim($match[1]);

preg_match( "#\[BOTTOM\](.+?)\[/BOTTOM\]#is", $template, $match );

$bottom = trim($match[1]);

$to_echo = "";

$aktiv_date = "";

// Get the topics, member info and other stuff

$DB->query("SELECT m.name as member_name, m.id as member_id,m.title as member_title, m.avatar, m.avatar_size, m.posts, t.*, p.*, DATE_FORMAT(FROM_UNIXTIME(post_date), '$dateformat') AS day_date, g.g_dohtml, f.use_html
            FROM ibf_topics t
             LEFT JOIN ibf_posts p ON (p.new_topic=1 AND p.topic_id=t.tid)
             LEFT JOIN ibf_members m ON (m.id=t.starter_id)
             LEFT JOIN ibf_groups g ON (g.g_id=m.mgroup)
             LEFT JOIN ibf_forums f ON (t.forum_id=f.id)
      WHERE t.forum_id={$ibforums->vars['news_forum_id']} AND t.approved=1 ORDER BY t.tid DESC LIMIT 0, $perpage");

if ( ! $DB->get_num_rows() )
{
 fatal_error("Could not get the information from the database");
}

while ( $row = $DB->fetch_row() )
{
 if ($aktiv_date != $row['day_date'])
 {
 if ($aktiv_date != 0)
 {
   $to_echo .= $bottom;
 }
 
 $to_echo .= parse_template( $top,
         array(
           'day_date' => $row['day_date'],
         )
                    );
 
 $aktiv_date = $row['day_date'];
 }

 $row['post'] = str_replace( '<br>', '<br />', $row['post'] );

 $to_echo .= parse_template( $prow,
           array (
              'profile_link'   => $ibforums->base_url."?act=Profile&CODE=03&MID=".$row['member_id'],
              'member_name'    => $row['member_name'],
              'post_date'      => $std->get_date( $row['start_date'], 'LONG' ),
              'topic_title'    => $row['title'],
              'post'           => $parser->post_db_parse($row['post'], ($row['use_html'] AND $row['g_dohtml']) ? 1 : 0 ),
              'comments'       => $row['posts'],
              'view_all_link'  => $ibforums->base_url."?act=ST&f={$row['forum_id']}&t={$row['tid']}"
              )
           );
}

   if ($aktiv_date != 0)
   {
       $to_echo .= $bottom;
   }
echo $to_echo;

exit();

}

Nun noch die angehangende news_summary.html in den Ordner ssi_templates kopieren und die neue Newsfunktion mit ssi.php?a=newssum&show=10 aufrufen. Template nach eigenen Vorstellungen anpassen und das globale Datumsformat nach MySQL Syntax auch noch eigenen Vorlieben anpassen. :)

Share this post


Link to post

Oh supi! Ich war vor ein paar Tagen schon mal kurz davor das Thema wieder hoch zu schieben, aber dann hab ich mir gedacht: "Drängel mal nicht herum Digger und laß ihm Zeit!" ;)

Ich danke Dir schon mal. Werd es so schnell wie möglich ausprobieren und Dir dann ein Feedback geben.

Hoffentlich genehmigt mir mein Weibchen heute Abend etwas PC-Zeit... :rolleyes:

Share this post


Link to post

Hallo,

ich habe leider das Problem mit der ssi das mir angezeigt wird

No news forum assigned

Warum auch immer. Hat vielleicht einer eine Idee was ich falsch mache?

lg

Dragon

Share this post


Link to post

Vermutlich hast du die ssi.php nicht korrekt bearbeitet (Hinweise / Anleitung ist in der Datei enthalten, einfach in einem Editor öffnen).

Share this post


Link to post

sorry aber entweder bin ich blöd oder blind. Da ist nichts was mann bearbeiten könnte oder was danach aussieht. das einzigste was dort steht sind wie man die news via link aufruft oder aktive user usw. Das ist bei mir jedoch alles korekt und dennoch kommt diese meldung.

/*

+--------------------------------------------------------------------------

| Invision Power Board v<{%dyn.down.var.human.version%}>

| ========================================

| by Matthew Mecham

| © 2001 - 2009 Invision Power Services

| http://www.invisionpower.com

| ========================================

| Web: http://www.invisionboard.com

| Time: <{%dyn.down.var.time%}>

| Release: <{%dyn.down.var.md5%}>

| Email: matt@invisionpower.com

| Licence Info: http://www.invisionboard.com/?license

+---------------------------------------------------------------------------

|

| > SSI script

| > Script written by Matt Mecham

| > Date started: 29th April 2002

| > UPDATED for 2.0: 1st July 2004

| > UPDATED for 2.1: 13th Sept 2005

| > UPDATED for 3.0: 26th Feb 2009

|

+--------------------------------------------------------------------------

+--------------------------------------------------------------------------

| USAGE:

+--------------------------------------------------------------------------

Simply call this script via PHP includes, or SSI .shtml tags to generate content

on the fly, streamed into your own webpage.

+--------------------------------------------------------------------------

| To show the last 10 topics and posts in the news forums...

+--------------------------------------------------------------------------

include("http://domain.com/forums/ssi.php?a=news&show=10");

You can adjust the "show" attribute to display a different amount of topics.

+--------------------------------------------------------------------------

| To show the board statistics

+--------------------------------------------------------------------------

include("http://domain.com/forums/ssi.php?a=stats");

+--------------------------------------------------------------------------

| To show the active users stats (x Members, X Guests, etc)

+--------------------------------------------------------------------------

include("http://domain.com/forums/ssi.php?a=active");

+--------------------------------------------------------------------------

| RSS / XML Syndication..

+--------------------------------------------------------------------------

RSS: http://domain.com/forums/ssi.php?a=out&f=1,2,3,4,5&show=10&type=rss

XML: http://domain.com/forums/ssi.php?a=out&f=1,2,3,4,5&show=10&type=xml

Will show last 10 topics in reverse chronological last post date order from

all the forums in the comma separated list

*/

/**

* Main executable wrapper.

*

* Set-up and load module to run

*

* @package IP.Board

* @author Matt Mecham

* @version 3.0

*/

Share this post


Link to post

Nein nun geht es genau das war was fehlte. Jedoch steht davon aber auch nichts in der ssi drinne. Sollte IPB mal ergänzen. :)

Besten dank helga :)

lg

Dragon

Share this post


Link to post

Im Grunde steht das sowohl in der Datei (To show the last 10 topics and posts in the news forums...) als auch in der Fehlermeldung (No news forum assigned). Ich war mir nur erst unsicher, ob man das News Forum auch direkt mit der ssi.php ansteuern kann, aber das geht wohl doch nicht.

Share this post


Link to post

Hallo Helge,

gibt es mit dem ssi auch die möglichkeit aus 2 verschiedenen themen aus zu lesen . Also z.b ssi_a.php aus Neswsforum a ausliest und ssi_b.php aus Newsforum b?

Lg

Dragon

Edited by Dragon25

Share this post


Link to post

Das könnte durchaus funktionieren, wenn du die ssi.php kopierst und entsprechend anpasst (derzeit wird die Einstellung des News Forums ja aus der Einstellung im Adminbereich gezogen, das müsste man dann in der ssi.php anpassen und fest einbinden).

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×