my php recent

Say hello, ask a question or make a comment.
Post Reply
User avatar
clight77
Moderator
Posts: 21
Joined: Wed Apr 04, 2018 7:39 pm

my php recent

Code: Select all

<?php

    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);
	
	   
	  
    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup('');

    page_header('Recent');

    $template->set_filenames(array(
        'body' => 'recent.html',
  ));

 
	
$urlPath = "../";
        include 'config.php';

        $table_topics = $table_prefix. "topics";
        $table_forums = $table_prefix. "forums";
        $table_posts = $table_prefix. "posts";
        $table_users = $table_prefix. "users";
        $link = mysqli_connect("$dbhost", "$dbuser", "$dbpasswd", "$dbname") or die("Could not connect");
        
        $query = "SELECT t.topic_id, t.topic_title, t.topic_first_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, p.post_text,u.username
        FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
        WHERE t.topic_id = p.topic_id AND
        f.forum_id = t.forum_id AND
		f.forum_id <> '8' AND 
        p.post_id = t.topic_first_post_id AND
        p.poster_id = u.user_id
        ORDER BY p.post_id DESC LIMIT 70";
        $result = mysqli_query($link, $query) or die("Query failed");                           
		$num=mysqli_num_rows($result);
		
	if ($num == "0") { echo "<li>There are currently no related topics in our forums. <a href='{{ ROOT_PATH }}'>Post a new forum topic now</a>.</li>"; }
		else {
		
			$num=0;
        	print "<h4>";


        	while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        		$posttext = substr(strip_tags($row['username' ]), 0, 15);
				
	echo  "<b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"/viewtopic.php?t=$row[topic_id]\">" .
        			$row["topic_title"] . "</a><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . " Posted by - " . $posttext . "<br /><br />";
					$num++;
        	}
		}
        print "</h4>";
        mysqli_free_result($result);
        mysqli_close($link); 

		
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
	
?>

User avatar
Sniper_E Styles
Site Admin
Posts: 103
Joined: Sat Mar 24, 2018 10:52 pm
Location: Louisiana

Re: my php recent

Got the time format in there from the info your link provided.

Code: Select all

<?php

	define('IN_PHPBB', true);
	$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
	$phpEx = substr(strrchr(__FILE__, '.'), 1);
	include($phpbb_root_path . 'common.' . $phpEx);

	// Start session management
	$user->session_begin();
	$auth->acl($user->data);
	$user->setup('');
 
		$urlPath = "../";
		include 'config.php';

		$table_topics = $table_prefix. "topics";
		$table_forums = $table_prefix. "forums";
		$table_posts = $table_prefix. "posts";
		$table_users = $table_prefix. "users";
		$link = mysqli_connect("$dbhost", "$dbuser", "$dbpasswd", "$dbname") or die("Could not connect");

		$query = "SELECT t.topic_id, t.topic_title, t.topic_first_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, p.post_text,u.username
		FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
		WHERE t.topic_id = p.topic_id AND
		f.forum_id = t.forum_id AND
		f.forum_id <> '8' AND 
		p.post_id = t.topic_first_post_id AND
		p.poster_id = u.user_id
		ORDER BY p.post_id DESC LIMIT 70";
		$result = mysqli_query($link, $query) or die("Query failed");                           
		$num=mysqli_num_rows($result);

		if ($num == "0") { echo "<li>There are currently no related topics in our forums. <a href='{{ ROOT_PATH }}'>Post a new forum topic now</a>.</li>"; }
		else {

			$num=0;
			print "<h4 style=\"margin-top: -10px\">";

			while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
				$posttext = substr(strip_tags($row['username' ]), 0, 15);
				$posttime = $user->format_date($row['post_time']);
				
			echo  "<div style=\"display: inline-block;width: 48%;min-width: 300px;float: left;margin: 0 10px 10px 0\"><b><a href=\"/viewtopic.php?t=$row[topic_id]\" target=\"blank\" style=\"text-decoration: none\">" .
			$row["topic_title"] . "</a></b> <br /><i>by " . $posttext . "</i> <small style=\"color: #555\">on " . $posttime . "</small></div>";
			$num++;
			}
		}

		print "</h4>";
		mysqli_free_result($result);
		mysqli_close($link); 

?>
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!™

User avatar
clight77
Moderator
Posts: 21
Joined: Wed Apr 04, 2018 7:39 pm

Re: my php recent

Thx Ed works pretty good :) Now I have that weird BG I can't seem to get rid of.

https://www.nzbforyou.com/recent-topics

User avatar
Sniper_E Styles
Site Admin
Posts: 103
Joined: Sat Mar 24, 2018 10:52 pm
Location: Louisiana

Re: my php recent

The page is created with or uses the phpbb/pages/styles/prosilver/template/pages_default.html

Code: Select all

{# Use the space below to include external CSS and JS files
# Here are some example usages:
#
# local files relative to this template file (when stored inside phpBB's style directories):
# {% INCLUDEJS 'script.js' %}
# {% INCLUDECSS 'style.css' %}
#
# local files stored inside the Pages extension:
# {% INCLUDEJS '@phpbb_pages/script.js' %}
# {% INCLUDECSS '@phpbb_pages/style.cs's %}
#
# hosted on external sites:
# {% INCLUDEJS 'http://code.jquery.com/jquery-migrate-1.2.1.min.js' %}
# {% INCLUDECSS 'https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css' %}
#
#}

{% INCLUDECSS '@phpbb_pages/pages_controller.css' %}
{% include 'overall_header.html' %}

<div class="panel">
	<div class="inner">
		<h2 class="pages-title">{{ PAGE_TITLE }}</h2>
		<div class="content pages-content">
			{{ PAGE_CONTENT }}
		</div>
		{% EVENT phpbb_pages_after_page_content %}
	</div>
</div>

{% include 'overall_footer.html' %}
It uses panel class in the div. Does your style's .panel css have that bg image in it?
You can also add what css you want to load in this template. But that want put the css in the iframe.

Try using the blank template in the pages setup. acp
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!™

User avatar
clight77
Moderator
Posts: 21
Joined: Wed Apr 04, 2018 7:39 pm

Re: my php recent

Went back to 1 column looks better a bit now :)

Hey thanks for all the work on this, really appreciate it my man :)

User avatar
clight77
Moderator
Posts: 21
Joined: Wed Apr 04, 2018 7:39 pm

Re: my php recent

Newest

Code: Select all

<?php

	define('IN_PHPBB', true);
	$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
	$phpEx = substr(strrchr(__FILE__, '.'), 1);
	include($phpbb_root_path . 'common.' . $phpEx);

	// Start session management
	$user->session_begin();
	$auth->acl($user->data);
	$user->setup('');
 


		$table_topics = $table_prefix. "topics";
		$table_forums = $table_prefix. "forums";
		$table_posts = $table_prefix. "posts";
		$table_users = $table_prefix. "users";
		$link = mysqli_connect("$dbhost", "$dbuser", "$dbpasswd", "$dbname") or die("Could not connect");

		$query = "SELECT t.topic_id, t.topic_title, t.topic_first_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, p.post_text, u.username, u.user_colour
		FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
		WHERE t.topic_id = p.topic_id AND
		f.forum_id = t.forum_id AND
		f.forum_id <> '8' AND 
		p.post_id = t.topic_first_post_id AND
		p.poster_id = u.user_id
		ORDER BY p.post_id DESC LIMIT 100";
		$result = mysqli_query($link, $query) or die("Query failed");                           
		$num=mysqli_num_rows($result);

		if ($num == "0") { echo "<li>There are currently no related topics in our forums. <a href='{{ ROOT_PATH }}'>Post a new forum topic now</a>.</li>"; }
		else {

			$num=0;
			print "<h4 style=\"margin-top: -10px\">";

			while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
	
			$posttime = $user->format_date($row['post_time']);			
            $postauthor = get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour']);
 

			echo  "<div style=\><a href=\"/viewtopic.php?t=$row[topic_id]\" target=\"blank\" style=\"text-decoration: none\">" .
			$row["topic_title"] . "</a><br /><i>&nbsp;by " . $postauthor. "</i><small style=\"color: #FFFFFF\">   -  "  . $posttime . "</small></div><br />";
			$num++;
			}
		}

		print "</h4>";
		mysqli_free_result($result);
		mysqli_close($link);  
		


    $template->set_filenames(array(
        'body' => 'recent.html',
  ));

page_footer();
	
?>

Post Reply