e107help.org Q&A
0 like 0 dislike
I am a newby of about 7 hours poking around experience.

I want to write Php pages that access a separate database into an e107 managed site. and I obviously want to use the same themes

How can I do this?
e107 version Version 2.1.9
closed with the note: solved
in Other by (20 points) 1 4 5
closed by

1 Answer

0 like 0 dislike
Best answer

yes thats pretty easy... heres an example

first create a file called blank.php,  the top part & bottom of the code includes get template, it will create a page almost identical to custom pages. The portion of code that is quoted is the database code, I use a seperate customer database that paypal can update to keeps track of payments made

$ns->tablerender("Subscription Information", "");



// display customer notes

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);

// open connection
$conn = new mysqli($servername, $username, $password, $dbname);

// test  connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);

$sql = "SELECT payments FROM customers";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) 
echo "<br />";

$notes = $row["payments"]. "";
echo $payments;


  echo "No payments posted";



// include the template footer & routines




hope it helps

by (30 points) 1 5
selected by
Nice to know how to write the page to get the themes but how do I manage it from the admin console? How do you add it to the menu system?

Within the admin system I can only see how to add pages and menus and pages which you can only add html. Adding PHP there is not allowed.

403 Forbidden Access to this resource on the server is denied!

I do not see where I can add the path to a particular file I have wrtitten myself.
Ah! my problem is with .htaccess,

I could get around the issue by diabling the deny

# secure htaccess file
<Files .htaccess>
#    order allow,deny
#    deny from all

However, I very much doubt if that is the wisest way of acheiving this. As I do not want my punters having access.

Advice welcome.

You are messing static and dynamic pages.  In admin area you have static pages when can you add content. Mainly text, html and some script is allowed. 

Then you use standalone page (normal php file), where you include e107 stuff  in header and footer (. Inside it you can use your code.  And you always can look into _blank plugin, but advice above (from akamolik) is full and correct.

Or you can create plugin if you need admin area for this.  There is plugin builder for this.

Here is small example with source code how to do it (but there goal was menu not main plugin page, but it's similar). 


And you can use wrapper plugin by Moc too and include your code inside e107 via iframe. 



I use this method since it gives full power of php and other scripts, I create new pages in cpanel filemanger then create a link to them

You really cannot create php pages (or add code) from custom pages created in the admin panel, those are limited to simple html content.
Thanks that is a helpful straight forward answer to how to write custom PHP pages, Someone else has answered the other simple part which was how to make a plugin to add items to the theme menus.
Welcome to e107 Q&A, where you can ask questions and receive answers from other members of the e107 community.
974 questions
1,371 answers
2,492 users