如何调用PHP函数?

如何调用PHP函数?,php,function,authentication,drupal,Php,Function,Authentication,Drupal,如何将此函数调用到我希望表单显示的HTML页面I <?php function login_bar() { global $user; if ($user->uid == 0) { $form = drupal_get_form('horizontal_login_block'); return render($form); } else {

如何将此函数调用到我希望表单显示的HTML页面I

<?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页面不会处理PHP调用。将页面更改为page.php,然后调用
login_bar()

在HTML页面的
表单
标记中:

<form type="post" action="test.php">

文件test.php


我正在尝试定制一个drupal 7模板。听起来你是在围绕drupal进行黑客攻击,而不是充分利用它的潜力。我建议您阅读一本关于Drupal站点构建主题的基础知识的书或观看一些视频。@deceze函数返回html,因此应该是
print login_bar()
<?php
    function login_bar() {
    }

    // If you want to call the function on some button click:

    if (isset($_POST['submit']))
    {
        login_bar();
    }
?>