forums menu

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
alexdudek
Registered User
Posts: 1
Joined: Sat Sep 29, 2018 8:35 am

forums menu

Post by alexdudek » Sat Sep 29, 2018 8:45 am

forums menu's is not found in forums page,...

i had included the php code between <!--PHP--> <!--ENDPHP-->

below is the code,..

Code: Select all

$is_https = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on';
$http_protocol = $is_https ? 'https' : 'http';
$base_root = $http_protocol . '://' . $_SERVER['HTTP_HOST'];
$url = $base_root.'/menucontents?mainmenu_type=forums_mainmenu';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
forums_data = curl_exec($ch);
curl_close($ch);
$forums_content = json_decode($forums_data,true);

i retrieve the details from server,...my doubt is how to include this code in overall_header.html

i need the solution

User avatar
Ger
Recognised Extension Developer
Posts: 1771
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: forums menu

Post by Ger » Mon Oct 01, 2018 10:17 am

If you want to do this in your template, you should go to the ACP -> General -> Security settings and set the option "Allow php in templates:" to Yes.

However, this is not recommended and IIRC this won't be possible in phpBB 3.3 and above. You'd better add the code to ./includes/functions.php in the page_header() function and assign a template variable you can then include in your template. Or simply build a small extension to do so.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:
-Available for custom work-

Post Reply

Return to “phpBB Custom Coding”

Who is online

Users browsing this forum: No registered users and 7 guests