如何在要显示表单的HTML页面上调用此函数?
<?php
function login_bar() {
global $user;
if ($user->uid == 0) {
$form = drupal_get_form('horizontal_login_block');
return render($form);
}
else {
// You can also integrate other modules such as private
// messages to show unread / read messages here.
return '<div id="loginbar"><p>' .
t('Welcome back ') .
ucwords($user->name) .
'<p></div>';
}
}
?>
在HTML页面的表单标签中
<form type="post" action="test.php">
// test.php
<?php
function login_bar() {
}
//如果要在某个按钮上调用该函数,请单击
if(isset($_POST['submit']))
{
login_bar();
}
?>
HTML页面不会处理PHP调用。将页面更改为page.php,然后调用login_bar();
。