BBCode issue with tutorial: "Displaying posts and topics on external pages"

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
Post Reply
Dwarf Androx
Registered User
Posts: 3
Joined: Thu Dec 27, 2018 11:34 pm

BBCode issue with tutorial: "Displaying posts and topics on external pages"

Post by Dwarf Androx »

I love this tutorial written by battye very much and still use it to post recent updates on the index page of my website, by displaying the last 5 posts in a specific topic. In phpBB 3.1 it worked still fine. With the migration from phpBB 3.1 to 3.2 however, I had to upgrade my webspace from PHP 5.3 to 5.5, and now any displayed bbcode tag like this one

Code: Select all

[url=http://www.domain.com/]linktext[/url]
only produces this:

Code: Select all

<URL url="http://www.domain.com/"><s>[url=http://www.domain.com/]</s>linktext<e>[/url]</e></URL>
Within the forum itself, links and any other bbcode are still working as intended.

I could provide the full code, but it's heavily based on the tutorial above and for convenience I'll just post the part which, to my knowledge, handles the text of the posting and produces the problem:

Code: Select all

        $post_text = nl2br($posts_row['post_text']);
        // I only want the first paragraph of each posting displayed, so I'm cutting it a little:
	$post_text_array = explode("<br />",$post_text);
	$post_text = $post_text_array[0];

	// I had to include the line below because of this: [phpBB Debug] PHP Notice: in file [...] on line 317: Undefined variable: bbcode_bitfield
	$bbcode_bitfield=0; 
	$bbcode = new bbcode(base64_encode($bbcode_bitfield));
        $bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']);
	$post_text = smiley_text($post_text);
	
	//instead of using the suggested template block, I'll just post a customized list topic
	echo "<li><b>".date('Y-m-d',$posts_row['post_time'])."</b> -- ".$post_text." (<a href=\"".$post_link."\">read more</a>)</li>\n";
This should produce (and has done so, until the most recent update) something like this:
2018-12-28 -- Having issues with the <a href="www.domain.com/forum">message board</a> (<a href="www.domain.com/forum/linktotopic">read more</a>)

Besides, I'm still having an issue within the ACP customization tag, as adressed in this topic, but I don't know if there could be a connection. Does someone have an idea?
Post Reply

Return to “phpBB Custom Coding”