A lot of database-related questions from a complete newbie

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Rogerjwilkinson
Registered User
Posts: 33
Joined: Wed Jan 17, 2018 2:42 pm

A lot of database-related questions from a complete newbie

Post by Rogerjwilkinson » Wed Jan 17, 2018 3:02 pm

Hi all! Very new to well, everything.

After almost a week of all-nighters and slugging things around I've managed to get my website fully integrated with phpbb sessions, front page news served from the forum and even going so far as to use the sessions as protection on my video files served up from outside root via php (so if anyone tries to hotlink my videos they'll be redirected to my forum registration page ^_^)

So far I'm very VERY happy with all of this, even though I can't for the life of me figure out how to "serve up" pages properly, and had to use the "SQL table" method.

Here's my question - and I'm very sorry if all of this is in the wrong section please just move this - my next step was to attempt using the forums as a "comment section" on most/all my pages, just to avoid bringing in any other 3rd party scripts. The idea "seems easy" to me for the mostpart, create a hidden forum that can't be seen by anyone on the forum index page, then create a topic for each and every page I'd want a comment section for in that forum, allow the topics to be read to the external page, and jury-rig one of the external post code snippets on each page.

However when I was researching about doing this, I read that this might be way too unrealistic for phpbb, and an alternative solution would probalby me more preferable? Would the database or whatever it is eventually be able to handle this many topics created? And what about loading the index.php of the forums? If that forum is publicly hidden to all people, does going to the forum index still "read those topics" from the database and cause the strain/slow down? I guess finally, can forum topics/forums even be interacted with in the way I'm talking aobut when hidden from a groups view? As in can they still have read/post privileges if served up through another way as discussed?

Thank you so much for taking the time to read this and I hope the wall of text wasn't too unbearable. I suck at being consise I'm sorry.

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 49325
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: A lot of database-related questions from a complete newbie

Post by stevemaury » Wed Jan 17, 2018 3:58 pm

How many topics? Some of the forums here have 400,000+ topics.

In general, what you are asking is custom coding advice, which is beyond the scope of this forum. I will move this post to the Custom coding forum. BUT - why do the topics have to be hidden and why can you not include a link to each comment topic for whatever you want commented on in that page's content?
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. PM or email me.

All unsolicited PMs will be ignored.

Rogerjwilkinson
Registered User
Posts: 33
Joined: Wed Jan 17, 2018 2:42 pm

Re: A lot of database-related questions from a complete newbie

Post by Rogerjwilkinson » Wed Jan 17, 2018 4:24 pm

thanks for clearing up the double post.

My main reasoning was to just keep the comments section hidden from anything except the pages they appear on. My other reasoning for not just wanting to direct-link to the thread was to avoid having to refresh the page upon comment, but upon doing some further research it turns this might not be a possibility in phpbb in general - At least, from what I understand the best I'd probably get is a situation where users are spamming posts over and over into the comments section because it isn't showing to them dynamically.

An "iframe" I understand it, could potentially be a very good solution, but I think they're frowned upon here, and I wouldn't have a CLUE where to begin. Still, now that this is in the "custom codE" section, if anyone could perhaps point me in the right direction at least I'd be VERY grateful - as it stands I'm feeling "forced" to have to go with a 3rd party ajax-compatible (I think?) script, and although I had my hearts set on 100% phpbb integration, I think I've hit my skill cap here.

Also, now that this is in the custom code section, if somebody could help me with this I'd be very happy. As I mentioned earlier, I couldn't figure out how to "include a page" properly as per the phpbb documentation, no amtter what I tried, so I settled for this snippet of code I found:

Code: Select all

<?php
    // How Many Topics you want to display?
    $topicnumber = 10;
    // Change this to your phpBB path
    $urlPath = "./path/to/forum";
 
    // Database Configuration (Where your phpBB config.php file is located)
    include './path/to/forum/config.php';
 
    $table_topics = $table_prefix. "topics";
    $table_forums = $table_prefix. "forums";
    $table_posts = $table_prefix. "posts";
    $table_users = $table_prefix. "users";
    $link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
    mysql_select_db("$dbname") or die("Could not select database");
 
    $query = "SELECT t.topic_id, p.post_text, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
    FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
    WHERE t.topic_id = 7 AND
    f.forum_id = t.forum_id AND
    t.forum_id = 11 AND
    t.topic_status <> 2 AND
    p.post_id = t.topic_last_post_id AND
    p.poster_id = u.user_id
    ORDER BY p.post_id DESC LIMIT $topicnumber";
    $result = mysql_query($query) or die("Query failed");									
 
    print '<div class="news_block">';
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

 
    echo  "<h4><a href=\"$urlPath/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\" TARGET=\"\">" .
    $row["topic_title"] .
    "</a> </h4>By:<a href=\"$urlPath/memberlist.php?mode=viewprofile&u=$row[user_id]\" TARGET=\"\">" .
    $row["username"] . ' - ' . date("l", $row["post_time"]) .
    "<p>" .
    $row["post_text"] . // <----- 
    "</p>";
    }
    print "</div>";
    mysql_free_result($result);
    mysql_close($link);
   
   /* date("l", $row["post_time"]) .  date('F j, Y, g:i a', $row["post_time"]) .*/
    ?>
How on earth do I get the hyperlink for the user id - the "<a href=\"$urlPath/memberlist.php?mode=viewprofile&u=$row[user_id]\" TARGET=\"\">"" to stop at the end of the username, instead of take up the entire message and not break the rest of the script. I've tried putting a </a> (which with my limited knowledge I assume is the issue?) I think literally everywhere at this point, and all it does is break the code. I've even tried mimicking the line above as perfect as I could to no avail. Assuming I give up on the phpbb comments section idea, this is about the last thing I think I'll need to have my front page integration "perfect".

User avatar
posey
Registered User
Posts: 706
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: A lot of database-related questions from a complete newbie

Post by posey » Wed Jan 17, 2018 5:31 pm

This might be 'too late in the day', but have you seen the [CDB] phpBB Extension - Pages ?
From what you wrote, this extension does a lot of what you accomplished thusfar and probably (no offense) in a better way.

And I wouldn't create topics or anything like that for your comments, but create a table with the 'comments' linked to the page id's.
''I'm pretty sure there's a lot more to life than being really, really, ridiculously good looking. And I plan on finding out what that is.''

Rogerjwilkinson
Registered User
Posts: 33
Joined: Wed Jan 17, 2018 2:42 pm

Re: A lot of database-related questions from a complete newbie

Post by Rogerjwilkinson » Wed Jan 17, 2018 5:42 pm

By the time I found that as an option, it was at the point where the entire skeleton of my website was in place and the forums were the "afterthought addition"... I have strongly considered, multiple times, going back and doing it that route, however, it simply can not will not happen at this point :lol: I'm so close to everything pretty much the way I want it. It's seeming like there won't be an issue with number of topics to use it as a comments section, so I'm strongly considering going the iframe route. I've spent the last few hours fiddling with them, and combined with CSS3 they're actually very powerful. I think with a combination of webkit-transforms and frame crops, iFrames will be PERFECT for this *fingers crossed* If I "get it" I'll paste back the code here, but I'm pretty-much just winging it with the CSS.

In the meantime, if perhaps there's anybody out there that could solve that little puzzle up above closing the hyperlink for "go to profile" at the end of "$row["username"] ." in the above code, I would be stoked!

User avatar
posey
Registered User
Posts: 706
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: A lot of database-related questions from a complete newbie

Post by posey » Wed Jan 17, 2018 5:49 pm

Code: Select all

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

    $post_url   = $urlPath . '/viewtopic.php?f=' . $row['forum_id'] . '&t=' . $row['topic_id'] . '&p=' . $row['post_id'] . '#p' . $row['post_id'];
    $user_url   = $urlPath . '/memberlist.php?mode=viewprofile&u=' . $row['user_id'];
 
    echo '<h4><a href="' . $post_url . '" target="self">' . $row['topic_title'] . '</a></h4>
            By: <a href="' . $user_url . '" target="self">' . $row['username'] . '</a> &raquo; ' . data('l', $row['post_time']) . 
            '<p>' . $row['post_text'] . '</p>';

}
Do note that iFrames can be very dangerous if used incorrectly. So make sure to read up on that.

Also: https://wiki.phpbb.com/Tutorial.Adding_pages this might help you out aswell.
''I'm pretty sure there's a lot more to life than being really, really, ridiculously good looking. And I plan on finding out what that is.''

Rogerjwilkinson
Registered User
Posts: 33
Joined: Wed Jan 17, 2018 2:42 pm

Re: A lot of database-related questions from a complete newbie

Post by Rogerjwilkinson » Wed Jan 17, 2018 6:40 pm

thank you very much for taking the time to look over that, I'll also be sure to look into iframes further before committing to them. I've tinkered with stripping the header and footer off the page with javascript and delivering it to a stylized iframe that way, but I got a bit more playing around to do before I could use it. Not to mention, I think I'm going about it backwards. Surely there must be a way to source the contents of the topics more directly for an include rather than including everyhting and stripping it away.

I had seen that tutorial before, honestly it all goes way over my head on how I'd use that for my purpose in anyway. I did however use that exact page to get set up with the integrated sessions to begin with, and to put the forum redirect on my video files.

I've stumbled across some from old archived code that makes me want to come back to doing it my "original way". This way creates an external post-to-topic page script and serves it up with an embedded <form>, so I'd do my "Add to comments" button that way, and serve the comments with the above code^ from a hidden forum. The code I found was from here viewtopic.php?f=72&t=2097869 My first fiddle with it, and it just spam created a bunch of topics named "Whats on my mind" so uhh, yeah, that'll take me a while to get my head around :lol:

Rogerjwilkinson
Registered User
Posts: 33
Joined: Wed Jan 17, 2018 2:42 pm

Re: A lot of database-related questions from a complete newbie

Post by Rogerjwilkinson » Thu Jan 18, 2018 10:11 am

Okay I've spent all day and all night on thsi again. I'm very very close now I believe. I ditched the iframe method (like you said, insecure and it just looked ugly, no matter how many jquery and css I threw at it).

I've decided to go with the original plan. I've FINALLY got my submit post button working externally (that took me some 10 hours STRAIGHT, to give an idea of how slow I am), but I am very very happy with it for the most-part. I'm just about ready to do the last finishing touches (mess around with redirect rules and see what I can get to happen), however I need just a little more help with one more aspect of the SQL querying, and I'll be ready to post the entire code for anyone running into this issue in the future, I saw A LOT of unsolved topics on the matter searching all of this.

And I'm especially frustrated with myself for this one because I'm quite confident I had this working as intended before I did the submit post external part, lost the changed code I had, and now can't for the life of me figure it out again. :( So PLEASE forgive me if this seems really obvious, I probably need to take a break, but here goes.

How do I make

Code: Select all

				<?php
				// How Many Topics you want to display?
				$topicnumber = 10;
				// Change this to your phpBB path
				$urlPath = "./forum";
			 
				// Database Configuration (Where your phpBB config.php file is located)
				include './forum/config.php';
			 
				$table_topics = $table_prefix. "topics";
				$table_forums = $table_prefix. "forums";
				$table_posts = $table_prefix. "posts";
				$table_users = $table_prefix. "users";
				$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
				mysql_select_db("$dbname") or die("Could not select database");
			 
				$query = "SELECT t.topic_id, p.post_text, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
				FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
				WHERE t.topic_id = 7 AND
				f.forum_id = t.forum_id AND
				t.forum_id = 11 AND
				t.topic_status <> 2 AND
				p.post_id = t.topic_last_post_id AND
				p.poster_id = u.user_id
				ORDER BY p.post_id DESC LIMIT $topicnumber";
				$result = mysql_query($query) or die("Query failed");									
			 
				print '<div class="news_block">';
				while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

			 
				echo  "<h4><a href=\"$urlPath/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\" TARGET=\"\">" .
				$row["topic_title"] .
				"</a> </h4>By: " .
				$row["username"] . ' - ' . date("l", $row["post_time"]) .
				"<p>" .
				$row["post_text"] . // <----- 
				"</p>";
				}
				print "</div>";
				mysql_free_result($result);
				mysql_close($link);
			   
				/* date("l", $row["post_time"]) .  date('F j, Y, g:i a', $row["post_time"]) .*/
				?>	
Print all the replies for the topic (in this case t.topic_id 7), instead of just the latest reply? I KNOW I had it, I'm sure it was as simple as replacing one of the WHERE variables, but any adjustment I seem to make just breaks it.

Thanks so much in advance to anyone who can help me out.


edit: I think I've narrowed it down to needed to change p.post_id to something else? But I can't imagine what, basic integers seem to have no effect and matching it to any other variable has no luck for me either

User avatar
posey
Registered User
Posts: 706
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: A lot of database-related questions from a complete newbie

Post by posey » Thu Jan 18, 2018 1:32 pm

Code: Select all

<?php
// The topic you want to show the posts from?
$topic_id = 7;

// Change this to your phpBB path
$urlPath = './forum';

// Database Configuration (Where your phpBB config.php file is located)
include './forum/config.php';

$table_topics = $table_prefix . 'topics';
$table_posts = $table_prefix . 'posts';
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");

$sql = 'SELECT t.topic_title, p.topic_id, p.forum_id, p.post_id, p.post_text, p.post_time
		FROM ' . $table_topics . ' t, ' . $table_posts . ' p
		WHERE t.topic_id = p.topic_id
			AND t.topic_status <> 2
			AND p.topic_id = ' . (int) $topic_id . '
		ORDER BY p.post_time ASC';
$result = mysql_query($sql) or die("Query failed");									

print '<div class="news_block">';

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
	$post_url = $urlPath . "/viewtopic.php?f={$row['forum_id']}&t={$row['topic_id']}&p={$row['post_id']}#p{$row[post_id]}";
	
	echo  '<h4><a href="$post_url" target="self">' . $row['post_subject'] . '</a></h4>
	By: ' .	$row['post_username'] . ' &raquo; ' . date('l', $row['post_time']) .
	'<p>' .	$row["post_text"] . '</p>';
}

print '</div>';
mysql_free_result($result);
mysql_close($link);

/* date("l", $row["post_time"]) .  date('F j, Y, g:i a', $row["post_time"]) .*/
?>	
Perhaps this does what you want.
''I'm pretty sure there's a lot more to life than being really, really, ridiculously good looking. And I plan on finding out what that is.''

Rogerjwilkinson
Registered User
Posts: 33
Joined: Wed Jan 17, 2018 2:42 pm

Re: A lot of database-related questions from a complete newbie

Post by Rogerjwilkinson » Thu Jan 18, 2018 2:06 pm

Excellent mate thanks for that. It has a few minor issues (no where to specify forum_id there, the hyperlinking scheme doesn't seem to work, and I can't get username to show at all) but it is still definitely the missing puzzle I'm after, it is posting just the replies from the specified topic. ^_^ I'll splice the two codes together and finally get to move forward. Thank you thank you thank you!

Edit: GOT IT. Thank you so much.

User avatar
posey
Registered User
Posts: 706
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: A lot of database-related questions from a complete newbie

Post by posey » Thu Jan 18, 2018 2:56 pm

Ah, my bad. I thought post_username contained the username of the poster, turns out it doens't ( :| ).
And you don't need to specify the forum id anywhere. It's in the row already from the POSTS table.
And as far as I could tell from your code, you don't need it for anything else apart from the url's.

About the URL's, that's up to you to figure out as I don't know how you're doing it in the first place.
Usually one should use the append_sid() function from phpBB to preserve the session ID & the $phpbb_root_path, but you're not using that in the first place, so I am not too sure on how you want to go about URLs. That's one for you ;-).

Code: Select all

<?php
// The topic you want to show the posts from?
$topic_id = 7;

// Change this to your phpBB path
$urlPath = './forum';

// Database Configuration (Where your phpBB config.php file is located)
include './forum/config.php';

$table_topics = $table_prefix . 'topics';
$table_users = $table_prefix . 'users';
$table_posts = $table_prefix . 'posts';
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");

$sql = 'SELECT t.topic_title, p.topic_id, p.forum_id, p.post_id, p.post_text, p.post_time, u.username
		FROM ' . $table_topics . ' t, ' . $table_posts . ' p, ' . $table_users . ' u
		WHERE t.topic_id = p.topic_id
			AND t.topic_status <> 2
			AND p.poster_id = u.user_id
			AND p.topic_id = ' . (int) $topic_id . '
		ORDER BY p.post_time ASC';
$result = mysql_query($sql) or die("Query failed");									

print '<div class="news_block">';

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
	$post_url = $urlPath . "/viewtopic.php?f={$row['forum_id']}&t={$row['topic_id']}&p={$row['post_id']}#p{$row[post_id]}";
	
	echo  '<h4><a href="$post_url" target="self">' . $row['post_subject'] . '</a></h4>
	By: ' .	$row['username'] . ' &raquo; ' . date('l', $row['post_time']) .
	'<p>' .	$row["post_text"] . '</p>';
}

print '</div>';
mysql_free_result($result);
mysql_close($link);

/* date("l", $row["post_time"]) .  date('F j, Y, g:i a', $row["post_time"]) .*/
?>	
''I'm pretty sure there's a lot more to life than being really, really, ridiculously good looking. And I plan on finding out what that is.''

Rogerjwilkinson
Registered User
Posts: 33
Joined: Wed Jan 17, 2018 2:42 pm

Re: A lot of database-related questions from a complete newbie

Post by Rogerjwilkinson » Thu Jan 18, 2018 3:51 pm

Hehe no worries mate, I ended up getting them ^_^ I just had to sit down and go through the syntax very verrrry careful, I was missing a close " on the closing </a> tag as well as failing to put a . at the start and end. As soon as I did these things, the hyperlinks started behaving correctly.

Good tip about the forum ID, cheers for that, once less line to edit each page. ^^

Now I am really going to push my luck.

Do you have any idea how you go about manipulating bbcode and smilies on this style of output? (or, better yet, disabling it altogether would work for me).

I have played around with all manner of inclusion and exclusion of

Code: Select all

include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/message_parser.' . $phpEx);
generate_smilies('inline', false); 
display_custom_bbcodes();
in my header, the inclusion or exclusion of really doesn't seem to change much. I stumbled across something in the "normal" way of outputting content externally

Code: Select all

$post_text = generate_text_for_display( $posts_row[ 'post_text' ], $posts_row[ 'bbcode_uid' ], $posts_row[ 'bbcode_bitfield' ], 7 );
and so I tried just including it into the code above, directly below "$table_posts = $table_prefix . 'posts';", very very surprisingly it didn't break anything, but it didn't fix anything either. I assume I need to somehow adapt this part of the same page I found

Code: Select all

'POST_TEXT' => censor_text( $post_text );


But I'm just at a loss at this point. I imagine I'm starting to get into pretty weird sides of things now so I understand if your take on it would be "don't bother". ^^

For what it's worth, in it's current state, the way it's working (regardless of any of the above changes) is smilies just show in text form, and bbcode does work, however it shows the tags (so ({i}* and {/i}, and the start tag of each (so {b} as an example), has a like strike through it.... Very strange. :lol:

User avatar
posey
Registered User
Posts: 706
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

Re: A lot of database-related questions from a complete newbie

Post by posey » Thu Jan 18, 2018 4:04 pm

WIKI: Generate text for display: https://wiki.phpbb.com/Function.generat ... or_display

Set the BBCode options in the top of the file for your posts, this will be used for all posts you get from this file.
It's harded coded but I believe you want that anyway, so it should be fine.
Add the bbcode_bitfield and bbcode_uid in your SQL SELECT as below and it should be fine.

Make sure to include /includes/functions_content.php file.

Code: Select all

<?php
// The topic you want to show the posts from?
$topic_id = 7;

/* 
Parse BBCodes: 1
Parse Smilies: 2
Parse URLs: 4
Adding these constants together will result in all three options being enabled. */
$bbcode_options = 4;

// Change this to your phpBB path
$urlPath = './forum';

// Database Configuration (Where your phpBB config.php file is located)
include './forum/config.php';

$table_topics = $table_prefix . 'topics';
$table_users = $table_prefix . 'users';
$table_posts = $table_prefix . 'posts';
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");

$sql = 'SELECT t.topic_title, p.topic_id, p.forum_id, p.post_id, p.post_text, p.post_time, p.bbcode_bitfield, p.bbcode_uid, u.username
		FROM ' . $table_topics . ' t, ' . $table_posts . ' p, ' . $table_users . ' u
		WHERE t.topic_id = p.topic_id
			AND t.topic_status <> 2
			AND p.poster_id = u.user_id
			AND p.topic_id = ' . (int) $topic_id . '
		ORDER BY p.post_time ASC';
$result = mysql_query($sql) or die("Query failed");									

print '<div class="news_block">';

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
	$post_url = $urlPath . "/viewtopic.php?f={$row['forum_id']}&t={$row['topic_id']}&p={$row['post_id']}#p{$row[post_id]}";
	$post_text = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $bbcode_options)
	
	echo  '<h4><a href="$post_url" target="self">' . $row['post_subject'] . '</a></h4>
	By: ' .	$row['username'] . ' &raquo; ' . date('l', $row['post_time']) .
	'<p>' .	$post_text . '</p>';
}

print '</div>';
mysql_free_result($result);
mysql_close($link);

/* date("l", $row["post_time"]) .  date('F j, Y, g:i a', $row["post_time"]) .*/
?>	
''I'm pretty sure there's a lot more to life than being really, really, ridiculously good looking. And I plan on finding out what that is.''

Rogerjwilkinson
Registered User
Posts: 33
Joined: Wed Jan 17, 2018 2:42 pm

Re: A lot of database-related questions from a complete newbie

Post by Rogerjwilkinson » Thu Jan 18, 2018 4:55 pm

Hmmm. Once again, and I really do mean this, thank you so much for your time. If you have a place where I can throw a cup of coffee's worth your way please let me know.

So, including functions_content anywhere gives me a blank white page (php error I believe I've read?) I did some googling and searched these forums for "functions_content" "white screen" and didn't find anything. I tried to insert it at first to my index with " include( $phpbb_root_path . 'includes/functions_content.' . $phpEx );" and when that blanked the whole site, tried including it every which way to my comments page, and same thing, just blanks it.

However on the bright side maybe -I was able to add all the query parts relating to bitfield, uid, and generate_text below, and after some tiny syntax fixes I was able to get all of that included with no errors, but it made no change at all, safe to assume this is because functions/content isn't included, or do I perhaps need to "echo" in or further define bbcode_options? Naturally I tried at first with the specified 4 (expecting nothing to happen), then 3, 1, 2, and 7, none of these values seemed to have any effect. If I understand it right

Code: Select all

$row['bbcode_uid'], $row['bbcode_bitfield']
Is essentially applying bbcode to everything sent to $row, and with bbcode_options defined previously as well.... it's really looking like this functions/content error :(

Rogerjwilkinson
Registered User
Posts: 33
Joined: Wed Jan 17, 2018 2:42 pm

Re: A lot of database-related questions from a complete newbie

Post by Rogerjwilkinson » Fri Jan 19, 2018 5:23 am

Alrighty, it took me a long time how to figure out logs, but finally got errors reporting.

"Fatal error: Cannot redeclare class bitfield in /forum/includes/functions_content.php on line 1671"

So I tried going through every header one by one, as far as I can tell, functions_content.php (or at least the bitfield part of it) is previously declared in common.php. I tried changing all instances of common to viewforum (which would not be ideal anyway but just for debugging), and same issue, functions_content clashes with viewforum as well. So at least I was barking up the right tree with google. Does this mean functions_content shouldn't actually be required, or it is the source of my issue? For reference here are my headers

Code: Select all

<?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);
	include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
	include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
	include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
	include($phpbb_root_path . 'includes/functions_user.' . $phpEx );

   // Start session management
   $user->session_begin();
   $auth->acl($user->data);
   $user->setup('common');
?>
and then this is used to restrict access to content where I want

Code: Select all

<?php
if(!$user->data['is_registered'])
{
    if ($user->data['user_id'] != ANONYMOUS)
    {
        trigger_error('NOT_AUTHORISED');
    }

    login_box('', $user->lang['NOT_AUTHORISED']);
?>

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: No registered users and 17 guests