1
fulconarrow
Displaying SMF in Xoops?

Hi gents,

I have a XOOPS website and recently moved away from phpbb as our host includes a supported forum in our package. With phpbb it would be displayed within the template. With SMF i know you need to include the mainfile, header and footer in the index.template.php file of the SMF theme.

Xoops is pirmarily on the website in the first directory, but SMF is installed in a secondary directory called Forum2. I need to put the include path php code in but i dont know where in the index.template.php to place them or exactly what paths to use.

SMF are struggling to solve this one, any help on this subject would be good. Here is my current code:

[code]
<?php
// Version: 1.1 RC1; 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 RC1';
}

// The main sub template above the content.

function template_main_above()

include("/home/soloel2/public_html/mainfile.php");
{
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="PHP, MySQL, bulletin, board, free, open, source, smf, simple, machines, forum" />
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?rc1"></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, '";
var smf_session_id = "', $context['session_id'], '";
// ]]></script>
<title>', $context['page_title'], '</title>';

// The ?rc1 part of this link is just here to make sure browsers don't cache it full of wronfulness.
echo '
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?rc1" />
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?rc1" 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);';

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

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

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

include("/home/soloel2/public_html/header.php");

echo'

<body style="margin-top: 7px; margin-bottom: 7px;"><table width="800" align="center" cellpadding="5" cellspacing="0" bgcolor="#161E38" style="background-image:url(', $settings['images_url'], '/middlebg.gif);"><tr><td width="100%" style="border: 1px solid black; padding-top: 5px"><table width="775" align="center" cellspacing="1" cellpadding="0">
<tr><td width="100%" style="border: 1px solid black;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="22" width="100%" style="background-image:url(', $settings['images_url'], '/cat.gif);" align="center" valign="middle"></td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td height="85" style="background-image:url(', $settings['images_url'], '/sapphheader.gif);" align="center" valign="bottom">
';

template_menu();
echo'
</td></tr></table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td height="22" width="100%" style="background-image:url(', $settings['images_url'], '/bottom.gif); padding-right: 15px;" align="right" valign="middle">
<a href="javascript:void(0);" 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'], '" style="margin: 2px 2ex 2px 0;" border="0" /></a>
</td></tr></table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="44" bgcolor="#26314a" style="background-image:url(', $settings['images_url'], '/background_top.gif); background-position: top; background-repeat: repeat-x; padding-top: 15px;" align="center">

<!-- this is a new table for the info boxes -->

<table width="100%" cellpadding="0" cellspacing="0"><tr id="upshrinkHeader"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '><td width="100%">
<table width="94%" align="center" cellpadding="0" cellspacing="0">
<td width="12" height="4"><img src="', $settings['images_url'], '/boxcornerleft.gif"/></td><td width="100%" style="background-image:url(', $settings['images_url'], '/boxcornergrad.gif);"></td><td width="12" height="4"><img src="', $settings['images_url'], '/boxcornertight.gif"/></td></tr></table>
<table width="94%" align="center" cellpadding="4" cellspacing="0" bgcolor="#151d32" style="padding-right: 10px; padding-left: 10px; border-left: 1px solid black; border-right: 1px solid black;">
<tr><td width="94%">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="85" height="22" align="left" valign="top"><img src="', $settings['images_url'], '/top_left.gif" width="85" height="22" alt=" " border="0" /></td>
<td width="100%" style="background-image:url(', $settings['images_url'], '/cat.gif);" align="center" valign="middle"><b>welcome to ',$context['forum_name'],'</b>
</td>
<td width="85" height="22" align="right" valign="top"><img src="', $settings['images_url'], '/top_right.gif" width="85" height="22" alt=" " border="0" /></td>
</tr>
</table>

<div class="tborder"><table border="0" width="100%" cellspacing="1" cellpadding="5">
<tr class="cat2">
<td width="50%" align="left" colspan="2"><font size="1">User Info</font></td>
<td width="50%" align="left"><font size="1">News</font></td>
</tr>
<tr>
<td class="windowbg2" rowspan="2"><img src="', $settings['images_url'], '/user.gif"/></td>
<td class="windowbg" align="left" width="50%">
';

// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td align="left">
<font size="1">

Logged in as <b>',$context['user']['name'],'</b> &nbsp; <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">[Logout]</a></font><br/>
';

// Only tell them about their messages if they can read their messages!
if ($context['allow_pm'])
echo '<a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt[153] : $txt[471], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'],'</td>
<td align="right">
<a href="', $scripturl, '?action=unread"><font size="1">Unread Posts</font></a><br/>
<a href="', $scripturl, '?action=unreadreplies"><font size="1">Unread Replies</font></a></td></tr></table>';
}
else
{
echo'
You are a guest. Please <a href="', $scripturl, '?action=login">login</a> or <a href="', $scripturl, '?action=register">register</a>.';
}

echo'

</td>
<td class="windowbg" align="left" width="50%">
',$context['random_news_line'],'
</td></tr>
<tr><td class="windowbg" align="left" width="100%" colspan="2">
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td align="left">
We have <b>', $context['common_stats']['total_posts'], '</b> ', $txt[95], ' ', $txt['smf88'], ' <b>', $context['common_stats']['total_topics'], '</b> ', $txt[64], ' ', $txt[525], '<b> ', $context['common_stats']['total_members'], '</b> ', $txt[19], '</td><td align="right">
Please welcome our newest member, ', $context['common_stats']['latest_member']['link'], '</td></tr></table>

</td></tr>
</table>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="85" height="22" align="left" valign="top"><img src="', $settings['images_url'], '/bot_left.gif" width="85" height="22" alt=" " border="0" /></td>
<td width="100%" style="background-image:url(', $settings['images_url'], '/bottom.gif);" align="center" valign="middle"></td>
<td width="85" height="22" align="right" valign="top"><img src="', $settings['images_url'], '/bot_right.gif" width="85" height="22" alt=" " border="0" /></td>
</tr>
</table>


</td></tr></table>


<table width="94%" align="center" cellpadding="0" cellspacing="0">
<td width="12" height="4"><img src="', $settings['images_url'], '/boxbottomcornerleft.gif"/></td><td width="100%" style="background-image:url(', $settings['images_url'], '/boxbottomcornergrad.gif);"></td><td width="12" height="4"><img src="', $settings['images_url'], '/boxbottomcornertight.gif"/></td></tr></table>
<table width="80%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="37" height="27"><img src="', $settings['images_url'], '/boxconnectors_left.gif"/></td><td width="100%">&nbsp;</td><td width="37" height="27"><img src="', $settings['images_url'], '/boxconnectors_right.gif"/></td></tr></table>
</td></tr></table>

<!-- done --></td></tr></table>
<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td bgcolor="#26314a" width="100%">

<table width="94%" align="center" cellpadding="0" cellspacing="0">
<td width="12" height="6"><img src="', $settings['images_url'], '/leftcorner.gif"/></td><td width="100%" style="background-image:url(', $settings['images_url'], '/bgcorner.gif);"></td><td width="12" height="6"><img src="', $settings['images_url'], '/rightcorner.gif"/></td></tr></table>
<table width="94%" cellpadding="0" cellspacing="0" border="0" align="center" bgcolor="#26314a"><tr>
<td id="bodyarea" style="padding: 1ex 20px 2ex 20px; border-right: 1px solid black; border-left: 1px solid black;">';
}

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

include("/home/soloel2/public_html/footer.php");

echo '</td>
</tr></table>
<table width="94%" align="center" cellpadding="0" cellspacing="0">
<td width="12" height="4"><img src="', $settings['images_url'], '/boxbottomcornerleft.gif"/></td><td width="100%" style="background-image:url(', $settings['images_url'], '/boxbottomcornergrad.gif);"></td><td width="12" height="4"><img src="', $settings['images_url'], '/boxbottomcornertight.gif"/></td></tr></table>
</td></tr></table>';

// 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" width="100%">
<tr>

<td valign="middle" align="center" style="white-space: nowrap;">
', theme_copyright(), '
</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>';

echo '
' , $context['user']['is_admin'] ? '<a href="index.php?action=admin">Go to Admin Center</a>' : '' , '
</div>
<table width="100%" bgcolor="#1B233E" cellpadding="5" cellspacing="0"><tr>
<td width="50%" align="left">
<a href="#"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/top.gif" border="0"/></a>
</td>
<td width="50%" align="right">Theme © by Tippmaster
</td></tr></table>

';

// 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 '
</td></tr></table></td></tr></table></body>


</html>'
}

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

// Show the [home] and [help] buttons.
echo '
<a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'], '
<a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

// How about the [search] button?
if ($context['allow_search'])
echo '
<a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];

// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '
<a href="', $scripturl, '?action=admin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin.gif" alt="' . $txt[2] . '" style="margin: 2px 0;" border="0" />' : $txt[2]), '</a>', $context['menu_separator'];

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '
<a href="', $scripturl, '?action=profile">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>', $context['menu_separator'];

// The [calendar]!
if ($context['allow_calendar'])
echo '
<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];

// If the user is a guest, show [login] and [register] buttons.
if ($context['user']['is_guest'])
{
echo '
<a href="', $scripturl, '?action=login">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/login.gif" alt="' . $txt[34] . '" style="margin: 2px 0;" border="0" />' : $txt[34]), '</a>', $context['menu_separator'], '
<a href="', $scripturl, '?action=register">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/register.gif" alt="' . $txt[97] . '" style="margin: 2px 0;" border="0" />' : $txt[97]), '</a>';
}
// Otherwise, they might want to [logout]...
else
echo '
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
}

?>
[code/]

2
fulconarrow
Re: Displaying SMF in Xoops?

Sorry i thought id better mention i only want this forum to display in the site, i dont want FULL intergration of usernames etc.

3
gediminasbyt
Re: Displaying SMF in Xoops?

Is iframe an option in your case or you need just a staticp link to you forum be displayed?

If an iframe just create an iframe block on your site.

4
fulconarrow
Re: Displaying SMF in Xoops?

Perfect 'idea@. Just tried it:http://www.solo-elite.com/modules/myiframe/index.php?iframeid=1 As you can see it works well but i want it to stretch the website template and NOT create scroll bars. I messed about with the margin settings etc but they didnt do anything. Will myiframe 1.4 be any better for this if so where can i download it?

Login

Who's Online

209 user(s) are online (134 user(s) are browsing Support Forums)


Members: 0


Guests: 209


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits