If I were to open portal in Dreamweaver, would I be able to set that as a template and make additional pages from it? Say Home.php, News.php etc?
I want to make additional pages, but I want them all to look the same.
If you look at the Admin CP --> Templates, you can see that there is a section called "Portal Templates" and thus the portal templates are already part of MyBB.
Therefore, you can make a new copy of portal.php and save it as pagename.php.
Delete the following code from pagename.php:
// Get latest news announcements
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."forums WHERE fid='$settings[portal_announcementsfid]'");
$forum = $db->fetch_array($query);
$pids = "";
$comma="";
$query = $db->query("SELECT p.pid FROM ".TABLE_PREFIX."posts p LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid AND t.dateline=p.dateline) WHERE t.fid='$settings[portal_announcementsfid]' AND t.visible='1' AND t.closed NOT LIKE 'moved|%' ORDER BY t.dateline DESC LIMIT 0, $settings[portal_numannouncements]");
while($getid = $db->fetch_array($query)) {
$pids .= ",'$getid[pid]'";
}
$pids = "pid IN(0$pids)";
// Now lets fetch all of the attachments for these posts
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."attachments WHERE $pids");
while($attachment = $db->fetch_array($query)) {
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
}
$query = $db->query("SELECT t.*, i.name as iconname, i.path as iconpath, t.username AS threadusername, u.username, u.avatar, p.message FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."icons i ON (i.iid = t.icon) LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid) LEFT JOIN ".TABLE_PREFIX."posts p ON (p.tid=t.tid AND p.dateline=t.dateline) WHERE 1=1 AND $pids ORDER BY t.dateline DESC LIMIT 0, $settings[portal_numannouncements]");
while($announcement = $db->fetch_array($query))
{
$announcement['author'] = $announcement['uid'];
if(!$announcement['username'])
{
$announcement['username'] = $announcement['threadusername'];
}
$announcement['subject'] = htmlspecialchars(stripslashes($announcement['subject']));
if($announcement['iconpath'])
{
$icon = "<img src=\"$announcement[iconpath]\" alt=\"$announcement[iconname]\">";
}
else
{
$icon = " ";
}
if($announcement['avatar'] != "")
{
$avatar = "<td class=\"trow\" class=\"trow1\" width=1 align=\"center\" valign=\"top\"><img src=\"$announcement[avatar]\"></td>";
}
else
{
$avatar = "";
}
$anndate = mydate($settings['dateformat'], $announcement['dateline']);
$anntime = mydate($settings['timeformat'], $announcement['dateline']);
if($announcement['replies'])
{
eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments")."\";");
}
else
{
eval("\$numcomments = \"".$templates->get("portal_announcement_numcomments_no")."\";");
$lastcomment = "";
}
if(is_array($attachcache[$announcement['pid']]))
{ // This post has 1 or more attachments
$validationcount = 0;
while(list($aid, $attachment) = each($attachcache[$announcement['pid']]))
{
if($attachment['visible'])
{ // There is an attachment thats visible!
$attachment['name'] = htmlspecialchars($attachment['name']);
// Support for [attachment=id] code
if(stripos($announcement['message'], "[attachment=".$attachment['aid']."]") !== false)
{
if($attachment['thumbnail'] && $forumpermissions['candlattachments'] == "yes")
{ // We have a thumbnail to show
eval("\$attbit = \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";");
}
elseif($attachment['thumbnailsm'] == "yes" && $forumpermissions['candlattachments'] == "yes")
{ // Image is small enough to show
eval("\$attbit = \"".$templates->get("postbit_attachments_images_image")."\";");
}
else
{
$attachment['filesize'] = getfriendlysize($attachment['filesize']);
$ext = getextention($attachment['filename']);
$attachment['icon'] = getattachicon($ext);
eval("\$attbit = \"".$templates->get("postbit_attachments_attachment")."\";");
}
$announcement['message'] = preg_replace("#\[attachment=".$attachment['aid']."]#si", $attbit, $announcement['message']);
}
else
{
if($attachment['thumbnail'] && $forumpermissions['candlattachments'] == "yes")
{ // We have a thumbnail to show
eval("\$thumblist .= \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";");
if($tcount == 5)
{
$thumblist .= "<br />";
$tcount = 0;
}
$tcount++;
}
elseif($attachment['thumbnailsm'] == "yes" && $forumpermissions['candlattachments'] == "yes")
{ // Image is small enough to show
eval("\$imagelist .= \"".$templates->get("postbit_attachments_images_image")."\";");
}
else
{
$attachment['filesize'] = getfriendlysize($attachment['filesize']);
$ext = getextention($attachment['filename']);
$attachment['icon'] = getattachicon($ext);
eval("\$attachmentlist .= \"".$templates->get("postbit_attachments_attachment")."\";");
}
}
}
else
{
$validationcount++;
}
}
if($thumblist)
{
eval("\$attachedthumbs = \"".$templates->get("postbit_attachments_thumbnails")."\";");
}
if($imagelist)
{
eval("\$attachedimages = \"".$templates->get("postbit_attachments_images")."\";");
}
if($attachmentlist || $thumblist || $imagelist)
{
eval("\$attachments = \"".$templates->get("postbit_attachments")."\";");
}
}
$message = postify($announcement['message'], $forum['allowhtml'], $forum['allowmycode'], $forum['allowsmilies'], $forum['allowimgcode']);
eval("\$announcements .= \"".$templates->get("portal_announcement")."\";");
}
That code displays the announcements on the portal, but since you want your own content, you can omit that.
Replace your code above with:
$announcements = "Your page text here";
Since the portal template uses the variable $announcements for the text in the main column, you must use that in your page to indicate to the template parser what stuff to output.
I hope that helps you.
Wow, thanks Dennis. I'm glad I asked here first before trying that on my own.
I'm much too tired to try that tonight, but I'll give it a shot tomorrow night.
Thanks again!
I just did it off the top of my head. If it doesn't work, just let me know and I'll see what I've done wrong :p