dstm2014 2013-04-05 00:00
浏览 33

将JQuery放入PHP文件中

I am trying to put Jquery into a PHP file. I need to put a twitter feed that works perfectly when i put into a HTML file but I cant get it to work in my homepage.php file.

It is from this tutorial.

I have created the seperate javascript file and tried to echo the script but I am having no luck.

Here is the php file:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.twitter.feed.js"></script>

<script type="text/JavaScript">
    $(document).ready(function() {
        $('#twitter-feed').dcTwitterFeed({
            id: '#thepaulmac',
            tweetId: 'thepaulmac',
            retweets: false,
            replies: false,
            avatar: false,
            results: 20,
            images: 'small'
        });
    }); 

</script>


<?php get_header(); ?>
            <div id="twitter-feed"></div>

Does anyone know what I would have to do to get this to work?

I'd appreciate any help.

  • 写回答

2条回答 默认 最新

  • doumo2501 2013-04-05 00:06
    关注

    With php you can just add the html before the HTML link before

    <?php
    

    or after

    ?>
    

    and it will be interpreted it as normal HTML. Just use

    <script src="file goes here">
    

    to link the jquery script, and put you code in:

    <script></script>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器