Hello There, Guest! › Register

MySubscriptions 2.2 released.
Looking for a custom plugin for your site? Ask here for a quote.

Add javascript code to php
#1

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?
Reply
#2

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.
Reply




Users browsing this thread: 1 Guest(s)