Hi, i want to integrate a small link submitting script. I modified the index.php of my SMF 1.1.3 like this, i added :
'xlinks' => array('Xlinks.php', 'Xlinks'),
where the other actions are defined.
I added a Xlinks.php with this content:
<?php
/**********************************************************************************
* xlinks.php *
***********************************************************************************
*/
// If not called by SMF, it's bad!
if (!defined('SMF'))
die('Hacking attempt...');
function Xlinks()
{
global $boarddir, $context, $txt, $modSettings;
// global $db_server, $db_user, $db_passwd, $db_name, $db_prefix;
$context['sub_template'] = 'xlinks_main';
loadTemplate('Xlinks');
}
?>
and finally i made a (pseudo) template like this :
<?php
function template_xlinks_main()
{
global $txt, $boarddir, $context;
// Wrap this in a table (for the nice-looking heading).
echo '
<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
<tr class="titlebg">
<td>Link Database</td>
</tr>
<tr>
<td class="windowbg">';
require($boarddir . '/xlinks/index.php');
echo '
</td>
</tr>
</table>';
}
?>
I moved my link submitting script inside the smf root directory (..htdocs/smf/xlinks/). The script should appear below the new fader inside the forum. If i call "index.php?action=xlinks" i get an error, because the link script could not find its own config.php inside the xlinks directory.
Quote
Fatal error: require() [function.require]: Failed opening required './config.php' (include_path='.;\xampp\php\pear\') in E:\xampp\htdocs\smf\xlinks\include\head.php on line 59
Anyone who can help me ?? Greetz Marook
Maybe try using the Custom Action mod (http://custom.simplemachines.org/mods/index.php?mod=331).
I dont want to use another mod just to include my script, i want to understand how does it works.
How to create custom 'action' (http://www.simplemachines.org/community/index.php?topic=23864.msg189057#msg189057)
by Owdy
Where did you placed the template file?
in \Themes\Default\ is the template placed, i tried to copy the config.php from my script dir into the root of smf. After that the browser returned "Page could not loaded" but it seems to work, after i deleted the config.php the first smf-error appeared....