简体   繁体   English

php函数不起作用, <li> 无法呈现

[英]The php function doesnot work, the <li> cannot be presented

I put a function into the php file, I want to use this function to produce a list of "li" inside the 'ul'. 我将一个函数放到php文件中,我想使用此函数在'ul'内生成一个“ li”列表。 But the php function seems not work, the 'li' was not presented in the final html. 但是php函数似乎不起作用,最终的html中未显示“ li”。 Can somebody help me? 有人可以帮我吗? Thx a lot. 多谢。

<?php
<script type = "text/javascript"> 
 function view_side_lt() {
        global $_G, $postlist;
        $newlist = array();
        $list = '';
        if (is_array($postlist)) {
            foreach($postlist as $temp) {
                if ($temp['first'] == 1) {
                    $query = DB::query("SELECT tid, subject FROM ".DB::table('forum_thread').
                        "
                        where authorid = '".intval($temp['
                        authorid '])."'
                        and tid < > '".intval($temp['
                        tid '])."'
                        ORDER BY 'dateline'
                        DESC LIMIT ".intval(5);
                        while ($list_temp = DB::fetch($query)) {
                            $listli = '<li>
                                < a href = "forum.php?mod=viewthread&tid='.$list_temp['tid'].'"
                            title = "'.$list_temp['subject'].'
                            "target="
                            _blank ">'.cutstr($list_temp['subject'], 10, $dot = ' ...').'</a> </li>'
                        };
                        $newlist[] = '$listli'
                        return '$newlist';
                    }
                }
            }
        };
 </script>

  <ul class="clearfix">
               "{$newlist}"
 </ul>

 ?>

add some quotes and correct the <li> tag. 添加一些引号并更正<li>标记。

$listli = '<li><a href="forum.php?mod=viewthread&tid='.$list_temp['tid'].
    '" title="'.$list_temp['subject'].'" target="_blank ">'.
    cutstr($list_temp['subject'], 10, $dot = ' ...').'</a></li>';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM