How To Add A New Page Without Plugins
#1
For this tutorial you need FTP access and small knowledge of HTML.

THIS WILL TAKE AROUND 10 MINUTES AND IS HARD TO REVERSE

1) Login into your FTP, go into the root folder of your forum and duplicate index.php

2) Rename your duplicated to anything, for now, we'll use example.

3) Go and edit your duplicated file (example.php) and scroll to the bottom and change the following code:

eval("\$index = \"".$templates->get("faq")."\";");
to
eval("\$index = \"".$templates->get("example")."\";");

You can change example to anything you want.

4) Login into ACP, now follow...
TEMPLATES & STYLES -> Your Theme (we'll be using Novus Dusk 2) -> global.css -> Advanced

5) Now, find .navigation and copy everything that begins with .navigation

6) Make your copyied .navigation to .navigation2

7) Go to Templates -> Your Theme -> Add New Template

8) Open another tab and go into ACP, templates, templates -> Index Templates -> index and copy everything in there.

9) Go to your previous tab, copy everything in there and it should look something like this (may look different depending on theme).

<html>
<head>
<title>{$mybb->settings['bbname']} | Technology, Computers, Tablets Forum</title>
{$headerinclude}
<script type="text/javascript">
<!--
	lang.no_new_posts = "{$lang->no_new_posts}";
	lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>
</head>
<body>
{$header}
{$forums}
{$boardstats}

<dl class="forum_legend smalltext">
	<dt><img src="{$theme['imgdir']}/on.gif" alt="{$lang->new_posts}" title="{$lang->new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /></dt>
	<dd>{$lang->new_posts}</dd>

	<dt><img src="{$theme['imgdir']}/off.gif" alt="{$lang->no_new_posts}" title="{$lang->no_new_posts}" style="vertical-align: middle; padding-bottom: 4px;" /></dt>
	<dd>{$lang->no_new_posts}</dd>

	<dt><img src="{$theme['imgdir']}/offlock.gif" alt="{$lang->forum_locked}" title="{$lang->forum_locked}" style="vertical-align: middle;" /></dt>
	<dd>{$lang->forum_locked}</dd>
</dl>
<br style="clear: both" />
{$footer}
</body>
</html>

Now change all of it too this..

<html>
<head>
<style type="text/css">
 .navigation {
display: none;
}
</style>
<title>Example | {$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
	lang.no_new_posts = "{$lang->no_new_posts}";
	lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>
</head>
<body>
{$header}
<div class="navigation2">
<a href="index.php">{$mybb->settings['bbname']}</a> / <a href="faq.php">Example</a>{$sep}
</div>
<h2>Example</h2>
This is my example page

<br style="clear: both" />
{$footer}
</body>
</html>

9) Click Save

10) Vist you forum then type in /example.php and you'll see your page
Reply
#2
what if im using multiple themes?
Reply
#3
Sweet can't wait to try this out.
Reply
#4
tip:

place these templates in the global section. so it will work with all templates if you want this page to be for any template/theme you use. if its for only one theme then put it inside the theme you be using it for.
Reply
#5
(2012-04-01, 03:05 PM)Lewes Wrote: For this tutorial you need FTP access and small knowledge of HTML.

THIS WILL TAKE AROUND 10 MINUTES AND IS HARD TO REVERSE

1) Login into your FTP, go into the root folder of your forum and duplicate index.php



3) Go and edit your duplicated file (example.php) and scroll to the bottom and change the following code:

eval("\$index = \"".$templates->get("faq")."\";");
to
eval("\$index = \"".$templates->get("example")."\";");

should it not actually state?

eval("\$index = \"".$templates->get("index")."\";");


rather than:
eval("\$index = \"".$templates->get("faq")."\";");



and why suggest?
Quote:Login into your FTP, go into the root folder of your forum and duplicate index.php


when for example could you not just as simply use less for example.php ?

<?php
/**
 * MyBB 1.8
 * example.php
 */

define('IN_MYBB', 1);
define('THIS_SCRIPT', 'example.php');

$templatelist = "example";

require_once './global.php';

eval('$example = "'.$templates->get('example').'";');
output_page($example);


Just a quick random thought
Reply
#6
(2015-12-11, 03:17 PM)vintagedaddyo Wrote: should it not actually state?

eval("\$index = \"".$templates->get("index")."\";");


rather than:
eval("\$index = \"".$templates->get("faq")."\";");


$index is just a variable, the template name has nothing to do with it except that you're assigning its contents. I don't think you want to use the index template on a custom page.
Reply
#7
(2015-12-15, 10:11 AM)Destroy666 Wrote:
(2015-12-11, 03:17 PM)vintagedaddyo Wrote: should it not actually state?

eval("\$index = \"".$templates->get("index")."\";");


rather than:
eval("\$index = \"".$templates->get("faq")."\";");


$index is just a variable, the template name has nothing to do with it except that you're assigning its contents. I don't think you want to use the index template on a custom page.

I am aware of that.., the quoted question and correction suggestion was merely suggested to actually follow the explained steps from the op which did not match the supplied code they suggested to the user to find and change. The suggestion also to copy the index file for custom usage was rather pointless and is why I suggested the example as a logical starting point to whatever end point of individual custom page development as a base suggestion towards an alternative to simply copying the index file as the op had suggested.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)