UBB.Dev
Posted By: FlamingoWorld Use forum menu on rest of site? - 08/18/2003 5:55 AM
I searched and couldn't find the answer, so sorry if this has been answered before.
I would like to include the forum menu that is under my header on the forums on the other non-forum pages of my site.
What do I need to put on those pages to make the menu show? I do want to make sure it shows the logged in/not logged in menu like it does in the forums.
I already have cookies set for site-wide.
Posted By: JoshPet Re: Use forum menu on rest of site? - 08/18/2003 6:17 AM
This is what you need:

https://www.ubbdev.com/forum/showflat.php?Board=modifications&Number=81311
Posted By: FlamingoWorld Re: Use forum menu on rest of site? - 08/18/2003 6:31 AM
Not quite Josh. I am looking for a few lines of code I can use to put on my pages I already have to include the menu. I don't want to have to re-make all of my existing pages.
I was hoping there was a simple include I could use.
I want the menu without the header part.
Posted By: JoshPet Re: Use forum menu on rest of site? - 08/18/2003 6:56 AM
Ah - the menu bar is part of the "send_header" function in threads... so you'd have to send threads headers to use it.

Including the template for the menu bar wouldnt' work, as most of the stuff is defined in the send_header function.

That hack is pretty much what you need....

in essence requiring the main.inc.php file and using send_header

But that'll get you the whole threads header.
Posted By: FlamingoWorld Re: Use forum menu on rest of site? - 08/18/2003 7:01 AM
Thanks Josh, Maybe I will have to modify the forum headers to make it work sitewide and replace just my page headers on my site instead of changing the whole set of pages.
Posted By: JoshPet Re: Use forum menu on rest of site? - 08/18/2003 7:31 AM
This is a bit complicated....

But you could add some "ifs" to the ubbt.inc.php send_header function so it won't output the header template etc.....

I think this would work.


Code
<br />In ubbt.inc.php Find this:<br /><br /><br />       if (!$debug) {<br />	       include("$thispath/templates/$tempstyle/ubbt_header.tmpl");<br />       }<br /><br /><br /><br />and change to this:<br /><br />       if ((!$debug) && (!$config['navonly'])) {<br />	       include("$thispath/templates/$tempstyle/ubbt_header.tmpl");<br />       }<br /><br />




Then in your generic page (which has to be PHP) you'd require main, and call the header, but we'll pass the 'navonly' variable so it skips the regular header template.

Like this



Code
<br /><br /><br />require("/whatever/path/ubbthreads/main.inc.php");<br />$config['navonly'] = 1;<br />$html = new html;<br />$html -> send_header("Title of Your Page");<br /><br />



I think that'll do the trick.
Posted By: FlamingoWorld Re: Use forum menu on rest of site? - 08/18/2003 7:50 AM
Didn't work Josh, I checked for mistakes but I did It just like you said.

Here is the result I got.
http://www.flamingoworld.com/testing.php

Is it possible changes need to be made further down where you find this:

// Let's see if we need to print out the nav menu
$What = find_environmental("SCRIPT_NAME");
$script['0'] = "";
preg_match ("/(.*)\/(.*).php/",$What,$script);
$What = $script['2'];
if ( ($script['2'] == 'top') || (!preg_match("/\/admin$/",$script['1']) )) {

// ----------------------------
// require the header.php file
if ( ($script['2'] != "top") ) {
if ($fheader) {
$header = "header_$Board.php";
}else {
$header = "header.php";
}
if (!$debug) {
@include "$thispath/includes/$header";
}
}

I know that if you don't have anything in your includes/header.php file you just get the nav, so is there anyway to make a header2.php file and have it call that instead for what I want to use it for?
Posted By: JoshPet Re: Use forum menu on rest of site? - 08/18/2003 8:03 AM
Sounds like we just need to exclude that as well.

Change this:

Code
<br /> if (!$debug) {<br />@include "$thispath/includes/$header";<br />} 



To this:
Code
<br /> if ((!$debug) && (!$config['navonly'])) {<br />@include "$thispath/includes/$header";<br />}<br />


I think that'll do it.
Posted By: FlamingoWorld Re: Use forum menu on rest of site? - 08/18/2003 8:20 AM
Thanks Josh, so very, very, very much! That did it! Thanks more than words can say! You are the greatest!
Posted By: JoshPet Re: Use forum menu on rest of site? - 08/18/2003 8:39 AM
he he

Thought it would be more complicated.... then I wrapped my head around it and it was actually kinda simple.

Glad it worked for you.
Posted By: FlamingoWorld Re: Use forum menu on rest of site? - 08/18/2003 8:43 AM
I am sure there will be other people that could use this too, maybe you should put it in the mods forum.

Wish I could be able to think about technical things more clearly this late at night! You are great!
© UBB.Developers