Jump to content

New Toolbar Button: Does it accept PHP?


Cavadus

Recommended Posts

Hey all,

I created a new toolbar button which takes input from the user, so {{content}}, and uses it in a PHP var.  I need {{content}} to be a string so I set it like:

<?php
$s = "{{content}}";
$matches = array();
$result = preg_match('/i=(?P<iVal>[0-9]+)&l=(?P<lVal>[a-z0-9]+)$/siU', $s, $matches);
$url_string = "http://mwo.smurfy-net.de/tools/mechtooltip?i=".$matches['iVal']."&l=".$matches['lVal'];
$embed_html = '<iframe src="'.$url_string.'" width="750" height="300" border="0"></iframe>';
echo $embed_html;
?>

Here's an example URL of {{content}}:

http://mwo.smurfy-net.de/mechlab#i=16&l=6b0d928d20bf7c118ac50ff7fbe68cffae246976

I've tested this entire script in PHP sans the {{content}} part but using a variable set as string of the URL above and it works perfectly.

However, when I use the new button on my toolbar I always get the following error:

 

Quote

 

}"; $matches = array(); $result = preg_match('/i=(?P[0-9]+)&l=(?P[a-z0-9]+)$/siU', $s, $matches); $matches = array(); $result = preg_match('/i=(?P[0-9]+)&l=(?P[a-z0-9]+)$/siU', $s, $matches); $url_string = "http://mwo.smurfy-net.de/tools/mechtooltip?i=".$matches['iVal']."&l=".$matches['lVal']; $embed_html =

Quote

 

Not Found

The requested URL /comnet/'.$url_string.' was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

''; echo $embed_html; ?>

 

 

First of all, does the HTML block for the button accept PHP?  Secondly, why is IP.Board appending my forum path in front of the URL and also not using the $url_string variable properly?

Any help would be greatly appreciated!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...