Thread Rating:
  • 16 Vote(s) - 4.38 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Include your custom pages in Mybb
#31
To make your pages compatible with version 1.2 you will have to make the following changes to the PHP file

first, this code should be at the top of the php file, on a new line, just after “<?php”
define("IN_MYBB", 1);

the “addnav” function is now called “add_breadcrumb”
and the “outputpage” function is now called “output_page”
[Image: MiNT.png]
Reply
#32
Also $settings is no more It was deprecated in 1.2 and removed. use {$mybb->settings['settingsvar']} in templates instead. and $mybb->settings['settingsvar'] in the page.
Reply
#33
[/size]
CraKteR Wrote:Also $settings is no more It was deprecated in 1.2 and removed. use {$mybb->settings['settingsvar']} in templates instead. and $mybb->settings['settingsvar'] in the page.

i did not understand the above. $mybb->settings....

but friends the code which is worked for 1.2.1 is below. just finely worked for me hope for you also ,
php code:[size=medium]

<?php
define("IN_MYBB",1);
require "./global.php"; // (1)

add_breadcrumb("Rules page", "rules.php"); // (2)

eval("\$Rules = \"".$templates->get("Rules")."\";"); // (3)
output_page($Rules); // (4)
?>
Reply
#34
nice tutorial... but how come my php codes within the template aren't executed.

i placed <?php echo "1234";?> within the template but nothing happened

Sad

is it possible to execute php codes at all?
Reply
#35
edge18 Wrote:nice tutorial... but how come my php codes within the template aren't executed.

i placed <?php echo "1234";?> within the template but nothing happened

Sad

is it possible to execute php codes at all?
You can put php variables ( {$example} ) and variable arrays ( {$example['array']} ) but no other php code works. Its all to do with the eval() way of parsing the template.
Reply
#36
Thank you DennisTT for updating the info to suit the new version.
Reply
#37
ll jdmeg222 ll Wrote:and in $links:


Where do we define the '$Page'?  Like is that in the template or a php code on its own?

And


MiNT Wrote:first, this code should be at the top of the php file, on a new line, just after “<?php”
define("IN_MYBB", 1);

the “addnav” function is now called “add_breadcrumb”
and the “outputpage” function is now called “output_page”

The "IN_MYBB", , is that supposed to be replaced with our DB name?
Reply
#38
Hello

Quote:The "IN_MYBB", , is that supposed to be replaced with our DB name?

No keep it as it is, it has nothing to do with DB name.

Please read again the first post, it has all the information needed. If you face a problem again please ask and provide interrogation from the 1st post so i can help you more.

regards
Reply
#39
Template code:
<html>
<head>
<title>{$mybb->settings['settingsvar']}</title>
{$headerinclude}
</head>
<body>
{$header}
{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}
{$latestthreads}
<br />
<table width="100%" border="0">
<thead>
<tr>
<th>New Page</th>
</tr>
<tbody>
<tr>
<td>The new testing page</td>
</tr>
</tbody>
</table>
{$footer}
</body>
</html>

PHP Code:
<?php
$mybb->settings['settingsvar']
define('IN_MYBB', 1); // (1a)

require "./global.php"; // (1)

add_breadcrumb("New Page", "NewPage.php"); // (2)

eval("\$NewPage = \"".$templates->get("NewPage")."\";"); // (3)
outputpage($NewPage); // (4)
?>

Am I doing the right thing?  I'm a total newb to this, but once I've done it, I can retrace my steps then there'll be no more questions in the future Wink.
But the reason why I'm fretting is because I get this error:
Fatal error: Call to undefined function addnav() in /forums/newpage.php on line 7

Firstly, I changed the 'addnav()' to 'add_breadcrumb' (like as suggested in one of the previous posts).  So what is wrong?

and is my code actually right?  I found it quite hard to interpret the instructions, only because I have never done anything like this before.

Alternatively, I just duplicated the Portal template and php code to my NewPage, and it was all fine, but I didn't know what to delete from the php file to remove the announcements.  Would that be an easier option for me?

Edited: Now I'm getting error:
Parse error: syntax error, unexpected T_STRING in /forums/newpage.php on line 3


Many thanks and sorry to be a bother.
Reply
#40
Quote:Edited: Now I'm getting error:
Parse error: syntax error, unexpected T_STRING in /forums/newpage.php on line 3-/

the is no semi-column after $mybb->settings['settingsvar'], even if corrected what is this? this will do nothing what are you trying to do through it?. Plus you can't put it above
require "./global.php";

this code below works perfectly
<?php
define('IN_MYBB', 1); // (1a)

require "./global.php"; // (1)

add_breadcrumb("New Page", "NewPage.php"); // (2)

eval("\$NewPage = \"".$templates->get("NewPage")."\";"); // (3)
output_page($NewPage); // (4)
?>

Regards
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)