gpt4 book ai didi

Javascript list.js 到此 php 代码

转载 作者:行者123 更新时间:2023-11-30 12:51:47 24 4
gpt4 key购买 nike

我喜欢来自 www.listjs.com 的脚本 list.js .它似乎非常适合搜索和过滤下面的 php 文件的输出,但我可以让它工作,我只需要添加 7 行左右的代码但它不起作用。谁能告诉我怎么来的?谢谢

我添加的代码突出显示

<?php
defined('_JEXEC') or die();
?>
**<script type="text/javascript" src="list.js"></script>**
<form action="<?php echo CRoute::getURI(); ?>" method="post" id="jomsForm" name="jomsForm" class="community-form-validate">
<div class="jsProfileType" **id="jsProfileType"**>
**<input class="search" placeholder="Search" />
<button class="sort" data-sort="label">
Sort
</button>**
<ul class="unstyled">
<?php
foreach($profileTypes as $profile)
{
?>
<li class="space-12">

<label for="profile-<?php echo $profile->id;?>" class="radio">
<input id="profile-<?php echo $profile->id;?>" type="radio" value="<?php echo $profile->id;?>" name="profileType" <?php echo $default == $profile->id ? ' disabled CHECKED' :'';?> />
<strong class="bold"><?php echo $profile->name;?></strong>
</label>
<?php if( $profile->approvals ){?>
<span class="help-block"><?php echo JText::_('COM_COMMUNITY_REQUIRE_APPROVAL');?></span>
<?php } ?>

<span class="help-block">
<?php
$profile->description = JHTML::_('content.prepare',$profile->description);
echo $profile->description;?>
</span>

<?php if( $default == $profile->id ){?>
<em><?php echo JText::_('COM_COMMUNITY_ALREADY_USING_THIS_PROFILE_TYPE');?></em>
<?php } ?>



</li>
<?php
}
?>
</ul>
</div>
<?php if( (count($profileTypes) == 1 && $profileTypes[0]->id != $default) || count($profileTypes) > 1 ){?>
<div style="margin-top: 5px;">
<?php if( $showNotice ){ ?>
<span style="color: red;font-weight:700;"><?php echo JText::_('COM_COMMUNITY_NOTE');?>:</span>
<span><?php echo $message;?></span>
<?php } ?>
</div>
**<script>
var options = {
list: "space-12"
};
var userList = new List('jsProfileType', options);
</script>**
<table class="ccontentTable paramlist" cellspacing="1" cellpadding="0">
<tbody>
<tr>
<td class="paramlist_key" style="text-align:left">
<div id="cwin-wait" style="display:none;"></div>
<input class="btn btn-primary validateSubmit" type="submit" id="btnSubmit" value="<?php echo JText::_('COM_COMMUNITY_NEXT'); ?>" name="submit">
</td>
<td class="paramlist_value">

</td>
</tr>
</tbody>
</table>
<?php } ?>
<input type="hidden" name="id" value="0" />
<input type="hidden" name="gid" value="0" />
<input type="hidden" id="authenticate" name="authenticate" value="0" />
<input type="hidden" id="authkey" name="authkey" value="" />
</form>

最佳答案

我不懂PHP,但是之前在自己的项目中使用list.js的时候看到过这个错误。事实证明我没有正确定义事物。

您确实设置了一个具有适当 ID 的 div,但您似乎缺少一个“列表”类。尝试改变

<ul class="unstyled">

<ul class="list">

其次,我不认为“list”是选项中受支持的关键字(至少在最新的 list.js 版本中不是)。尝试将您的选项定义更改为

var options = {
valueNames: [ 'space-12' ]
};

第三,如果你想让搜索工作改变

<button class="sort" data-sort="label">

<button class="sort" data-sort="space-12">

关于Javascript list.js 到此 php 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20716112/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com