html随机取用文件段落 织梦案例分享


   <!--- 段首随机 html嵌套php语言----> 

 {dede:php} 

$str = substr($aid,-3); //通过文章序号后两位取随机数字

$str1 = (int)$str;  //转化为数字

$f='http://www.qzkj365.com/dsdw/tongyongds.txt';   //文件名  随机段落放这个里面

$a=file($f);  //把文件的所有内容获取到数组里面

echo $a[$str1]; 打印输出随机段落或者代码

{/dede:php}

 <!--- 段首随机----> 

原文章模板文件


<!DOCTYPE HTML>

<html>

<head>

<meta charset="UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=11,IE=10,IE=9,IE=8">

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">

<meta http-equiv="Cache-Control" content="no-siteapp">

<title>{dede:field.title/}_{dede:global.cfg_webname/}</title>

<meta name="keywords" content="{dede:field.keywords/}" />

<meta name="description" content="{dede:field.description function='html2text(@me)'/}" />

<link rel='stylesheet' id='da-bootstrap-css'  href='/skin/css/bootstrap.css' type='text/css' media='all' />

<link rel='stylesheet' id='da-fontawesome-css'  href='/skin/css/font-awesome.min.css' type='text/css' media='all' />

<link rel='stylesheet' id='da-main-css'  href='/skin/css/main.css' type='text/css' media='all' />

<!--[if lt IE 9]><script src="/kaifadou/templets/bitcoin/js/html5.min.js"></script><![endif]-->

<style>

.pagination {

line-height: 17px;

}

.pagination a {

text-decoration: none;

}

</style>

</head>

<body class="single single-post postid-6221 single-format-standard comment-open">

{dede:include filename="head.htm"/}

<section class="container">

  <div class="content-wrap">

    <div class="content">

      <header class="article-header">

        <h1 class="article-title">{dede:field.title/}</h1>

        <div class="article-meta"> <span class="item">{dede:field.pubdate function="MyDate('Y-m-d',@me)"/}</span> <span class="item">分类:{dede:type}<a href="[field:typelink /]" target="_blank">[field:typename /]</a>{/dede:type}</span> <span class="item post-views" id="vvclick">阅读(<script src="{dede:field name='phpurl'/}/count.php?view=yes&aid={dede:field name='id'/}&mid={dede:field name='mid'/}" type='text/javascript' language="javascript"></script>)</span> </div>

      </header>

      <article class="article-content">

        <div class="ads ads-post ads-post-01"><script src='/plus/ad_js.php?aid=7' language='javascript'></script></div>

         <h3>I、教育和学习讲究很多的方式方法,升学择业,选校择师关系着同学的将来和人生,今天就{dede:field.title/}的问题整理,顺便为大家带来一些相关学习方法和选校择业的方法经验,希望能够帮助到大家</h3>

         <!--- 段首随机 html嵌套php语言----> 

 {dede:php} 

$str = substr($aid,-3); //通过文章序号后两位取随机数字

$str1 = (int)$str;  //转化为数字

$f='http://www.qzkj365.com/dsdw/tongyongds.txt';   //文件名  随机段落放这个里面

$a=file($f);  //把文件的所有内容获取到数组里面

echo $a[$str1]; 打印输出随机段落或者代码

{/dede:php}

 <!--- 段首随机----> 

        <h3>II、{dede:field.title/}话题的详细解答:</h3>

        {dede:field.body/}

        <h3>III、{dede:field.title/}相关的拓展了解,学无止境,多读多看多学,见多识广,学到老活到老</h3>

    <!---短尾随机--->

         {dede:php}

$str = substr($aid,-3);

$str1 = (int)$str;

$f='http://www.qzkj365.com/dsdw/tongyongdw.txt';   //文件名

$a=file($f);  //把文件的所有内容获取到数组里面

echo $a[$str1];

echo '<br>';

{/dede:php}

 <!---dwsj---->

        <p class="post-copyright">郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。</p>

      </article>

      <div class="article-tags">标签:

        {dede:tag row='3' sort='new'} <a href='[field:link/]' target='_blank'>[field:tag /]</a> {/dede:tag} </div>

      <div class="ads ads-post ads-post-02"> 

        <script src='/plus/ad_js.php?aid=8' language='javascript'></script> 

      </div>

      <div class="relates">

        <div class="title">

          <h3>相关文章阅读</h3>

        </div>

        <div class="article_hot_box">

          <dl>

            {dede:likearticle titlelen='45' row='4' flag='p' limit='0,4'}

            <dt><a href="[field:arcurl/]"><img class="lazy" alt="[field:title /]" src="[field:litpic/]"><span>[field:title /]</span></a></dt>

            {/dede:likearticle}

          </dl>

        </div>

        <ul>

          {dede:likearticle titlelen='60' row='8' limit='4,8'}

          <li><a href="[field:arcurl/]">[field:title /]</a></li>

          {/dede:likearticle}

        </ul>

      </div>

      <!--<a name="comments" id="comments"></a>

      <div id="SOHUCS" ></div>

      <script charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/changyan.js" ></script> 

      <script type="text/javascript">

window.changyan.api.config({

appid: 'cyrbiKxmG',

conf: 'prod_8e11cfb50c20f2a0b31d59926e9e42c7'

});

</script> --> 

    </div>

  </div>

  {dede:include filename="right.htm"/} </section>

{dede:include filename="footer.htm"/}

 <!-- 仿复制代码--> 

  <script language="Javascript">

  document.oncontextmenu=new Function(”event.returnValue=false;”)document.onselectstart=new Function(”event.returnValue=false;”)

  topmargin=”0″ oncontextmenu=”return false” ondragstart=”return false” onselectstart =”return false” onselect=”document.selection.empty()” oncopy=”document.selection.empty()” onbeforecopy=”return false” onmouseup=”document.selection.empty()”

document.oncontextmenu=new Function("event.returnValue=false");

document.onselectstart=new Function("event.returnValue=false");

</script>

   <!-- 仿复制代码--> 

</body>

</html>




评论 (0)

暂无评论