Posted by request from [url=http://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=282264]Fridge[/url] in [url=http://www.phpbb.com/community/viewtopic.php?p=6543995#p6543995]this post[/url].
Basically this snippet creates a pop-up page. The contents of the pop-up is a pre-generated HTML link to your forum, which people can use to link to your board. The link automatically opens in a new window, using javascript to keep it XHTML valid The pop-up itself is based on the private message pop-up code
Create file: styles/prosilver/template/link_body.html
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
<head>
<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-language" content="{S_USER_LANG}" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="copyright" content="2000, 2002, 2005, 2007 phpBB Group" />
<meta name="keywords" content="" />
<meta name="description" content="" />
{META}
<title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title>
<script type="text/javascript">
// <![CDATA[
var onload_functions = new Array();
var onunload_functions = new Array();
/**
* New function for handling multiple calls to window.onload and window.unload by pentapenguin
*/
window.onload = function()
{
for (var i = 0; i < onload_functions.length; i++)
{
eval(onload_functions[i]);
}
}
window.onunload = function()
{
for (var i = 0; i < onunload_functions.length; i++)
{
eval(onunload_functions[i]);
}
}
// ]]>
</script>
<script type="text/javascript" src="{T_TEMPLATE_PATH}/styleswitcher.js"></script>
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
<link href="{T_THEME_PATH}/bidi.css" rel="stylesheet" type="text/css" media="screen, projection" />
<!-- ENDIF -->
<!-- DEFINE $POPUP = 1 -->
</head>
<body id="phpbb" class="{S_CONTENT_DIRECTION}">
<div id="simple-wrap">
<a id="top" name="top" accesskey="t"></a>
<div id="page-body">
<div class="panel">
<div class="inner"><span class="corners-top"><span></span></span>
<div class="content">
<h3>{L_LINK_US}</h3>
<p>{LINK_US_TXT}</p>
<input type="text" tabindex="1" size="90" value="{U_LINK_US}" class="inputbox autowidth" /><br /><br />
</div>
<span class="corners-bottom"><span></span></span></div>
</div>
</div>
<!--
We request you retain the full copyright notice below including the link to www.phpbb.com.
This not only gives respect to the large amount of time given freely by the developers
but also helps build interest, traffic and use of phpBB3. If you (honestly) cannot retain
the full copyright we ask you at least leave in place the "Powered by phpBB" line, with
"phpBB" linked to www.phpbb.com. If you refuse to include even this then support on our
forums may be affected.
The phpBB Group : 2006
//-->
</div>
</body>
</html>
Create file: link.php
Code: Select all
<?php
/**
*
* @package Link to Us page
* @version $Id: link.php,v 0001 22:34 28/04/2008 kenny Exp $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; // Remember and change this to refelct your site
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// Output page
page_header($user->lang['LINK_US']);
// Set the template for the page
$template->set_filenames(array(
'body' => 'link_body.html'
));
// Assign specific vars
$template->assign_vars(array(
'LINK_US_TXT' => sprintf($user->lang['LINK_US_TXT'], $config['sitename']),
'U_LINK_US' => htmlentities('<a href="' . generate_board_url() . '/" title="' . $config['site_desc'] . '">' . $config['sitename'] . '</a>'),
));
page_footer();
?>
includes/functions.php
Find:
Code: Select all
'L_INDEX' => $user->lang['FORUM_INDEX'],
AFTER, ADD:
Code: Select all
'U_LINK_US' => append_sid("{$phpbb_root_path}link.$phpEx"),
Change the append_sid value to reflect where on your server the linp.php file is. The above code assumes it's in your forums root folder.
language/en/common.php
FIND:
Code: Select all
'LEGEND' => 'Legend',
AFTER, ADD:
Code: Select all
'LINK_US' => 'Link to us',
'LINK_US_TXT' => 'Please feel free to link to <strong>%s</strong>. Use the following HTML:',
The code below is placed wherever you want the "Link to Us" text to display. The can be in your header, footer, index. It has to be in a phpBB template file though or it won't work. You could easily incorporate it into a custom phpBB page
Code: Select all
<div style="text-align: center;" id="link">
<a href="{U_LINK_US}" onclick="popup(this.href, 588, 218, '_linktous'); return false;" style="font-size: 13px;">{L_LINK_US}</a><br /></div>
The 2 numbers in popup code are the width & height respectively. Adjust these to your needs.
That should be it. I'll update this topic if there are any other changes