I am working a modification where the admin will be able to easily make their own custom pages.
I need to make the form to input the data into the database but for now I'm editing the database manually.
Demo
I have created the form for the custom page but I have to integrate into MyBB template system
I have some work on the form to do still yet but it works the way I want it.
Make a custom page
Are you making templates to go with thes pages?
I just did.
Go to the link in my second post and make a new page.
You'll have to use <br /> to make a new line.
Why? Add MyCode support on the page that outputs you content. Basicly call
require "./inc/functions_post.php";
at the top of the php page then
$custompagecontent = postify($results['custompagecontent'], "no", "yes", "yes", "yes");
echo $custompagecontent;
Thanks k776 but can you tell me where "$results['custompagecontent']" is referring to?
Well it doesn't work
<?php
$templatelist = "custom_page,custom_page_no";
require "./global.php";
require "./inc/functions_post.php";
$custompagecontent = postify($results['content'], "no", "yes", "yes", "yes");
echo $custompagecontent;
$query = $db->query("SELECT cpe FROM ".TABLE_PREFIX."custompage WHERE cpid='$cpid'");
$custpage = $db->fetch_array($query);
if ($mybb['usergroup'] != "4") {
if ($custpage['cpe'] == "no") {
$disabled = "This page is currently unavaliable";
eval("\$disabled = \"".$templates->get("custom_page_no")."\";");
outputpage($disabled);
}
}
$query = $db->query("SELECT title FROM ".TABLE_PREFIX."custompage WHERE cpid='$cpid'");
$custtitle = $db->fetch_array($query);
$title = "{$custtitle['title']}";
$query = $db->query("SELECT title, content FROM ".TABLE_PREFIX."custompage WHERE cpid='$cpid'");
$custcont = $db->fetch_array($query);
$content = "{$custcont['content']}";
eval("\$custom = \"".$templates->get("custom_page")."\";");
outputpage($custom);
?>
Can you tell me what I did wrong with the code you told me to add?
lol, I thought you'de intergrate it yourself
Use this
<?php
$templatelist = "custom_page,custom_page_no";
require "./global.php";
require "./inc/functions_post.php";
$query = $db->query("SELECT cpe,title,content FROM ".TABLE_PREFIX."custompage WHERE cpid='".intval($cpid)."'");
$custpage = $db->fetch_array($query);
if($custpage['cpe'] == "no" && $mybb['usergroup'] != "4")
{
$disabled = "This page is currently unavaliable";
eval("\$disabled = \"".$templates->get("custom_page_no")."\";");
outputpage($disabled);
}
else
{
$title = $custpage['title'];
$content = postify($custpage['content'], "no", "yes", "yes", "yes");
eval("\$custom = \"".$templates->get("custom_page")."\";");
outputpage($custom);
}
?>
It intergrats postify (meaning smilies, MyCode, and images are on but not html, and optimized the code so thing run faster (whats with all those extra queries
)
thanks a lot k776 it works.
Go to the link in my second post to make your own custom page.
Looking good. Still needs work though. Try using this:
<?php
$templatelist = "custom_page,custom_page_no";
require "./global.php";
require "./inc/functions_post.php";
$query = $db->query("SELECT cpid,cpe,title,content FROM ".TABLE_PREFIX."custompage WHERE cpid='".intval($cpid)."'");
$custpage = $db->fetch_array($query);
if(!$custpage['cpid'] || $custpage['cpe'] == "no" && $mybb['usergroup'] != "4")
{
$disabled = "This page is currently unavaliable or does not exist. Please check back later.";
eval("\$custompage = \"".$templates->get("custom_page_no")."\";");
}
else
{
$title = $custpage['title'];
$content = postify($custpage['content'], "no", "yes", "yes", "yes");
eval("\$custompage = \"".$templates->get("custom_page")."\";");
}
outputpage($custompage);
?>
And a time of creation of the page would be nice too
Thanks again
I always wondered how to tell if the id exists or they're not even viewing an id.
But now I know "!$custpage['cpid']" does just that.