2006-12-11, 10:38 PM
I want to include a .php file in a template in mybb but it doesn't work, I'm using:
<?include ('The file')?>
What's wrong?
<?include ('The file')?>
What's wrong?
Including a file in a template
|
2006-12-11, 10:38 PM
I want to include a .php file in a template in mybb but it doesn't work, I'm using:
<?include ('The file')?> What's wrong?
2006-12-11, 11:00 PM
You can't do it. Instead use an iframe. The templates won't execute PHP code in the same manner. If you save your file as a .php then iframe it into the template you should be fine.
2006-12-12, 10:00 PM
Yuck, don't use an iframe, basically this is what you want to do. http://community.mybboard.net/showthread...0#pid26480
Depending on what's in the included file, this should work.
Place that code in the desired MyBB php file, then use {$var} in the template.
[Need Smilies? Get Me Smileys!]
2006-12-13, 12:15 AM
(This post was last modified: 2006-12-13, 12:31 AM by BrandMan211.)
All I need to do is include a Text file that contains all of the links. This code isn't working. Well actually I'm probably doing it wrong.
Edit: AHH this really messed my forum up! What do I do? http://www.bmestudioz.com/community Edit: I fixed it but I still don't know how to do this. I especially don't know where to put the code, I don't know what file needs to have it.
2006-12-13, 02:02 AM
If you want to want to add it to all pages then you should add it to global.php.
However instead of editing the files, because they may get overwritten when you upgrade to newer versions, I'd recommend using a simple plugin to do the job for you. Download the attached file, open it up and change "path/to/file.php" to the path of the file you want to include (if you can't figure it out let me know the URL of your text file and I'll fix it up for you). Then upload the file to your inc/plugins/ directory and go to the "Plugins" page in the Admin CP and click activate next to "Site Navigation Include Plugin". Then open up the header template (or the template wherever you want the links) and add {$my_navigation} to it - it should appear in the pages. Basically using a plugin means that when you upload a new version of MyBB with the global.php file changed (or any other file changed) you do not need to redo your changes to the files.
2007-05-26, 08:02 PM
Nice tip.
Can we add adsense code in this php file?
2007-05-27, 06:52 AM
I'm not familiar with Adsense code, but if it requires PHP, then you can put it in a PHP file, and put that filename in the NAV_FILE constant in the plugin file Chris posted.
If the Adsense code doesn't need PHP (which I don't think it does) then you can add the HTML code directly into the template. |
« Next Oldest | Next Newest »
|