Results 1 to 1 of 1
Hybrid View
-
13th Jan 2008, 01:32 AM #1OPMember
[TUT]Achieving a PHP Include in a template bit
This article will discuss one way in which you may achieve a PHP include-like functionality in your template bits on your forum. It requires editing your ipsclass.php file, so make sure you back up everything that may be important to you before trying this.
Open ipclass.php
find around line 590:
Code:/*-------------------------------------------------------------------------*/ // INIT: Load cache /*-------------------------------------------------------------------------*/
Code:/*-------------------------------------------------------------------------*/ // My Include function. /*-------------------------------------------------------------------------*/
Code:function get_include_contents($filename) { if (is_file($filename)) { ob_start(); include $filename; $contents = ob_get_contents(); ob_end_clean(); return $contents; } return false; }
now go up to the top of the file and find
Code:* @package InvisionPowerBoard * @author Matt Mecham * @version 2.1 */ class ipsclass {
Code:var $my_included_contents = '';
now find where the function initiate_ipsclass is. Keep following the file down until you find stuff that looks like:
Code://----------------------------------------- // Max display name length //----------------------------------------- $this->vars['max_user_name_length'] = $this->vars['max_user_name_length'] ? $this->vars['max_user_name_length'] : 26;
Code://----------------------------------------- // Load my included contents //----------------------------------------- $this->my_included_contents = $this->get_include_contents('/path/to/file.php');
now in the template bit you can use {$this->ipsclass->my_included_contents} wherever you want the content.
Keep in mind, in the developer API they suggest never editing any of the core IPB files like this. So do it at your own risk!
This can be really expanded to you putting any sort of function you want in there, as long as it returns a variable or an array, you can use the same process. For my php includes, i just make the file i am including into a function and paste the function instead of actually including it.
This can be powerfull. This can be dangerous. Get it working on a test board first! Back up everything!Lease Reviewed by Lease on . [TUT]Achieving a PHP Include in a template bit This article will discuss one way in which you may achieve a PHP include-like functionality in your template bits on your forum. It requires editing your ipsclass.php file, so make sure you back up everything that may be important to you before trying this. Open ipclass.php find around line 590: /*-------------------------------------------------------------------------*/ // INIT: Load cache /*-------------------------------------------------------------------------*/ We will start Rating: 5Extremely helpful article about hiding your identity here
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[Selling] Post Button (Include PSD)
By Samar in forum ServicesReplies: 0Last Post: 26th Aug 2012, 06:08 PM -
Use php include for certain div of the page
By igordr in forum Web Development AreaReplies: 9Last Post: 25th Aug 2012, 05:54 PM -
vbulletin 4 php include
By Klinzter in forum Webmaster DiscussionReplies: 0Last Post: 31st Aug 2011, 09:13 PM -
[Hiring] Uploaders to include URl in uploads (for $)
By kiladila in forum Completed TransactionsReplies: 5Last Post: 13th Mar 2011, 09:00 PM -
PHP Include (How To Template Your Site)
By Jesse in forum Tutorials and GuidesReplies: 3Last Post: 14th Jan 2011, 03:43 PM
themaPoster - post to forums and...
Version 5.35 released. Open older version (or...