• 织梦(DEDECMS)首页调用相关投票的方法(自动更新)



    我使用的是 DEDECMS V5.3

    方法一

    此方法我没试过,但应该能行得通。

    dede投票模块在首页的调用

    本文介绍dedecms投票模块在首页的调用方法,大家可以参考写出更符合自己需要的效果。

    先来看dedecms默认模板里的投票模块在首页调用的代码:

       <!--投票调查-->
       <div class="rlist margintop">
            <form name='voteform' method='post' action='{dede:field name='phpurl'/}/vote.php' target='_blank'>
        <input type='hidden' name='dopost' value='send'>
        <input type='hidden' name='aid' value='1'>
        <input type='hidden' name='ismore' value='0'>
        <div class="title">你是从哪儿得知本站的?</div>
        <div class="rbox vote">
         <span><input name="voteitem" type="radio" value="1" />朋友介绍</span>
         <span><input name="voteitem" type="radio" value="2" />门户网站的搜索引擎</span>
         <span><input name="voteitem" type="radio" value="3" />Google或百度搜索 </span>
         <span><input name="voteitem" type="radio" value="4" />别的网站上的链接 </span>
         <span><input name="voteitem" type="radio" value="5" />其它途径 </span>
         <div class="votesubmit">
          <input type="submit" value="投票" class="submit" />
          <a href="{dede:field name='phpurl'/}/vote.php?dopost=view&aid=1">查看结果</a>
         </div>
        </div>
            </form>
       </div>
       <!--投票调查结束-->

    代码中从form开始即是表单区域,

    一般根据网站需要,需要修改的是选项(radio)里的 value属性,这个value属性是你在后台添加投票选项时对应的ID。

    方法二

    后台里,点击希望在主页调用的投票的“查看代码”,


      

    将代码替换/templets/default/index.htm文件里的如下代码:

        <div class="vote mt1">
          <dl class="tbox">
            <dt><strong>投票调查</strong></dt>

    <form name='voteform' method='post' action='/plus/vote.php' target='_blank'>
    <input type='hidden' name='dopost' value='send' />
    <input type='hidden' name='aid' value='1' />
    <input type='hidden' name='ismore' value='0' />
            <dd> <strong>你是从哪儿得知本站的?</strong>
                <div class="fb">
                  <input type="radio" name='voteitem' value='1' />
                  朋友介绍</div>
              <div class="fb">
                 <input type="radio" name='voteitem' value='2' />
                门户网站的搜索引擎</div>
              <div class="fb">
                <input type="radio" name='voteitem' value='3' />
                google或百度引擎</div>
              <div class="fb">
                <input type="radio" name='voteitem' value='4' />
                400电话网</div>
              <div class="fb">
                 <input type="radio" name='voteitem' value='5' />
                其他途径</div>
              <div class="submit">
                <button type="submit" class="btn-1">投票</button>
                <a href="plus/vote.php?dopost=view&aid=1">查看结果</a></div>
            </dd>
    </form>
          </dl>
        </div>

    此方法虽简便点,但效果不太美观

    PS:又鼓捣了一会,发现可将如上代码替换成:

        <!-- 以下为投票模块 -->
        <div class="vote mt1">
          <dl class="tbox">
            <dt><strong>投票调查</strong></dt>
              <form name='voteform' method='post' action='/plus/vote.php' target='_blank'>
               <input type='hidden' name='dopost' value='send' />
               <input type='hidden' name='aid' value='1' />
               <input type='hidden' name='ismore' value='0' />
                <dd>
                  <div class="fb">
    <!-- 以下粘贴投票代码 -->
                   {dede:vote id='2'}
                   {/dede:vote}
                   <br />
    <!-- 以上粘贴投票代码 -->
                  </div>
                </dd>
              </form>
          </dl>
        </div>

        <!-- 以上为投票模块 -->(http://www.my400800.cn/)

    这样,每次只要更改我用特殊字体标出的投票ID(见后台)“2”,便可实现首页投票模块更新。加个</br>换行符是为了匀称。

    更新完后记得要在后台更新主页HTML

    
  • 相关阅读:
    java虚拟机理解探索1
    Java线程面试题 Top 50(转载)
    (转载)浅谈我对DDD领域驱动设计的理解
    最大堆
    利用筛法求质数
    递归算法及优化
    java 根据传入的时间获取当前月的第一天的0点0分0秒和最后一天的23点59分59秒
    Uncaught Error: Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3
    mysql 子查询问题
    微信7.0以后更新后H5页面定位不准确
  • 原文地址:https://www.cnblogs.com/jishu/p/2048666.html
Copyright © 2020-2023  润新知