我有這樣的Perl腳本,我沒有寫(我也不能寫的Perl),插入一個退出鏈接,如果你登錄:插入CSS
sub print_loginform {
$web_content .= qq{
</form>
};
}
if ($logged_in_as) {
$addlink = '<a href="/logout">Logout</a><a href="/account/">My Account</a>';
}
$web_content .= qq{
<div id="menu">
<div id="menuheader">Menu</div>
<a href="/">Home</a>
<a href="/online/">Who's online?</a>
<a href="/highscores/">Highscores</a>
<a href="/rules/">Rules</a>
<a href="/about/">About</a>
<a href="/guilds/">Guilds</a>
<a href="/houses/">Houses</a>
<a href="/shop/">Donations</a>
<a href="/forum/">Forum</a>
<a href="/lost-password/">Lost Password</a>
<a href="/create-account/">Create Account</a>$addlink
<div id="menufooter"></div>
};
if (!$logged_in_as) {
&print_loginform();
}
$web_content .= "</div>";
會不會有一種方法當用戶登錄時添加一些內聯的css來做一些真正hacky的事情,只是display:none
loginpanel?
我嘗試這樣做:
if ($logged_in_as) {
$addlink = '<a href="/logout">Logout</a><a href="/account/">My Account</a>';
$removelogin = '<style type="text/css" media="screen">.loginpanel:display:none;</style>';
}
安全地說,它沒有工作,但因爲我不是一個Perl程序員我真的不能想出解決辦法,這是在黑暗中總共出手我,我甚至覺得自己有點不高興,甚至來求助。 我試圖在Perl上找到的文檔最多也很少。
這裏是馬修的代碼,這不工作(可能是我的錯)
sub print_loginform {
$web_content .= qq{
</form>
};
}
if ($logged_in_as) {
$addlink = '<a href="/logout">Logout</a><a href="/account/">My Account</a>';
}
$web_content .= qq{
<div id="menu">
<div id="menuheader">Menu</div>
<a href="/">Home</a>
<a href="/online/">Who's online?</a>
<a href="/highscores/">Highscores</a>
<a href="/rules/">Rules</a>
<a href="/about/">About RealOTS</a>
<a href="/guilds/">Guilds</a>
<a href="/houses/">Houses</a>
<a href="/shop/">Donations</a>
<a href="/forum/">Forum</a>
<a href="/lost-password/">Lost Password</a>
<a href="/create-account/">Create Account</a>$addlink
<div id="menufooter"></div>
<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</div>
<form method="POST" action="/character/">
<input type="hidden" name="page" value="character">
Character Search<input type="text" name="searchchar" value="" size=15><br><br>
<input type="submit" value="Look up">
</form>
};
if (!$logged_in_as) {
&print_loginform();
$web_content .= qq{<div class="loginpanel">
<form action="" method="POST">
<input type="hidden" name="auth" value="1">
Account Number:
<input type="text" name="user" value="" size=15>
Password:
<input type="password" name="pass" value="" size=15>
<input type="submit" name="submit" value="Login">
</div>
};
}
$web_content .= "</div>";
那會怎麼做? – andy 2013-05-09 05:47:52
它會使登錄面板只會在退出鏈接不存在時纔會出現。 – 2013-05-09 05:49:25
它不會工作我害怕,我會編輯我的第一篇文章,我替換 – andy 2013-05-09 06:04:01