Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2006
Posts: 75
Power User
Power User
Offline
Joined: Sep 2006
Posts: 75
I want to have a different header on my ubbthreads.php and postlist.php than is on all other pages, such as myhome.php, newpost.php, etc. I've tried several ways of doing this, but I can't get it right. I've done a search of the forum, and don't see any other people having this problem, so I figure I'm having a brain seizure.

Any suggestions?

Sponsored Links
Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
POst what version you are using

Joined: Sep 2006
Posts: 75
Power User
Power User
Offline
Joined: Sep 2006
Posts: 75
Sorry ... 6.5.

Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
Hmm, ok I *think* I understand what you're after. You basically want a single custom header to be used on both ubbthreads.php and postlist.php (all forums). So for all those pages it will be identical, right?

Alright try the following:

In includes/ubbt.inc.php...

CHANGE THIS:

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


TO THIS:

Code
       // ---------------------------- <br />       // require the header.php file <br />         if ( ($script['2'] != "top") ) { <br />            if ( ($fheader) && ($PHP_SELF != "postlist.php") ) { <br />               $header = "header_$Board.php"; <br />            } <br />            elseif ( ((($fheader) || (!$fheader)) && ($PHP_SELF == "postlist.php")) || ($PHP_SELF == "ubbthreads.php")) { <br />               $header = "header_custom.php"; <br />            } <br />            else { <br />               $header = "header.php"; <br />            } <br />				if (!$debug) { <br />            	@include "$thispath/includes/$header"; <br />				} <br />         }  


Well that may not be the exact code in 6.5, but you get the idea

Of course, you'll need to create and upload to your includes folder a file named header_custom.php which will be used on those pages.

Be sure to lemme know how much gets screwed up

Joined: Sep 2006
Posts: 75
Power User
Power User
Offline
Joined: Sep 2006
Posts: 75
Excellent, thanks, Twisty. Your mod came close, but PHP_SELF had not been pulled from the environment. Here is the mod built on yours that worked for me.

ver 6.5
CHANGE THIS:

Code:
--------------------------------------------------------------------------------

// ----------------------------
// 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";
}
}

--------------------------------------------------------------------------------


TO THIS:

Code:
--------------------------------------------------------------------------------

// require the header.php file
if ( ($script['2'] != "top") ) {
$current_php_page = find_environmental ("PHP_SELF");
if ($fheader) {
$header = "header_$Board.php";
}
elseif ((!$fheader) && strstr($current_php_page, 'postlist.php')) {
$header = "header_custom.php";
}
elseif ((!$fheader) && strstr($current_php_page, 'ubbthreads.php')) {
$header = "header_custom.php";
}
else {
$header = "header.php";
}
if (!$debug) {
@include "$thispath/includes/$header";
}
}

--------------------------------------------------------------------------------

It's not the cleanest scripting, I know, but it will do for now.

Thanks again for your generous help!

Sponsored Links
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
What I forgot to do is add /ubbthreads/ before all the script names (silly mistake, I didn't test it). This method also requires globals to be enabled in php.ini as well (register_globals = on), and then it should work.

But your method will work too ie. doing a string search and using find_environmental


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)