Simple Machines Community Forum

Customizing SMF => Bridges and Integrations => Topic started by: Marook on September 05, 2007, 09:48:23 PM

Title: index.php?action=NEW ACTION ???
Post by: Marook on September 05, 2007, 09:48:23 PM
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

Title: Re: index.php?action=NEW ACTION ???
Post by: Dannii on September 05, 2007, 11:54:59 PM
Maybe try using the Custom Action mod (http://custom.simplemachines.org/mods/index.php?mod=331).
Title: Re: index.php?action=NEW ACTION ???
Post by: Marook on September 06, 2007, 12:34:40 PM
I dont want to use another mod just to include my script, i want to understand how does it works.
Title: action=NEW ACTION ???
Post by: Assistance on September 08, 2007, 03:41:11 PM
How to create custom 'action' (http://www.simplemachines.org/community/index.php?topic=23864.msg189057#msg189057)
by Owdy
Title: Re: index.php?action=NEW ACTION ???
Post by: Dragooon on September 09, 2007, 02:49:49 AM
Where did you placed the template file?
Title: Re: index.php?action=NEW ACTION ???
Post by: Marook on September 09, 2007, 03:13:57 AM
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....