UBB.Dev
Posted By: Dalantech [6.2] Generic Header template mod - 01/11/2003 4:54 PM
What does it do? It allows you to use a "Threads like" template for you generic header.

Why would you care?: Because you can take advantage of the new $tbopen and $tbclose variables in Threads 6.2...

Who gets the props?: Me (But I also have to give a nod to JustDave )

Here is the script for your Generic Header:

Code
 <br /> <br /> <? <br /> <br />$html = new html; <br /> <br />// Grab the tablewrapper <br />list($tbopen,$tbclose) = $html -> table_wrapper(); <br /> <br />// Send the template <br />include("$thispath/templates/$tempstyle/header.tmpl"); <br /> <br />?> <br /> <br /> 


You also have to create a header.tmpl file and copy it to your ubbthreads/templates/default/ directory. Here is a simplified version of my header.tmpl file:

Code
 <br /> <? <br />echo <<<template <br /> <br />$tbopen <br /> <br /><tr> <br /><td class="darktable"> <br /><table border="0" cellpadding="0" cellspacing="0"> <br /> <br /><tr> <br />  <td class="logo-left"><img border="0" src="http://www.yourdomain.com/logo-clear.gif" width="250" height="60" /> <br /></td> <br /> <br /><td class="logo" width="100%" align="right"> <br /></td> <br /> <br /></tr> <br /> <br /></table> <br /></td> <br /></tr> <br /> <br />$tbclose <br /> <br /><br /> <br /> <br />template; <br />?> <br /> <br /> 


Since the last html tag in the tbopen.tmpl file is a table, all you have to do in your header.tmpl file after $tbopen is start out with a tr and a td tag.

The benefit to doing your header this way: If you ever change the tbopen or tbclose template files your header will automatically change...

P.S. Try this out on a forum header first. I have a test forum that I use to test new designs that only admins and mods can see.
Posted By: JustDave Re: Generic Header templte mod - 01/11/2003 5:44 PM
Sweet!

I got to playing and did things this way... (figures huh?)

In your ubbt.inc.php file around line 377 find this:

Code
<br />         // -------------------------------------------<br />         // Now require the registerednav.php template<br />            $html = new html;<br />            list($tbopen,$tbclose) = $this -> table_wrapper();<br />


and change it to this:

Code
<br />         // -------------------------------------------<br />         // Now require the registerednav.php template<br />



Around line 200 find this:

Code
<br />      if (isset($user['loggedout'])) {<br />         $loggedout = $user['loggedout'];<br />      }<br />


and change it to this:

Code
<br />      if (isset($user['loggedout'])) {<br />         $loggedout = $user['loggedout'];<br />      }<br />	  <br />      $html = new html;<br />      list($tbopen,$tbclose) = $this -> table_wrapper();<br />




Change your header.php file located in your includes directory to something like this:

Code
<br /><?<br />echo <<<UBBTPRINT<br />$tbopen<br /><tr><br /><td align="left" class="welcome"><br /><br />Your Logo Here. (or what ever)<br /></td><br /></tr><br />$tbclose<br />UBBTPRINT;<br />?><br />




Either way should work but this way will allow for forum specific headers to be used easily.
Posted By: Dalantech Re: Generic Header templte mod - 01/11/2003 5:49 PM
Very !
Posted By: Dalantech Re: Generic Header template mod - 01/21/2003 9:04 AM
JustDave,

I can't edit my original file. Would you please add [6.2] to the title of the first post? I forgot to do it, and this mod is Threads version specific. Thanks!
Posted By: omegatron Re: Generic Header template mod - 01/21/2003 1:20 PM
Nice work Dalantech love it!

However just a quick note to users who would download this hack. If you have software programs like Photopost integrated with Threads make sure to copy your header.php file over into the photopost directory and rename it something like header.html and call it from there. External programs will not read the $tbopen and $tbclose variables. I found out the hard way when I was scratching my head wondering why photopost was not working and remembered I applied this hack a day earlier. I think it worthwhile to go the extra step and do this hack as everything is going to templates eventually. Most programs will separate the code and html so in the future you will be able to integrate them directly again. It is nothing to copy the contents to a file named header.html when you have to make one names header.tmpl anyway.
Posted By: Dalantech Re: Generic Header template mod - 01/21/2003 2:08 PM
Did you try requiring the Threads library from within the photo posts php file? Not sure if it would work, but it might be worth a try.
Posted By: JustDave Re: Generic Header template mod - 01/21/2003 2:33 PM
I added this forum to the list of forums with unlimited edit time. You should be able to edit now.
Posted By: Dalantech Re: Generic Header template mod - 01/21/2003 3:29 PM


Done
Posted By: Dalantech Re: Generic Header templte mod - 01/21/2003 6:51 PM
I got to turning this whole thing over in my head, and as usual I was doing site design / scripting while I was driving home. This was one of theose days when I'm realy glad the car knew how to get home...

Since Threads alows for forum specific headers why not create a header for each forum using the php script that I put in the first post of this thread, but set it up so that it includes a different template for each forum. Since the graphics are set by CSS properties it would be a piece of cake to define different logos per forum (it would only require one new class per forum in every style sheet). Style sheet selection checking isn't needed in the header (it's obviously checked before the header includes).

So it's possible to have forum specific logos without any additional script hacking

When I get some more of that thing called time I'll set it up and show you what I mean
Posted By: omegatron Re: Generic Header templte mod - 01/21/2003 10:47 PM
Photopost is actually outside of Threads. I tried calling the threads library and it lets Photopost load without hanging like it did before. However it just bypasses the header. Until Photopost can read templates it is just as easy to make a html file.

Thought I would bring this up so people who run photopost know they need to hard code the header if they want to run this mod.

Posted By: Dalantech Re: Generic Header templte mod - 01/21/2003 11:52 PM
Bummer, cause I hate having to re-invent the wheel when I'm scripting a web site.

The custom error page that I have uses the table wrappers, calls the library, etc. and it is outside of Threads (I have it in web root on my server). Do you want a copy of my file?
Posted By: Mudpuppy Re: [6.2] Generic Header template mod - 01/25/2003 5:40 AM
How do I make my header image centered? I notice the example template references "td class="logo-left">" and "<td class="logo" width="100%" align="right">", but I'm not exactly sure how to modify these things to center my image. I've tried different combinations of code I think *might* work, but they don't.

Thanks for the hand-holding
Posted By: Dalantech Re: [6.2] Generic Header template mod - 01/25/2003 9:13 AM
I included a simplified version of my logo just so you could see how the templates work. The easiest way to get started is just to strip the opening and closing table tags from your current logo html and then cut and paste what's left into this template:

Code
<? <br />echo <<<template<br />$tbopen   <br /> <br />//Put your logo html minus the first<br />//and last table tags after this line<br />//________________________________<br /><br /><br />//Now let's finish the template<br /><br />$tbclose<br /><br /><br /><br /><br />template;<br />?><br />


That should get you started
Posted By: RandyJG Re: [6.2] Generic Header template mod - 04/28/2003 9:16 AM
Great.

I just added the template code that would be in the tmpl into the header itself instead.
Posted By: Dalantech Re: [6.2] Generic Header template mod - 04/28/2003 10:30 AM
That also works provided you include

Code
 <br />// Grab the tablewrapper<br />$html = new html;<br />list($tbopen,$tbclose) = $html -> table_wrapper();<br /> 


before you try to use $tbopen and $tbclose
Posted By: Dalantech Re: [6.2] Generic Header template mod - 04/28/2003 10:59 AM
This mod works for UBB Threads 6.3
© UBB.Developers