New Custom Page with Php the Correct Way

Temporary forum to obtain support for MODs/Styles while phpbb.com is down
Locked
WinterWulf
Registered User
Posts: 14
Joined: Wed Feb 04, 2009 6:35 pm
Location: North Pole

New Custom Page with Php the Correct Way

Post by WinterWulf »

Hello everyone, this is my first post here so I hope I am doing this correctly;

I want to make 20-50+ new custom pages for my phpbb3 set up. I have been using the http://www.phpbb.com tutorial catched at

http://74.125.47.132/search?q=cache:Or- ... cd=1&gl=us

also visable at

http://www.ktuk.net/phpBB3/viewtopic.php?f=32&t=2854

( and anywhere else with a tutorial for this sort of thing - they are all the same! ).

On these custom pages I would like to run database searchs and post the info found. For instance, one page might look like:

Code: Select all

Welcom $username!
We are very $emotion to see you! We hope you will come by again when you have more $money#. At the moment you only have $money#. Sorry. But here: take this tasty $snack.
Placeing the php in the actual .php file that the URL refers to causes the page to load strangely (you see all the text unformated, without color or images and then it *pops* back to normal) and any information you tell it to print gets posted at the very top of the page, regardless of where you place the text. After a good bit of trial, error and searching I have found

viewtopic.php?f=26&t=12672

which possibly solves the problem. But now that I know how to make php calls whial in the _body document, should I realy? It isn't recomended and I have the sneaky suspicion that all of the wierd interconnected files I have been playing with and trying to figure out have a purpose; one goal of which is to speed up loading times. Which brings me to the real question and perhapse the questions that tag along with it:

What is the proper way to create a new custom page like this? Why is PhpBB set up like this ( for speed )? After making a call to a database, do we need to

Code: Select all

// free result set memory 
mysql_free_result($result); 
or

Code: Select all

// close connection 
mysql_close($connection); 
?

And, if anyone has the time and inclination: What would a flow chart of the way PhpBB handles these files/processes look like?




P.S. I accidently tryed to post this in the wrong section. Lucky, that section needs a moderator to approve it before it becomes visable. I've no doubt that it will be deleted instead of aproved; this is just a little segment so that the mods won't think I'm trying to double post or such.

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1904
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: New Custom Page with Php the Correct Way

Post by DavidIQ »

WinterWulf wrote:Why is PhpBB set up like this ( for speed )? After making a call to a database, do we need to

Code: Select all

// free result set memory 
mysql_free_result($result); 
or

Code: Select all

// close connection 
mysql_close($connection); 
?
To free up resources and prevent database locking.
Image

WinterWulf
Registered User
Posts: 14
Joined: Wed Feb 04, 2009 6:35 pm
Location: North Pole

Re: New Custom Page with Php the Correct Way

Post by WinterWulf »

WinterWulf wrote: Which brings me to the real question and perhapse the questions that tag along with it:

What is the proper way to create a new custom page like this? Why is PhpBB set up like this ( for speed )? After making a call to a database, do we need to

Code: Select all

// free result set memory 
mysql_free_result($result); 
or

Code: Select all

// close connection 
mysql_close($connection); 
?

And, if anyone has the time and inclination: What would a flow chart of the way PhpBB handles these files/processes look like?
I'm sorry the way I typed it was not as clear as I had hoped: each of the above sentances is a seperate question. So the question about databases would read:
After making a call to a database, do we need to

Code: Select all

// free result set memory 
mysql_free_result($result); 
or

Code: Select all

// close connection 
mysql_close($connection); 
?
To clarifly it even further, the database I am talking about is the same that PhpBB uses, thus we can ( and must ) omit the code that involves connecting to the database, ext...

Code: Select all

// The code that you shouldn't include in your php code ( PhpBB has already opened the connection ):


// set database server access variables: 
$host = "localhost"; 
$user = "test"; 
$pass = "test"; 
$db = "testdb"; 
// open connection 
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); 
// select database 
mysql_select_db($db) or die ("Unable to select database!"); 
However, I'm not sure if I should call mysql_free_result($result); or if it will result in errors down the line. I'm pretty sure that calling mysql_close($connection); would be a very bad idea, but I just don't know for sure.

WinterWulf wrote:Why is PhpBB set up like this ( for speed )?
This question refers to the Php code and text being completely seperated. I know part of the reason is to make designing templates easyier.

Locked