Hello There, Guest! › Register

Hide Content 1.4 released.
Looking for a custom plugin for your site? Ask here for a quote.

Add javascript code to php

I want to edit the newpoint menu, but instead of adding a normal link to a page I want to add a javascript code that open a widget. Here is the edit I've done
PHP Code:
$menu[0] = '<a href="'.$mybb->settings['bburl'].'/newpoints.php">'.$lang->newpoints_home.'</a>';
if (
$mybb->settings['newpoints_main_statsvisible'] == 1)
$menu[1] = '<a href="'.$mybb->settings['bburl'].'/newpoints.php?action=stats">'.$lang->newpoints_statistics.'</a>';
if (
$mybb->settings['newpoints_main_donationsenabled'] == 1)
$menu[2] = '<a href="'.$mybb->settings['bburl'].'/newpoints.php?action=donate">'.$lang->newpoints_donate.'</a>';
$menu[3] = '<img src="http://yourdomain.com/image.gif" onclick="startGateway('NTUxMTU3');" />'

It seem javascript doesn't work on php pages, any solution?

That's simply the code that is being output to the screen. If the javascript is correct, it will work properly. The last line of code should be:
PHP Code:
$menu[3] = '<img src="http://yourdomain.com/image.gif" onclick="startGateway(\'NTUxMTU3\');" />'
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.

Users browsing this thread: 1 Guest(s)