[How To] Include PHP files into your phpBB3 Template

How-to's, little tricks, tutorials, code examples (snippets) and read-me's.

Re: [How To] Include PHP files into your phpBB3 Template

Postby shelliwood » 21 Dec 2008, 12:20

I've got a random quote php script which I want to add to the template header - I have parse php turned on in the ACP and can get plain html files with php extentions to show but it won't show the quote script.

I've added this to my template
Code: Select all
<!-- PHPINCLUDE ../../../../quotes/display.php -->

And it's still not showing tho that does show up in the source. Any ideas or suggestions what to try next?

  I got it - The directory depth didn't need to be that deep for me even tho it was added to my subsilver based style - it only needed to be ../quotes/display.php to work  
shelliwood
Borg Drone
Borg Drone
 
Posts: 10
Joined: 09 Dec 2006, 06:36
Gender: Female




phpBB Academy at StarTrekGuide
Support STG
Using PayPal Donate

Re: [How To] Include PHP files into your phpBB3 Template

Postby drankur » 05 Sep 2009, 23:49

i want to know whether including a header and sidebar using php include function in templates put loads on server very much. :scratch:
drankur
Cadet I
Cadet I
 
Posts: 13
Joined: 25 Apr 2008, 13:19
Gender: Male
phpBB Knowledge: 2

Re: [How To] Include PHP files into your phpBB3 Template

Postby amoun » 16 Nov 2009, 08:22

Ok Thanks for this topic folks: I have it sorted :)

What I have in my overall_header.php

This requires the file to be in the phpbb3 root folder.
Code: Select all
<!-- PHP --> include("test_include.php"); <!-- ENDPHP -->


To access a file in the style folder where the overall_header is; (My style name is 'pec')
Code: Select all
<!-- PHP --> include("/styles/pec/template/test_include.php"); <!-- ENDPHP -->


My phpbb3 folder is in root of my domain so to access a file so to access a file in the root of my domain
Code: Select all
<!-- PHP --> include("../test_include.php"); <!-- ENDPHP -->


Hope this helps
amoun
Crewman
Crewman
 
Posts: 1
Joined: 16 Nov 2009, 08:04
Gender: Male
phpBB Knowledge: 2

Re: [How To] Include PHP files into your phpBB3 Template

Postby lpr » 19 Apr 2011, 19:14

My style is 4poziomSEO http://demo.phpbb3styles.net/4poziomSEO i want to this php script put on my forum.

Code: Select all
    <?php
            // How Many Topics you want to display?
            $topicnumber = 5;
            // Scrolling towards up or down?
            $scroll = "up";
            // 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, 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 = p.topic_id AND
            f.forum_id = t.forum_id AND
            t.forum_id != 4 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 "<marquee id=\"recent_topics\" behavior=\"scroll\" direction=\"$scroll\" height=\"170\" scrolldelay=\"100\" scrollamount=\"2\" onMouseOver=\"document.all.recent_topics.stop()\" onMouseOut=\"document.all.recent_topics.start()\">
            <table cellpadding='3' cellSpacing='2' width='218'>";
            while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

            echo  "<tr valign='top'><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#FFCC00\"><b><a href=\"$urlPath/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\" TARGET=\"_blank\">" .
            $row["topic_title"] .
            "</a></td></font></b><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#C0C0C0\"> by: <a href=\"$urlPath/memberlist.php?mode=viewprofile&u=$row[user_id]\" TARGET=\"_blank\">" .
            $row["username"] .
            "</td><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#C0C0C0\">" .
            date('F j, Y, g:i a', $row["post_time"]) .
            "</td></tr></font>";
            }
            print "</table></marquee>";
            mysql_free_result($result);
            mysql_close($link);
            ?>


So what need to change to see this script somewere on index.php ??

Thanks in advance! :hello:
lpr
Crewman
Crewman
 
Posts: 1
Joined: 19 Apr 2011, 19:04
Gender: Male
phpBB Knowledge: 2

Previous

Return to Tutorials and How-Tos

Who is online

Users browsing this forum: Discovery Bot, Magpie Crawler and 5 guests