Publishing System Settings Logout Login Register
PHP Templating System like phpBB
TutorialCommentsThe AuthorReport Tutorial
Tutorial Avatar
Rating
Add to Favorites
Posted on September 23rd, 2009
5319 views
PHP Coding
First the code then i'll explain

page.php


page.tpl


I'll explain by line number because the p2l system strips some chars from regex

page.php
Line 2:
With that function we get the contents from page.tpl and store them into variable $file

Line 4:
Here we extract the data between <!-- BEGIN user --> and <!-- END user --> the regex matches all characters and symbold

Line 6 - 9:
Here we have the data that we will add between the <!-- BEGIN user --> and <!-- END user -->. This data can be extracted from the database

Line 14, 15:
Now we replace {USER} and {USER_ID} with the data from Line 6 - 9

Line 21:
With this function we replace all the data between  <!-- BEGIN user --> and <!-- END user --> with $data that results from the loop.

Line 23 - 27:
Here we replace the static vars with the text we need

Line 29:
Now we return the page :D

There might be spelling errors. If you have anything to add please contact me or post a comment.

File Download: page.zip
Dig this tutorial?
Thank the author by sending him a few P2L credits!

Send
cigraphics

This author is too busy writing tutorials instead of writing a personal profile!
View Full Profile Add as Friend Send PM
Pixel2Life Home Advanced Search Search Tutorial Index Publish Tutorials Community Forums Web Hosting P2L On Facebook P2L On Twitter P2L Feeds Tutorial Index Publish Tutorials Community Forums Web Hosting P2L On Facebook P2L On Twitter P2L Feeds Pixel2life Homepage Submit a Tutorial Publish a Tutorial Join our Forums P2L Marketplace Advertise on P2L P2L Website Hosting Help and FAQ Topsites Link Exchange P2L RSS Feeds P2L Sitemap Contact Us Privacy Statement Legal P2L Facebook Fanpage Follow us on Twitter P2L Studios Portal P2L Website Hosting Back to Top