Jump to content

Integrar um site com forum IPB


Recommended Posts

falai cambada de bacuris aqui o script do integração de forum para site

 

Nova versão com bootstrap

 

 

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="author" content="L2-Windows">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Forum Latest Posts</title>

    <!-- Bootstrap -->
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

  <body>
	
<?php
 
    $forum_path = 'ips/'; //COLOCA AQUI A PARTA DO FORUM OU O DOMINIO
    chdir( $forum_path );
 
    define( 'IPB_THIS_SCRIPT', 'public' );
 
    require_once( $forum_path . 'initdata.php' );
    require_once( CP_DIRECTORY.'/sources/base/ipsRegistry.php' );
    require_once( CP_DIRECTORY . '/sources/base/ipsController.php' );
 
    $registry = ipsRegistry::instance();
    $registry->init();
	$account = false;
	
	$member = $registry->member()->fetchMemberData();
 
    /* Init */
    if ( ! $registry->isClassLoaded('topics') )
    {
        $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums' );
		$registry->setClass( 'topics', new $classToLoad( $registry ) );
 
		$parserToLoad = IPSLib::loadLibrary( CP_DIRECTORY . '/sources/classes/text/parser.php', 'classes_text_parser' );
		$parser = new $parserToLoad();
		$parser->set( array( 'parseArea' => 'topics',
                     'parseBBCode'    => true,
                     'parseHtml'      => false,
                     'parseEmoticons' => true )
		);
    }
    
    $topic = $registry->getClass('topics')->getTopicById( mt_rand (1, 10000) );
    $topics = $registry->getClass('topics')->getTopics( array(
		'forumId'         => 2,
		'topicType'        => 'visible',
		'getFirstPost'  => true,
		'sortField'     => 'start_date',
		'sortOrder'        => 'desc',
		'limit'         => 5
	) );
 
 
?>
<br>
<div class="container-fluid">
<div class="panel panel-primary">
<div class="panel-heading"><h3>Forum Latest Posts</h3></div>
  <div class="panel-body">
	<p>Some default panel content here. Nulla vitae elit libero, a pharetra augue. Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
<?php
	foreach( $topics as $pid => $topic )
	{
		//echo 'Title:' . $topic['title'];
		//echo 'Created by ' . $topic['starter_name'];
		//echo ' at ' . date( 'd/m/Y - H:i', $topic['start_date'] );
		

	
		echo '<table class="table table-hover">';
		echo '<tr>';
		echo '<td><article id="article-' . $topic['tid'] . '" class="forum' . $topic['forum_id'] . ' ' . $topic['author_name'] . ' ' . $topic['state'] . '"></td>';
		echo '<td style="width: 650px;"><h4><span class="glyphicon glyphicon-comment" aria-hidden="true"></span> '.$topic['title'].' <span class="badge">Views: '.$topic['views'].'</span></h4></td>';
		echo '<td><h4>' . $topic['starter_name'] . '</h4></td>';
		echo '<td><h4><span class="glyphicon glyphicon-calendar"></span> ' . date( 'd/m/Y - H:i ', $topic['start_date'] ) . '</h4></td>';
		echo '<td><a href="' . $forum_path . 'index.php?showtopic=' . $topic['topic_id'] . '" class="btn btn-primary" role="button"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>  LEIA MAIS</a> </td>';
		echo '<td></article></td>';
		echo '</tr>';
		echo '</table>';		
		
		
		
		
		//print_r($topic);
	}
?>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
  </body>
</html> 

 

 

Print:

VitXacw.png

 

Versão sem CSS

 

 

<?php

    $forum_path = 'forum/'; //COLOCA AQUI A PARTA DO FORUM OU O DOMINIO
    chdir( $forum_path );

    define( 'IPB_THIS_SCRIPT', 'public' );

    require_once( $forum_path . 'initdata.php' );
    require_once( CP_DIRECTORY.'/sources/base/ipsRegistry.php' );
    require_once( CP_DIRECTORY . '/sources/base/ipsController.php' );

    $registry = ipsRegistry::instance();
    $registry->init();
	$account = false;
	
	$member = $registry->member()->fetchMemberData();

    /* Init */
    if ( ! $registry->isClassLoaded('topics') )
    {
        $classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/topics.php", 'app_forums_classes_topics', 'forums' );
		$registry->setClass( 'topics', new $classToLoad( $registry ) );

		$parserToLoad = IPSLib::loadLibrary( CP_DIRECTORY . '/sources/classes/text/parser.php', 'classes_text_parser' );
		$parser = new $parserToLoad();
		$parser->set( array( 'parseArea' => 'topics',
                     'parseBBCode'    => true,
                     'parseHtml'      => false,
                     'parseEmoticons' => true )
		);
    }
    
    $topic = $registry->getClass('topics')->getTopicById( mt_rand (1, 10000) );
    $topics = $registry->getClass('topics')->getTopics( array(
		'forumId'         => 2,
		'topicType'        => 'visible',
		'getFirstPost'  => true,
		'sortField'     => 'start_date',
		'sortOrder'        => 'desc',
		'limit'         => 3
	) );


?>
<meta charset="UTF-8">
<?php
	foreach( $topics as $pid => $topic )
	{
		//echo 'Title:' . $topic['title'];
		//echo 'Created by ' . $topic['starter_name'];
		//echo ' at ' . date( 'd/m/Y - H:i', $topic['start_date'] );

		echo '<article id="article-' . $topic['tid'] . '" class="forum' . $topic['forum_id'] . ' ' . $topic['author_name'] . ' ' . $topic['state'] . '">';
		echo '	<header><a href="' . $forum_path . 'index.php?showtopic=' . $topic['topic_id'] . '" class="discuss">'.$topic['title'].'</a> - ' . date( 'd/m/Y', $topic['start_date'] ) . '</header>';
		echo '	<main>' . $parser->BBCodeToHtml($topic['post']) . ' <br/> ' . $topic['starter_name'] . '</main>';
		echo '</article>';
		//print_r($topic);
	}
?> 

imagem de demostração não contem CSS código limpo

n9bKliu.png?1

 

 

Crédito pelo Post: Eu mesmo

Créditos: Mur

 

BOM USO (2016)

Edited by L2-Windows
  • Like 5
Link to comment
Share on other sites


Interessante, mas pra falar a vdd eu estava procurando um forum php em si ;c

Um mundo de diversão no Lineage 2

https://www.primeworld.com.br

Discord: Em breve

Comunidade brasileira de Lineage. Interlude Remastered / High Five / Essence 

Classes remasterizadas, sistemas únicos, diversão garantida.

Link to comment
Share on other sites

Um forum de servidor de lineage comum tipo o do exilium etc.

Um mundo de diversão no Lineage 2

https://www.primeworld.com.br

Discord: Em breve

Comunidade brasileira de Lineage. Interlude Remastered / High Five / Essence 

Classes remasterizadas, sistemas únicos, diversão garantida.

Link to comment
Share on other sites

  • 1 year later...
  • 7 months later...



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.