Posted on April 30th, 2007
17724 views
Hey this is my first tutorial on Pixel2Life where I will be teaching you how to use IPB SDK. IPB SDK is a library for IPB which makes site integration very easy.
Please note that this tutorial is for IPB 2.17 in particular. If you want this tutorial to work for IPB 2.2 you will need the v2.2 SDK. For information on how to get this click here Uploading First of all you need to download the IPB SDK. You can download it here (Invisionize registration required). Now create a new folder on your hosting account called sdk. If you use FTP extract the ZIP onto a location on your PC and copy all of the files into the folder. If you use cPanel's File Management tool go into the folder, upload the IPB SDK ZIP file, click on it and on the right pane click Extract All Files. You now have IPB SDK ready to configure. Configuring Once you have uploaded all the files open up ipbsdk_conf.inc.php for editing. For root path you should put in something like this: $root_path = $_SERVER['DOCUMENT_ROOT'] . "/forum/"; If you don't understand what this means basically $_SERVER['DOCUMENT_ROOT'] is the public_html directory on your host and forum is your forum directory, for example if my forum was located at http://www.ipbsdkwebsite.com/community/forums/ you would put: $root_path = $_SERVER['DOCUMENT_ROOT'] . "/community/forums/"; For $board_url just put your forums address (what you would type in the URL bar in your browser) without a trailing slash, for example: $board_url = 'http://www.ipbsdkwebsite.com/forums';I recommend you keep all other variables as they are. Integrating Now to start integrating. Open up a file you wish to integrate with your forums and at the top before anything else put: <?php If you use PHP Navigation on your site (index.php?act=blabla etc.) just place the code on your master page, for example index.php?act=blabla you would just put the code at the top of index.php Now I will teach you some of the things you can do using the IPB SDK. Checking if user is logged in If you want to check if a user is logged in you use this code: <?php Basically $SDK->is_loggedin() returns a True/False answer to the PHP script. If a user is logged in the answer would be True. You can always add an else to the code for guests. BB Code bbcode2html(VALUE TO CONVERT, Smilies On(1)/Off(0)); Why create a BB Code script when IPB has already made a complex one with lots of options that you can use easily. This is an example of using BB Code: <?php This would convert whatever BB Code is found in input to HTML and smilies will be parsed. Those are just two examples of what you can do with IPB SDK but there are dozens of other functions that you can use. For more examples just look in the examples folder. Conclusion I hope you enjoyed reading this tutorial. If there was something you didn't understand or you need help just send me a PM and I will answer as soon as possible. I would like to thank Pita (Invisionize.com) for the great SDK but most of all Jamie Chung (Chaos King) for this excellent publishing system. Happy SDKing ^_^. |