Jump to the post that solved this thread.
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 6 Years, 5 Months, 3 Weeks ago PHP in a Custom page with Mybb
#11
Solved: 6 Years, 5 Months, 3 Weeks ago
@.m. Check your pm.
#12
Solved: 6 Years, 5 Months, 3 Weeks ago
What .m. said, also no idea why you place the PHP inside the page template? Should be (made it also cleaner and using MyBB templates):
<?php
define('IN_MYBB', 1); // (1a)
require "./global.php"; // (1b)

global $mybb;

add_breadcrumb("Test Custom page", "testpage_c.php"); // (2)

$msg = $mybb->input["msg"];
$name = $mybb->input["name"];
if(!empty($msg)) {
    $posts = "$msg - $name\n";
}

$template = '
 <html>
 <head>
 {$headerinclude}
 <title>Test Page</title>
 </head>

<body>
{$header}
 <form id="form1" name="form1" method="post" action="">
 <label>Please type in a message
 <input class="textbox" type="text" name="msg" id="msg" />
 </label>
 <label>and your name
 <input class="textbox" type="text" name="name" id="name" />
 </label>

 <p>
 <label>Submit
 <input class="button" type="submit" name="submit" id="submit" value="Submit" />
 </label>
 </p>
 </form>
{$posts}
{$footer}
</body>
</html>';

$template = str_replace("\'", "'", addslashes($template));
eval("\$testpage=\"".$template."\";");
output_page($testpage);
?>

Tested, works.

[email protected], wait what? No idea what you're talking about, the output of the echo function used previously in an incorrect way is moved inside the template as {$posts} variable and you can move it wherever you want.
#13
Solved: 6 Years, 5 Months, 3 Weeks ago
Thanks bro, this will work though. The echoed output will come at top of the page above the $template content.

I haven't quite well observed the misplaced php code above as I have done that in localhost (not with the mybb). And so now, how can I place the echoed output just under the form.
#14
Solved: 6 Years, 5 Months, 3 Weeks ago
You can't test page for MyBB without MyBB... global.php is required in 3rd line so nothing is going to work without that file.

Read the edit to my previous post to know how to move the output, still I don't think you even tried my code because the message and name are right below the form in the template I posted.
#15
Solved: 6 Years, 5 Months, 3 Weeks ago
@Destroy666, check your pm
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)