index.php?action=NEW ACTION ???

Started by Marook, September 05, 2007, 09:48:23 PM

Previous topic - Next topic

Marook

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

SMF Rulez ;) | Meet me home ! | My Mods

Dannii

"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

Marook

I dont want to use another mod just to include my script, i want to understand how does it works.
SMF Rulez ;) | Meet me home ! | My Mods


Dragooon

Where did you placed the template file?

Marook

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....
SMF Rulez ;) | Meet me home ! | My Mods

Advertisement: