单击用户名时,Perl CGI服务页面

时间:2016-10-30 03:16:41

标签: html perl cgi

所以我的程序会显示一个用户的个人资料(一个非常淡化的Facebook状态)并显示该人的朋友等。 我想让显示的用户名是一个打开用户个人资料的超链接。

所以说,

熊猫人 你好

UnfinishedSentenc 嘿嘿

我想这样做

Pandaria 你好

UnfinishedSentenc 嘿嘿

我现在有一些功能可以达到这个目的。

#
# Combine the various parts of the pages to return to
#

sub displaying {
    my $to_show = shift;
    if (defined $to_show){
        #prints the given user's profile
        print user_page($to_show);
        print user_posts($to_show);
    } else {
        #print starting from user 0
        print user_page();
        print user_posts();
        print next_button();
    }
}

我正在考虑使用<a href,如下所示

#
# Making the user mentioned linked to show it's profile page
#
sub link_user {
    my $ID = shift;
    my $username = id_name{$ID};
    return "<a href=\"displaying($ID)\"> $username</a>";
}

但它不起作用,因为它是一个外部链接,我需要它来调用显示$ ID作为输入参数的函数

感谢任何帮助,谢谢!

0 个答案:

没有答案