I have a page in root directory and this works great!
include("global.php");
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/class_parser.php";
$smilieinserter = build_clickable_smilies();
$codebuttons = build_mycode_inserter();
But when I place the page in the subdirectory smiles and code-buttons don't show!
The only thing I change is this:
include("../global.php");
What should I fix?
you need explain better what you trying make...
why not put $plugins->run_hooks('xxxx_start') (in your new page something xxx.php)
and in plugin side
$plugins->add_hook("xxxx_start", "codebuttons");
function codebuttons () {
global $smilieinserter, $codebuttons;
$codebuttons = build_mycode_inserter();
$smilieinserter = build_clickable_smilies();
}
This is a custom
.php page!
I don't need any hook! I am including
:
include("global.php");
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/class_parser.php";
Which works when the page.php is in the root:
example.com/page.php
But it doesn't work when I move the page to subfolder:
example.com/folder/page.php
I am not sure why it's not reading those functions?
(2015-06-28, 01:59 PM)marcus123 Wrote: [ -> ]This is a custom .php page!
I don't need any hook! I am including:
include("global.php");
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/class_parser.php";
Which works when the page.php is in the root: example.com/page.php
But it doesn't work when I move the page to subfolder: example.com/folder/page.php
I am not sure why it's not reading those functions?
more easy use hook...
and build_clickable_smilies() and build_mycode_inserter() function in inc/functions.php
I have crated a plugin hooked to the page but the same issue $smilieinserter for instance show like broken images!
It works when the page is in the root not in the folder?
I have to somehow make it believe the page is in the root not in subfolder!
How did you do that please tell me?
(2015-06-28, 04:03 PM)marcus123 Wrote: [ -> ]How did you do that please tell me?
i only made what i said to you...
test.php
<?php
define('IN_MYBB', 1); // (1a)
require "../global.php"; // (1b)
$plugins->run_hooks('xxx_start');
add_breadcrumb("test", "test.php"); // (2)
eval("\$test = \"".$templates->get("test")."\";"); // (3)
output_page($test); // (4)
?>
test global template
<html>
<head>
<title>{$mybb->settings['bbname']} - Test</title>
{$headerinclude}
</head>
<body>
{$header}
{$smilieinserter}
<textarea style="width: 100%; padding: 4px; margin: 0;" rows="8" cols="80" name="message" id="message" tabindex="1"></textarea>{$codebuttons}
{$footer}
</body>
</html>
plugin file:
$plugins->add_hook('xxx_start', 'testfunc');
function testfunc() {
global $mybb, $theme, $templates, $lang, $smilieinserter, $codebuttons;
$codebuttons = build_mycode_inserter();
$smilieinserter = build_clickable_smilies();
}
Buddy I thank you very much for time you dedicated to resolving my issue.
I have found the season why it wasn't working for me!
1. Had to provide full URL path for: codebuttons template: {$mybb->settings['bburl']}/jscripts/editor.js as it was: jscripts/editor.js so it was not loading.
2. build_clickable_smilies(); had to edit the image link as they were showing broken.
Basically using my own custom functions.
Thanks again.