在PHP帖子中使用Twitter linkify
我对PHP和JavaScript非常陌生,我制作了一个PHP发布脚本,我想将twitter linkify添加到用户名中。我把javascript放在头上,但没有运气。我随波逐流,但就是不能让它工作。以下是我的PHP:在PHP帖子中使用Twitter linkify,php,javascript,twitter,linkify,Php,Javascript,Twitter,Linkify,我对PHP和JavaScript非常陌生,我制作了一个PHP发布脚本,我想将twitter linkify添加到用户名中。我把javascript放在头上,但没有运气。我随波逐流,但就是不能让它工作。以下是我的PHP: <form align="center" method='post' action='add.php'> <p>Your status:</p> <textarea name='body' rows='5' cols='4
<form align="center" method='post' action='add.php'>
<p>Your status:</p>
<textarea name='body' rows='5' cols='40' wrap=VIRTUAL></textarea>
<p> What color is a banana? (lowercase) </p>
<input type="text" class="blah" name="age" />
<input align="center" type="submit" class="submit" value="Post" disabled="disabled"/>
</form>
<script type="text/javascript">
$('.blah').change(function() {
$(".submit").attr('disabled', $(this).val() != "yellow");
}).change();
</script>
<?php
$posts = show_posts($_SESSION['userid']);
if (count($posts)){
?>
<table class="imagetable">
<table align="center" border='0' cellspacing='0' cellpadding='5' width='300'>
<?php
foreach ($posts as $key => $list){
echo "<tr valign='middle'>\n";
echo "<td>".$list['body'] ."<br/>\n ";
echo "<small>".$list['stamp'] ."</small><hr></td>\n";
echo "</tr>\n";
}
?>
</table>
<?php
}else{
?>
<p><b>You haven't posted anything yet!</b></p>
<?php
}
?>
</body>
</html>
您的身份:
香蕉是什么颜色的?(小写)
$('.blah').change(函数(){
$(“.submit”).attr('disabled',$(this.val()!=“yellow”);
}).change();
你还没有发布任何东西
这在
中:
twttr.任意位置(功能(T){
T.linkifyUsers();
});
那么,是否有人输入了“Hi@stackoverflow”@stackoverflow将链接到Twitter个人资料页面?欢迎使用PHP
在使用之前,您需要将Twitter JavaScript库包含到页面中
像这样:
<script src="http://platform.twitter.com/anywhere.js?id=YOUR_API_KEY&v=1" type="text/javascript"></script>
- 请参阅第页以了解如何获取API密钥
- 请参阅第页以了解有关任何位置的更多信息
- 欢迎使用PHP
在使用之前,您需要将Twitter JavaScript库包含到页面中
像这样:
<script src="http://platform.twitter.com/anywhere.js?id=YOUR_API_KEY&v=1" type="text/javascript"></script>
- 请参阅第页以了解如何获取API密钥
- 请参阅第页以了解有关任何位置的更多信息