Php 仅当没有';页面的某个区域中是否有相同的数字?
基本上,我想要这个:Php 仅当没有';页面的某个区域中是否有相同的数字?,php,jquery,if-statement,Php,Jquery,If Statement,基本上,我想要这个: The highest voted answer 3 vote The others answer 1 vote answer 2 vote answer 1 vote 但我想避免这种情况: The highest voted answer 3 vote The others answer 3 vote answer 3 vote answer 1 vote 这是没有意义的,因为下面还有其他答案 因此,我想创建一个if-else语句,如下所示: (run t
The highest voted
answer 3 vote
The others
answer 1 vote
answer 2 vote
answer 1 vote
但我想避免这种情况:
The highest voted
answer 3 vote
The others
answer 3 vote
answer 3 vote
answer 1 vote
这是没有意义的,因为下面还有其他答案
因此,我想创建一个if-else语句,如下所示:
(run this only if there isn't posts with the same amount of votes)
The highest voted
answer 3 vote
(end if)
The others
answer 3 vote
answer 3 vote
answer 1 vote
所以在这种情况下,代码(最高级别的答案)不应该运行
我不确定是否应该使用php或jQuery来实现这一点
The_投票()代码>函数输出如下内容:+2票
,因此我无法直接使用它,因为它有文本
我可以根据div或div类进行比较
有没有关于如何编写代码的建议
编辑:
每个答案的PHP和HTML内容示例:
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php bbp_reply_admin_links(); ?>
<h4><?php bbp_topic_reply_count(); ?></h4>
<div class="topic-like-count">
<?php if(function_exists('the_votes')) { the_votes(); } ?>
我想我只需要从投票中得到数字,然后做点什么。为什么不能使用投票()代码>
即使返回像+xx投票这样的文本代码>您可以通过以下方式检索号码:
$voting = voting();
$votes = substr($voting,1,strpos($voting,' ')-1);
谢谢,我对php不是很熟悉。在那之后我该怎么办?我没有得到你所需要的输出。发布一个html示例