[SMF 1.1.x] Integrating the forum into your site using SMF\'s layer system

Started by Daniel15, January 27, 2007, 02:49:11 AM

Previous topic - Next topic

Hafdís

hi...again
i am just not getting this, first of all, my language is Icelandic, so i am trying to understand this, do i edit those files in admin panel of the board,  ??? if someone can guide me thru this in easy English  :D please
this is my page http://www.koddinn.com [nofollow] and my forum is located here http://www.koddinn.com/spjallid [nofollow]
Enjoy your life, while you are here

TheBSG

wouldn't it be possible to use a PHP include in the website, and include the template html file?  Currently, my site can't be so easily split into headers and footers.

Also, is this going to carry the SMF headers and footers over?

davomex

my case is different all of these stuffs looks strange though i have a minimal understanding of html and am not tota;lly strange to the use but i have a forum domain on its own bought for smf hosting and installed with fantastico but need to change the feel and colour and them and logo an many things what do i do since am not interested in putting my forum on an exosting sitr but its a site on its own

sniderz

Okay so I am having issues trying this over at www.sniderz.com

As of right now I am using iframes which are sucking big time.

Will I be able to do this with my current wordpress site. Basically I would like to get rid of the sidebars and put the forums under the blue adsense bar and have the existing footer there also.

If anyone is willing to help me out, please PM me here , I am also on itzsniderwork on AIM

Thanks

Hafdís

Enjoy your life, while you are here

onfulltilt

I just used this tutorial and it worked great, at least once I registered for this site and was able to see the attached file (until then I was banging my head against the table). 

There is one little thing that's bugging me.  For some reason there's a bit of a gap between the top of the page and my header on all the forum pages. 

I'm sure the fix is very easy to spot but for some reason I can't find what's behind this.  Maybe it's just late over here and my brain is working poorly.

Anyway, the my forum is located at:  http://www.svdogpark.org/community/ [nofollow] if anyone can take a look at it and let me know what's going on with the gap at the top.  If you go to any of the non-forum pages on the site you will be able to see what I'm talking about.

Thanks

Daniel15

Quote from: sniderz on March 06, 2007, 03:19:23 PM
Okay so I am having issues trying this over at www.sniderz.com

As of right now I am using iframes which are sucking big time.

Will I be able to do this with my current wordpress site. Basically I would like to get rid of the sidebars and put the forums under the blue adsense bar and have the existing footer there also.

If anyone is willing to help me out, please PM me here , I am also on itzsniderwork on AIM

Thanks
It looks like you've started to work on this... Do you need any further help?

Quote from: Hafdís on February 28, 2007, 03:23:55 PM
hi...again
i am just not getting this, first of all, my language is Icelandic, so i am trying to understand this, do i edit those files in admin panel of the board,  ??? if someone can guide me thru this in easy English  :D please
this is my page http://www.koddinn.com and my forum is located here http://www.koddinn.com/spjallid
You need to edit the files via FTP.
I tried to make it simple to understand, but I guess it's not all that simple... What sections are you having trouble with?

Quote from: onfulltilt on March 13, 2007, 03:45:39 AM
There is one little thing that's bugging me.  For some reason there's a bit of a gap between the top of the page and my header on all the forum pages. 
Your forum appears correctly for me, without a gap (Opera 9.10, Ubuntu Linux 6.10).
Are you using Internet Explorer 6? IE sometimes seems to add gaps, and I don't really know how to fix it (its box model is screwed up :P)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

onfulltilt

I'm actually using IE 7 and Firefox 1.5.  The gap is showing up in both browsers.  I guess this is something I can live with but was just hoping it was going to be a quick and simple fix.  Thanks for taking a look at this so quickly.
Alex

Xaneth

Nice tutorial Daniel.  I remember reading the thread, and implementing, "how to integrate the forum into your website" some time back, but this tutorial is laid out well, and everything works off of your first post.  I did have some issues with an error "unable to load site_above" when executing the SQL script to add the field into my theme, but I was able to work around it by calling the header.php within index.template.php like so:

</head>
<body>';
// Put your header stuff here
   // The following line loads the header.php file"
   include('header.php');

Xaneth

Quote from: onfulltilt on March 13, 2007, 04:36:38 AM
I'm actually using IE 7 and Firefox 1.5.  The gap is showing up in both browsers.  I guess this is something I can live with but was just hoping it was going to be a quick and simple fix.  Thanks for taking a look at this so quickly.
Alex

I also have the gap, seeing what I can do to fix it, and once I find out, I'll post.

Jungle-Cat

Im trying to use this layers concept to my advantage, all i want to use is the area you have labeled as "content"

How would i go about this? im studying the index.template.php atm, but i cant seem to work it out.

help wiuld be greatly appreciated

BluesDog

Hello,

My site has two side panels in addition to the header and footer:

(blah, blah, blah, therefore i have special circumstances which don't seem to be addressed here... pls accept apologies for stupid question... reference my next post, below.)

Regarding the gap at the top of the page:

QuoteI'm actually using IE 7 and Firefox 1.5.&nbsp; The gap is showing up in both browsers.&nbsp; I guess this is something I can live with but was just hoping it was going to be a quick and simple fix.&nbsp; Thanks for taking a look at this so quickly.
Alex
I tried everything i could think of including zeroing body margins and padding in the template. I have no idea where the gap comes from.

I set a -10px margin on my header:

<div id="header" style="margin-top:-10px;">

...inline to over-ride the 0px margin in my stylesheet. It's dirty but seems to work in IE and FF. OTOH i haven't looked at it in Opera yet to know if my header went off the page.&nbsp; :-\

Thanks,
-jb


BluesDog

D'OH!

Quote from: daniel15 on January 27, 2007, 02:49:11 AM
Essentially, a layer is simply two sub-templates, one that goes above the content, and another that goes below the content.

OK, but the thing is that i'm not really stupid, even if i might ask a stupid question, and if i can get confused then so can anyone else.

So for future reference, i'll note that Daniel15 meant exactly what he said, so it doesn't matter (too much, usually, i think), where your content goes. If you want the forum to go where your content normally is, then:
Header.php is everything from immediately below your <body> tag, up to and including the opening tag of your main content. It doesn't matter, (too much, usually, i think), whether your content usually goes in a div or a table cell.
and,
Footer.php is everything from and including your closing content tag, down to immediately before the closing </body> tag.

Works like a charm for me, everywhere except... *sigh*... IE6.

Could someone PLEASE help me with one last thing?


#wrapper{
width:98%;
margin: 0px auto 0px auto;
}
#header{
margin: 0px auto 0px 155px;
}
#left{
width: 150px;
float: left;
margin-top: -80px;
}
#right{
width: 175px;
float: right;
margin: 10px 0px 0px 0px;
}
#content{
margin: 10px 190px 10px 155px;
}
#footer{
height: 66px;
clear: both;
}

AND:

<!-- HEADER.PHP -->
<div id="wrapper" style="margin-top:-10px;">
<div id="header">
<h1><img src="../img/img.png" /></h1>
</div>
<div id="navcontainer">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<!-- nav -->
</div>
<div id="left">
<h2>
<img src="../img/img.png" />
</h2>
</div>
<div id="right">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img src="../img/img.png" />
</div>
<div id="content">


<!-- FOOTER.PHP -->
</div>
<div id="footer">
<p id="footer">
&copy; 2007 Some Guy &trade; LLC
</p>
</div>
</div>


In IE6, tables start at the end of the left sidebar content, wherever that may be. IOW they absolutely refuse to sit at the top of my content area unless i clear the 100% widths.

--> Where the heck are the actual posts located? I've cleared the width values from every table in the theme template, but in the forum display the posts are in a <div id="bodyarea"> which i can't find anywhere.

Any less destructive suggestions are also welcome... i'm not sure this is the best way, and anyway some tables i want to stretch all the way across the content area.

Thanks again,
-jb

PS In regards my dirty fix for the gap at top of page...(style="margin-top:-10px")... i checked in IE5.5 and Opera 9.02, so i can safely say that it works fine in every browser i have.





BluesDog

Once more in regards the "gap" at top of page:

The theme stylesheet has padding values on the <body> tag. So e.g. to disappear the gap at top, zero the 12px value.

-jb

lanB

I have just had a go at your tutorial from the first posting and managed to get it all working, its exactly what I need.
All I have to do now is play with the layout and CSS (that's the easy bit!) :) There is only about 30 pages from my original site to edit... :(

I did notice in your index.template.php file a strange bit of code...
Quote// The main content should go here.
   echo '
   <div id="bodyarea" style="padding: 1ex 0px 2ex 0px;">';

what is ex? should it be px?

cheers

lanB

See previous post.
I have just found a problem.
I have set up the menu links at the top of the page.
When I log out of the forum they disappear, although they are still there on other pages.
So there is no way to navigate on the site from the forum

ItalicVisions

Hi there nice tutorial but im having trouble trying to comapre the version you used to the one im using. My index.template.php is  Version: 1.1 RC2 I thought they would be almost identical but that isn't the case here. Would it be possible to have you split this for me? I know thats probably asking allot but it would be appreciated.  :)

<?php
// Version: 1.1 RC2; index

/* This template is, perhaps, the most important template in the theme. It
contains the main template layer that displays the header and footer of
the forum, namely with main_above and main_below. It also contains the
menu sub template, which appropriately displays the menu; the init sub
template, which is there to set the theme up; (init can be missing.) and
the linktree sub template, which sorts out the link tree.

The init sub template should load any data and set any hardcoded options.

The main_above sub template is what is shown above the main content, and
should contain anything that should be shown up there.

The main_below sub template, conversely, is shown after the main content.
It should probably contain the copyright statement and some other things.

The linktree sub template should display the link tree, using the data
in the $context['linktree'] variable.

The menu sub template should display all the relevant buttons the user
wants and or needs.

For more information on the templating system, please see the site at:
http://www.simplemachines.org/
*/

// Initialize the template... mainly little settings.
function template_init()
{
global $context$settings$options$txt;

/* Use images from default theme when using templates from the default theme?
if this is 'always', images from the default theme will be used.
if this is 'defaults', images from the default theme will only be used with default templates.
if this is 'never' or isn't set at all, images from the default theme will not be used. */
$settings['use_default_images'] = 'never';

/* What document type definition is being used? (for font size and other issues.)
'xhtml' for an XHTML 1.0 document type definition.
'html' for an HTML 4.01 document type definition. */
$settings['doctype'] = 'xhtml';

/* The version this template/theme is for.
This should probably be the version of SMF it was created for. */
$settings['theme_version'] = '1.1 RC2';

/* Set a setting that tells the theme that it can render the tabs. */
$settings['use_tabs'] = true;

/* Use plain buttons - as oppossed to text buttons? */
$settings['use_buttons'] = true;

/* Show sticky and lock status seperate from topic icons? */
$settings['seperate_sticky_lock'] = true;
}

// The main sub template above the content.
function template_main_above()
{
global $context$settings$options$scripturl$txt$modSettings;

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"'
$context['right_to_left'] ? ' dir="rtl"' '''><head>
<meta http-equiv="Content-Type" content="text/html; charset='
$context['character_set'], '" />
<meta name="description" content="'
$context['page_title'], '" />
<meta name="keywords" content="graphics, grafix, grafics, how to, free, tutorial, tutorials, fireworks, photoshop, paint.net, tips" />
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/script.js?rc2p"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "'
$settings['theme_url'], '";
var smf_images_url = "'
$settings['images_url'], '";
var smf_scripturl = "'
$scripturl'";
// ]]></script>
<title>'
$context['page_title'], '</title>';

// The ?rc2 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/style.css?rc2" />
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/print.css?rc2" media="print" />';

/* Internet Explorer 4/5 and Opera 6 just don't do font sizes properly. (they are big...)
Thus, in Internet Explorer 4, 5, and Opera 6 this will show fonts one size smaller than usual.
Note that this is affected by whether IE 6 is in standards compliance mode.. if not, it will also be big.
Standards compliance mode happens when you use xhtml... */
if ($context['browser']['needs_size_fix'])
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/fonts-compat.css" />';

// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="'
$scripturl'?action=help" target="_blank" />
<link rel="search" href="' 
$scripturl '?action=search" />
<link rel="contents" href="'
$scripturl'" />';

// If RSS feeds are enabled, advertise the presence of one.
if (!empty($modSettings['xmlnews_enable']))
echo '
<link rel="alternate" type="application/rss+xml" title="'
$context['forum_name'], ' - RSS" href="'$scripturl'?type=rss;action=.xml" />';

// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']))
echo '
<link rel="prev" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=prev" />
<link rel="next" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=next" />';

// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
<link rel="index" href="' 
$scripturl '?board=' $context['current_board'] . '.0" />';

// We'll have to use the cookie to remember the header...
if ($context['user']['is_guest'])
$options['collapse_header'] = !empty($_COOKIE['upshrink']);

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'], '

<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header = '
, empty($options['collapse_header']) ? 'false' 'true'';

function shrinkHeader(mode)
{'
;

// Guests don't have theme options!!
if ($context['user']['is_guest'])
echo '
document.cookie = "upshrink=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink").src = smf_images_url + (mode ? "/upshrink2.gif" : "/upshrink.gif");

document.getElementById("upshrinkHeader").style.display = mode ? "none" : "";
document.getElementById("upshrinkHeader2").style.display = mode ? "none" : "";

current_header = mode;
}
// ]]></script>'
;

// the routine for the info center upshrink
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var current_header_ic = '
, empty($options['collapse_header_ic']) ? 'false' 'true'';

function shrinkHeaderIC(mode)
{'
;

if ($context['user']['is_guest'])
echo '
document.cookie = "upshrinkIC=" + (mode ? 1 : 0);'
;
else
echo '
smf_setThemeOption("collapse_header_ic", mode ? 1 : 0, null, "'
$context['session_id'], '");';

echo '
document.getElementById("upshrink_ic").src = smf_images_url + (mode ? "/expand.gif" : "/collapse.gif");

document.getElementById("upshrinkHeaderIC").style.display = mode ? "none" : "";

current_header_ic = mode;
}
// ]]></script>
</head>
<body>'
;

echo '
<div class="tborder" '
$context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' style="width: 100%;"' '''>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="catbg" height="32">'
;

if (empty($settings['header_logo_url']))
echo '
<span style="font-family: Verdana, sans-serif; font-size: 140%; ">'
$context['forum_name'], '</span>';
else
echo '
<img src="'
$settings['header_logo_url'], '" style="margin: 4px;" alt="'$context['forum_name'], '" />';

echo '
</td>
<td align="right" class="catbg">
<img src="'
$settings['images_url'], '/smflogo.gif" style="margin: 2px;" alt="" />
</td>
</tr>
</table>'
;


// display user name
echo '
<table width="100%" cellpadding="0" cellspacing="0" border="0" >
<tr>'
;

if($context['user']['is_logged'])
echo '
<td class="titlebg2" height="32">
<span style="font-size: 130%;"> '
$txt['hello_member_ndt'], ' <b>'$context['user']['name'] , '</b></span>
</td>'
;

// display the time
echo '
<td class="titlebg2" height="32" align="right">
<span class="smalltext">' 
$context['current_time'], '</span>';

// this is the upshrink button for the user info section
echo '
<a href="#" onclick="shrinkHeader(!current_header); return false;"><img id="upshrink" src="'
$settings['images_url'], '/', empty($options['collapse_header']) ? 'upshrink.gif' 'upshrink2.gif''" alt="*" title="'$txt['upshrink_description'], '" align="bottom" style="margin: 0 1ex;" /></a>
</td>
</tr>
<tr id="upshrinkHeader"'
, empty($options['collapse_header']) ? '' ' style="display: none;"''>
<td valign="top" colspan="2">
<table width="100%" class="bordercolor" cellpadding="8" cellspacing="1" border="0" style="margin-top: 1px;">
<tr>'
;

if (!empty($context['user']['avatar']))
echo '
<td class="windowbg" valign="middle">'
$context['user']['avatar']['image'], '</td>';

echo '
<td colspan="2" width="100%" valign="top" class="windowbg2"><span class="middletext">'
;

// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
<a href="'
$scripturl'?action=unread">'$txt['unread_since_visit'], '</a> <br />
<a href="'
$scripturl'?action=unreadreplies">'$txt['show_unread_replies'], '</a><br />';

}
// Otherwise they're a guest - send them a lovely greating...
else
echo $txt['welcome_guest'];

// Now, onto our second set of info, are they logged in again?
if ($context['user']['is_logged'])
{
// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '
<b>'
$txt[616], '</b><br />';

// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '
'
$context['unapproved_members'] == $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="'$scripturl'?action=viewmembers;sa=browse;type=approve">'$context['unapproved_members'] == $txt['approve_member'] : $context['unapproved_members'] . ' ' $txt['approve_members'], '</a> '$txt['approve_members_waiting'], '<br />';

// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
'
$txt['totalTimeLogged1'];

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
}
echo ' </span>';
}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
else
{
echo '
<script language="JavaScript" type="text/javascript" src="'
$settings['default_theme_url'], '/sha1.js"></script>

<form action="'
$scripturl'?action=login2" method="post" class="middletext" style="margin: 3px 1ex 1px 0;"', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' $context['session_id'] . '\');"' '''>
<input type="text" name="user" size="10" /> <input type="password" name="passwrd" size="10" />
<select name="cookielength">
<option value="60">'
$txt['smf53'], '</option>
<option value="1440">'
$txt['smf47'], '</option>
<option value="10080">'
$txt['smf48'], '</option>
<option value="302400">'
$txt['smf49'], '</option>
<option value="-1" selected="selected">'
$txt['smf50'], '</option>
</select>
<input type="submit" value="'
$txt[34], '" /><br />
<span class="middletext">'
$txt['smf52'], '</span>
<input type="hidden" name="hash_passwrd" value="" />
</form>'
;
}

echo '
</td>
</tr>
</table>
</td>
</tr>
</table>'
;

echo '
<table id="upshrinkHeader2"'
, empty($options['collapse_header']) ? '' ' style="display: none;"'' width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>'
;

// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '
<td width="90%" class="titlebg2">
<span class="smalltext"><b>'
$txt[102], '</b>: '$context['random_news_line'], '</span>
</td>'
;
echo '
<td class="titlebg2" align="right" nowrap="nowrap" valign="top">
<form action="'
$scripturl'?action=search2" method="post" style="margin: 0;">
<a href="'
$scripturl'?action=search;advanced"><img src="'.$settings['images_url'].'/filter.gif" align="middle" style="margin: 0 1ex;" alt="" /></a>
<input type="text" name="search" value="" style="width: 190px;" />&nbsp;
<input type="submit" name="submit" value="'
$txt[182], '" style="width: 11ex;" />
<input type="hidden" name="advanced" value="0" />'
;

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="'
$context['current_topic'], '" />';

// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd['
$context['current_board'], ']" value="'$context['current_board'], '" />';

echo '
</form>
</td>
</tr>
</table>
</div>'
;


// Show the menu here, according to the menu sub template.
template_menu();


// The main content should go here.
echo '
<div id="bodyarea" style="padding: 1ex 0px 2ex 0px;">'
;
}

function 
template_main_below()
{
global $context$settings$options$scripturl$txt;

echo '
</div>'
;

// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
echo '

<div id="footerarea" style="text-align: center; padding-bottom: 1ex;'
$context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? ' width: 100%;' '''">
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
function smfFooterHighlight(element, value)
{
element.src = smf_images_url + "/" + (value ? "h_" : "") + element.id + ".gif";
}
// ]]></script>
<table cellspacing="0" cellpadding="3" border="0" align="center" width="100%">
<tr>
<td width="28%" valign="middle" align="'
, !$context['right_to_left'] ? 'right' 'left''">
<a href="http://www.mysql.com/" target="_blank"><img id="powered-mysql" src="'
$settings['images_url'], '/powered-mysql.gif" alt="'$txt['powered_by_mysql'], '" width="54" height="20" style="margin: 5px 16px;" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
<a href="http://www.php.net/" target="_blank"><img id="powered-php" src="'
$settings['images_url'], '/powered-php.gif" alt="'$txt['powered_by_php'], '" width="54" height="20" style="margin: 5px 16px;" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
</td>
<td valign="middle" align="center" style="white-space: nowrap;">
'
theme_copyright(), '
</td>
<td width="28%" valign="middle" align="'
, !$context['right_to_left'] ? 'left' 'right''">
<a href="http://validator.w3.org/check/referer" target="_blank"><img id="valid-xhtml10" src="'
$settings['images_url'], '/valid-xhtml10.gif" alt="'$txt['valid_xhtml'], '" width="54" height="20" style="margin: 5px 16px;" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer" target="_blank"><img id="valid-css" src="'
$settings['images_url'], '/valid-css.gif" alt="'$txt['valid_css'], '" width="54" height="20" style="margin: 5px 16px;" onmouseover="smfFooterHighlight(this, true);" onmouseout="smfFooterHighlight(this, false);" /></a>
</td>
</tr>
</table>'
;

// Show the load time?
if ($context['show_load_time'])
echo '
<span class="smalltext">'
$txt['smf301'], $context['load_time'], $txt['smf302'], $context['load_queries'], $txt['smf302b'], '</span>';

if (isset($context['ob_googlebot_stats']))
echo '
<br /><br /><span class="smalltext">'
$txt['ob_googlebot_stats_lastvisit'], timeformat($context['ob_googlebot_stats']['Googlebot']['lastvisit']), '</span>';

// This is an interesting bug in Internet Explorer AND Safari. Rather annoying, it makes overflows just not tall enough.
if (($context['browser']['is_ie'] && !$context['browser']['is_ie4']) || $context['browser']['is_mac_ie'] || $context['browser']['is_safari'])
{
// The purpose of this code is to fix the height of overflow: auto div blocks, because IE can't figure it out for itself.
echo '
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA['
;

// Unfortunately, Safari does not have a "getComputedStyle" implementation yet, so we have to just do it to code...
if ($context['browser']['is_safari'])
echo '
window.addEventListener("load", smf_codeFix, false);

function smf_codeFix()
{
var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");

for (var i = 0; i < codeFix.length; i++)
{
if ((codeFix[i].className == "code" || codeFix[i].className == "post" || codeFix[i].className == "signature") && codeFix[i].offsetHeight < 20)
codeFix[i].style.height = (codeFix[i].offsetHeight + 20) + "px";
}
}'
;
else
echo '
var window_oldOnload = window.onload;
window.onload = smf_codeFix;

function smf_codeFix()
{
var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");

for (var i = codeFix.length - 1; i > 0; i--)
{
if (codeFix[i].currentStyle.overflow == "auto" && (codeFix[i].currentStyle.height == "" || codeFix[i].currentStyle.height == "auto") && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0) && (codeFix[i].offsetHeight != 0 || codeFix[i].className == "code"))
codeFix[i].style.height = (codeFix[i].offsetHeight + 36) + "px";
}

if (window_oldOnload)
{
window_oldOnload();
window_oldOnload = null;
}
}'
;

echo '
// ]]></script>'
;
}

echo '
</div>
</body></html>'
;
}

// Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
global $context$settings$options;

echo '<div class="nav" style="font-size: smaller; margin-bottom: 2ex; margin-top: 2ex;">';

// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['linktree'] as $link_num => $tree)
{
// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'];

// Show the link, including a URL if it should have one.
echo '<b>'$settings['linktree_link'] && isset($tree['url']) ? '<a href="' $tree['url'] . '" class="nav">' $tree['name'] . '</a>' $tree['name'], '</b>';

// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];

// Don't show a separator for the last one.
if ($link_num != count($context['linktree']) - 1)
echo '&nbsp;>&nbsp;';
}

echo '</div>';
}

// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context$settings$options$scripturl$txt;

// Work out where we currently are.
$current_action 'home';
if (in_array($context['current_action'], array('admin''ban''boardrecount''cleanperms''detailedversion''dumpdb''featuresettings''featuresettings2''findmember''maintain''manageattachments''manageboards''managecalendar''managesearch''membergroups''modlog''news''optimizetables''packageget''packages''permissions''pgdownload''postsettings''regcenter''repairboards''reports''serversettings''serversettings2''smileys''viewErrorLog''viewmembers')))
$current_action 'admin';
if (in_array($context['current_action'], array('links','staff','contact','search''admin''calendar''profile''mlist''register''login''help''pm')))
$current_action $context['current_action'];
if ($context['current_action'] == 'search2')
$current_action 'search';
if ($context['current_action'] == 'theme')
$current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' 'profile' 'admin';

// Are we using right-to-left orientation?
if ($context['right_to_left'])
{
$first 'last';
$last 'first';
}
else
{
$first 'first';
$last 'last';
}

// Show the start of the tab section.
echo '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;">
<tr>
<td class="maintab_' 
$first '">&nbsp;</td>';

// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'home' 'active_back' 'back' '">
<a href="'
$scripturl'">' $txt[103] , '</a>
</td>' 
$current_action == 'home' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// Show the [help] button.
echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'help' 'active_back' 'back' '">
<a href="'
$scripturl'?action=help">' $txt[119] , '</a>
</td>' 
$current_action == 'help' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// How about the [search] button?
if ($context['allow_search'])
echo ($current_action == 'search' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'search' 'active_back' 'back' '">
<a href="'
$scripturl'?action=search">' $txt[182] , '</a>
</td>' 
$current_action == 'search' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo ($current_action == 'admin' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'admin' 'active_back' 'back' '">
<a href="'
$scripturl'?action=admin">' $txt[2] , '</a>
</td>' 
$current_action == 'admin' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo ($current_action == 'profile' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'profile' 'active_back' 'back' '">
<a href="'
$scripturl'?action=profile">' $txt[79] , '</a>
</td>' 
$current_action == 'profile' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// The [member map]
echo ($current_action == 'mm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'mm' 'active_back' 'back' '">
<a href="'
$scripturl'?action=mm">' $txt['mm_mm'] , '</a>
</td>' 
$current_action == 'mm' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'pm' 'active_back' 'back' '">
<a href="'
$scripturl'?action=pm">' $txt['pm_short'] , ' '$context['user']['unread_messages'] > '[<strong>'$context['user']['unread_messages'] . '</strong>]' '' '</a>
</td>' 
$current_action == 'pm' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// The [calendar]!
if ($context['allow_calendar'])
echo ($current_action == 'calendar' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'calendar' 'active_back' 'back' '">
<a href="'
$scripturl'?action=calendar">' $txt['calendar24'] , '</a>
</td>' 
$current_action == 'calendar' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// the [member] list button
if ($context['allow_memberlist'])
echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'mlist' 'active_back' 'back' '">
<a href="'
$scripturl'?action=mlist">' $txt[331] , '</a>
</td>' 
$current_action == 'mlist' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// the [links] button
if ($context['allow_view_smflinks'])
echo ($current_action == 'links' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'links' 'active_back' 'back' '">
<a href="'
$scripturl'?action=links">' $txt['smflinks_menu']  , '</a>
</td>' 
$current_action == 'links' '<td class="maintab_active_' $last '">&nbsp;</td>' '';


// the [staff list] button
if ($context['allow_view_stafflist'])
echo ($current_action == 'staff' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'staff' 'active_back' 'back' '">
<a href="'
$scripturl'?action=staff">' $txt['smfstaff_stafflist']  , '</a>
</td>' 
$current_action == 'staff' '<td class="maintab_active_' $last '">&nbsp;</td>' '';


// the [contact] button
if ($context['allow_view_contact'])
echo ($current_action == 'contact' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'contact' 'active_back' 'back' '">
<a href="'
$scripturl'?action=contact">' $txt['smfcontact_contact']  , '</a>
</td>' 
$current_action == 'contact' '<td class="maintab_active_' $last '">&nbsp;</td>' '';



// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo ($current_action == 'login' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'login' 'active_back' 'back' '">
<a href="'
$scripturl'?action=login">' $txt[34] , '</a>
</td>' 
$current_action == 'login' '<td class="maintab_active_' $last '">&nbsp;</td>' '';


// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo ($current_action == 'register' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'register' 'active_back' 'back' '">
<a href="'
$scripturl'?action=register">' $txt[97] , '</a>
</td>' 
$current_action == 'register' '<td class="maintab_active_' $last '">&nbsp;</td>' '';


// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo ($current_action == 'logout' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' $first '">&nbsp;</td>' '' '
<td valign="top" class="maintab_' 
$current_action == 'logout' 'active_back' 'back' '">
<a href="'
$scripturl'?action=logout;sesc='$context['session_id'], '">' $txt[108] , '</a>
</td>' 
$current_action == 'logout' '<td class="maintab_active_' $last '">&nbsp;</td>' '';

// The end of tab section.
echo '
<td class="maintab_' 
$last '">&nbsp;</td>
</tr>
</table>'
;

}

// Generate a strip of buttons.
function template_button_strip($button_strip$direction 'top'$force_reset false$custom_td '')
{
global $settings$buttons$context$txt$scripturl;

// Create the buttons...
foreach ($button_strip as $key => $value)
{
if (isset($value['test']) && empty($context[$value['test']]))
{
unset($button_strip[$key]);
continue;
}
elseif (!isset($buttons[$key]) || $force_reset)
$buttons[$key] = '<a href="' $value['url'] . '" ' .( isset($value['custom']) ? $value['custom'] : '') . '>' $txt[$value['text']] . '</a>';

$button_strip[$key] = $buttons[$key];
}

if (empty($button_strip))
return '<td>&nbsp;</td>';

echo '
<td class="'
$direction == 'top' 'main' 'mirror''tab_' $context['right_to_left'] ? 'last' 'first' '">&nbsp;</td>
<td class="'
$direction == 'top' 'main' 'mirror''tab_back">'implode(' &nbsp;|&nbsp; '$button_strip) , '</td>
<td class="'
$direction == 'top' 'main' 'mirror''tab_' $context['right_to_left'] ? 'first' 'last' '">&nbsp;</td>';
}

?>



Wal-Mart Security

Quote from: BluesDog on April 13, 2007, 04:31:16 PM
D'OH!

Quote from: daniel15 on January 27, 2007, 02:49:11 AM
Essentially, a layer is simply two sub-templates, one that goes above the content, and another that goes below the content.

OK, but the thing is that i'm not really stupid, even if i might ask a stupid question, and if i can get confused then so can anyone else.

So for future reference, i'll note that Daniel15 meant exactly what he said, so it doesn't matter (too much, usually, i think), where your content goes. If you want the forum to go where your content normally is, then:
Header.php is everything from immediately below your <body> tag, up to and including the opening tag of your main content. It doesn't matter, (too much, usually, i think), whether your content usually goes in a div or a table cell.
and,
Footer.php is everything from and including your closing content tag, down to immediately before the closing </body> tag.

Works like a charm for me, everywhere except... *sigh*... IE6.

Could someone PLEASE help me with one last thing?


#wrapper{
width:98%;
margin: 0px auto 0px auto;
}
#header{
margin: 0px auto 0px 155px;
}
#left{
width: 150px;
float: left;
margin-top: -80px;
}
#right{
width: 175px;
float: right;
margin: 10px 0px 0px 0px;
}
#content{
margin: 10px 190px 10px 155px;
}
#footer{
height: 66px;
clear: both;
}

AND:

<!-- HEADER.PHP -->
<div id="wrapper" style="margin-top:-10px;">
<div id="header">
<h1><img src="../img/img.png" /></h1>
</div>
<div id="navcontainer">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<!-- nav -->
</div>
<div id="left">
<h2>
<img src="../img/img.png" />
</h2>
</div>
<div id="right">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<img src="../img/img.png" />
</div>
<div id="content">


<!-- FOOTER.PHP -->
</div>
<div id="footer">
<p id="footer">
&copy; 2007 Some Guy &trade; LLC
</p>
</div>
</div>


In IE6, tables start at the end of the left sidebar content, wherever that may be. IOW they absolutely refuse to sit at the top of my content area unless i clear the 100% widths.

--> Where the heck are the actual posts located? I've cleared the width values from every table in the theme template, but in the forum display the posts are in a <div id="bodyarea"> which i can't find anywhere.

Any less destructive suggestions are also welcome... i'm not sure this is the best way, and anyway some tables i want to stretch all the way across the content area.

Thanks again,
-jb

PS In regards my dirty fix for the gap at top of page...(style="margin-top:-10px")... i checked in IE5.5 and Opera 9.02, so i can safely say that it works fine in every browser i have.






To fix your posts problem, try copying your display.php from the default template in to your custom template.  That fixed it for me :)
Achilleus Technologies
Ace Gaming Syndicate
PART TIME SMF CHARTER MEMBER 4LIFE

SMF slays phpbb, puts it in an IPB coffin, and buries them both with the ashes of vBulletin.

spottedhog

I like the concept presented here, but I have a question I have yet to see asked....  If I wanted to incorporate a few CMS type modules using the index.template.php file posted here, could I also copy over the SMF main index.php file?  In other words, is it possible to use the index.php file in the root directory, then place SMF in a subfolder, which also contains the same or original index.php file?

I am thinking if the default action was changed in this code at the bottom of the index.php file:      
// Fall through to the board index then...
require_once($sourcedir . '/BoardIndex.php');
return 'BoardIndex';


...to something like modules.php for example, and if the CMS modules were modified to be a series of actions and subactions, then a CMS could possibly be incorporated into SMF.  Of course the main actions would be put in the "monstous array" and then subactions created within each CMS module.

Along those thoughts, the header.php could be a CMS template_menu for links to the modules, etc.  Admin of those modules could be included in a new category section on the SMF admin page.  Language files could be modified to the SMF style.

Would having 2 of the SMF index.php files cause problems?

hhhhhmmmmmmmmm......  More thoughts...............  Could the SMF index.php file be moved to the root directory and still drive the forum along with some converted/modified CMS modules?  From what I can see, the only change to the SMF index.php file would be changing this:
// Load the settings...
require_once(dirname(__FILE__) . '/Settings.php');


to this:
// Load the settings...
require_once(dirname(__FILE__) . '/Forums/Settings.php');


All the other calls are set to $sourcedir.

###########  --- just ignore the ramblings above   :P  ---  #################

hhhhmmmmmmmmmmmm.......  thinking even further  (better mark this day down on the calendar ;) )

Instead of moving the index.php and modifying the Settings.php location, maybe just modifying the BoardIndex.php default to say..... Modules.php, then adding a button in the template_menu function to go to "?action=BoardIndex" should have nearly the same end result. (would probably need to add BoardIndex.php to the "montrous array")  Then the CMS converted modules would be Mods for SMF.

sooooo, is what I just stated feasible and/or totally insane?

if(feasible)
result{numerous possibilities...}

....thanks in advance,

Advertisement: