Master-T
05-25-2007, 12:22 AM
How to add javascript into PHP
How would I make this work?
eg:
Lets say I have this javascript:
<a href="search.htm" onClick="return overlay(this, 'subcontent2', 'rightbottom')">login</a>
and I want to add it into this PHP:
<?php
// Are they a guest?
if ($context['user']['is_guest'])
{
// Show a login box...
// Uncomment below to show login box
// ssi_login();
// ... and a little notice about registering
echo '
Welcome, <b>Guest</b>, Please **THE JAVASCRIPT HERE** or';
echo '
<a href="', $scripturl, '?action=register">register</a>';
}
// Otherwise, a user here :)
else
{
// Show them a nice welcome notice
ssi_welcome();
echo ' ';
// And a logout link
ssi_logout("#");
}
?>
How would I make this work?
eg:
Lets say I have this javascript:
<a href="search.htm" onClick="return overlay(this, 'subcontent2', 'rightbottom')">login</a>
and I want to add it into this PHP:
<?php
// Are they a guest?
if ($context['user']['is_guest'])
{
// Show a login box...
// Uncomment below to show login box
// ssi_login();
// ... and a little notice about registering
echo '
Welcome, <b>Guest</b>, Please **THE JAVASCRIPT HERE** or';
echo '
<a href="', $scripturl, '?action=register">register</a>';
}
// Otherwise, a user here :)
else
{
// Show them a nice welcome notice
ssi_welcome();
echo ' ';
// And a logout link
ssi_logout("#");
}
?>