Thread Rating:
  • 3 Vote(s) - 2.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use portal as home page outside forum
#1
If you have your forum in a fodler below the site root, you can use the MyBB portal as a home page very easily.


file/folder changes
  1. assume MyBB is in the /forum folder, your actual subfolder can be different
  2. leave index.php as index.php in /forum folder
  3. edit settings to use new /forum directory
  4. move portal.php to site root
  5. edit portal.php and find
    $forumdir = "./";
    

    replace
    $forumdir = "./forum";
    
  6. make these changes as well
    in portal.php (now index.php in site root)

    find:
    $parser = new postParser;
    

    add after:
    global $theme;
    $theme['imgdir'] = $forumdir.'/'.substr($theme['imgdir'],0);
    
  7. rename portal.php to index.php
  8. to make quick login work, you need to edit /jscripts/general.js and find the quickLogin function and make the 3 lines look like (the bburl and bburl+)
    find:
    	quickLogin: function()
    	{		
    		if($("quick_login"))
    		{
    			var form = new Element("form", { method: "post", action: "member.php" });
    

    replace:
    	quickLogin: function(bburl)
    	{		
    		if($("quick_login"))
    		{
    			var form = new Element("form", { method: "post", action: bburl+"member.php" });
    


template changes
  1. edit "header" so it is similar to this, where the Home link goes to your site root (homeurl), and the Forums link goes to the forum (bburl)
    <div class="menu">
    				<ul>
    					<li><a href="{$mybb->settings['homeurl']}"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/portal.gif" alt="Home" title="Home" width="16" height="16" />Home</a></li>
    					<li><a href="{$mybb->settings['bburl']}/index.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/forum.png" alt="Forums" title="Forums" width="16" height="16" />Forums</a></li>
    
  2. edit "header" to correct the logo link to use homeurl
    <div class="logo"><a href="{$mybb->settings['homeurl']}"><div style="float:left"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" width="600" /></a></div>
    
  3. edit the header_welcomeblock_guest template and change
    onclick="MyBB.quickLogin();
    
    to
    onclick="MyBB.quickLogin('{$mybb->settings['bburl']}/');
    

then there are some edits to deal with PM notices that come up on the index page (was portal).

in global.php

find:
$privatemessage_text = $lang->sprintf($lang->newpm_notice_one, $user_text, $pm['pmid'], htmlspecialchars_uni($pm['subject']));

replace:
$privatemessage_text = $lang->sprintf($lang->newpm_notice_one, $user_text, $mybb->settings['bburl'], $pm['pmid'], htmlspecialchars_uni($pm['subject']));

find:
$privatemessage_text = $lang->sprintf($lang->newpm_notice_multiple, $mybb->user['pms_unread'], $user_text, $pm['pmid'], htmlspecialchars_uni($pm['subject']));

replace:
$privatemessage_text = $lang->sprintf($lang->newpm_notice_multiple, $mybb->user['pms_unread'], $user_text, $mybb->settings['bburl'], $pm['pmid'], htmlspecialchars_uni($pm['subject']));

then in inc/languages/english/global.lang.php

find:
$l['newpm_notice_multiple'] = "<strong>You have {1} unread private messages.</strong> The most recent is from {2} titled <a href=\"private.php?action=read&amp;pmid={3}\" style=\"font-weight: bold;\">{4}</a>";

replace:
$l['newpm_notice_multiple'] = "<strong>You have {1} unread private messages.</strong> The most recent is from {2} titled <a href=\"{3}/private.php?action=read&amp;pmid={4}\" style=\"font-weight: bold;\">{5}</a>";

find:
$l['newpm_notice_one'] = "<strong>You have one unread private message</strong> from {1} titled <a href=\"private.php?action=read&amp;pmid={2}\" style=\"font-weight: bold;\">{3}</a>";

replace:
$l['newpm_notice_one'] = "<strong>You have one unread private message</strong> from {1} titled <a href=\"{2}/private.php?action=read&amp;pmid={3}\" style=\"font-weight: bold;\">{4}</a>";

I think that is all the big changes needed
Lost interest, sold my sites, will browse here once in a while. It's been fun.
Reply
#2
thanks, did everything but images was and css was lost. only text and box were there. how can I set bburl to /forum?
Reply
#3
which images? does the CSS work on the forum and not the new home page, or all pages dont work? can you give me the URL?


I found one more change to make
in portal.php (now index.php in site root)

find:
$parser = new postParser;

add after:
global $theme;
$theme['imgdir'] = $forumdir.'/'.substr($theme['imgdir'],0);

<edit> this was added to the first post
Lost interest, sold my sites, will browse here once in a while. It's been fun.
Reply
#4
Thanks man! life saver! This is the missing step! See if I am doing it correct?the only problem now is the seo? should i put the htaccess in the root or forum folder? because when i click on one of the thread it cannot be found . so is the my username profile link
Reply
#5
put it in the root folder
I have asked the staff to move these posts so I don't clutter this thread. Once moved, I will clean it up and turn it into a regular tutorial

glad you got it working
Lost interest, sold my sites, will browse here once in a while. It's been fun.
Reply
#6
Yes this is helpful! i hope the staff will move these posts.

one more step.

the RewriteBase is not / anymore. i put RewriteBase /forum and workS!

thanks again!
It's not working anymore. pavemen see my site. you will know what i mean
Reply
#7
you need to change the ACP settings for Forum URL to include /forum now.
Lost interest, sold my sites, will browse here once in a while. It's been fun.
Reply
#8
thanks pavemen, now the theme is back but forum thread, user is loading 404. Do I have to change the htaccess setting? or ?
Reply
#9
I am not familiar with the Lightspeed server that you are using, so you may need to make a copy of your htaccess into the forum folder (but remove the rewritebase)
Lost interest, sold my sites, will browse here once in a while. It's been fun.
Reply
#10
any idea of how to set

forum.com/index.php
forum.com/portal/portal.php

?
Exclamation MyBB-Es.Com, spanish support for MyBB Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)