Twitter bootstrap 带OS类的引导转盘
我需要像这样动态创建引导转盘:Twitter bootstrap 带OS类的引导转盘,twitter-bootstrap,twitter-bootstrap-3,osclass,Twitter Bootstrap,Twitter Bootstrap 3,Osclass,我需要像这样动态创建引导转盘: <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> <!-- Indicators --> <ol class="carousel-indicators"> <li data-target="#carousel-example-generic" data-slide-to="0" class="act
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
etc...
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="someIMG.jpg" alt="...">
</div>
<div class="item">
<img src="someIMG-nn.jpg" alt="...">
</div>
etc...
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
等
等
现在我有了一个osclass函数,我调用它来创建动态引导转盘:
**<?php osc_run_hook('item_detail', osc_item() ) ; ?>
<?php if( osc_images_enabled_at_items() && (osc_count_item_resources() > 0) ) { ?>**
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
**<?php $i=0;?>**
**<?php while( osc_has_item_resources() ) { ?>**
<li data-target="#carousel-example-generic" data-slide-to="**<?php echo $i; $i+1;?>**" class="active"></li>
**<?php } ?>**
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
**<?php while( osc_has_item_resources() ) { ?>**
<div class="item">
<img src="**<?php echo osc_resource_url(); ?>**" alt="...">
</div>
**<?php } ?>**
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
**
**
****
****
你很接近。但是,您使用该循环两次,这可能不起作用。我不确定osc\u拥有的\u item\u resources()
对记录做了什么。但是试试这个
将变量设置为osc\u count\u item\u resources()
中的任意值,然后循环多次以构建转盘指示器。完成此操作后,使用while(osc_has_item_resources())
循环并构建项目
<?php osc_run_hook('item_detail', osc_item() ) ; ?>
<?php if( osc_images_enabled_at_items() && (osc_count_item_resources() > 0) ) { ?>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<?php $itemCount = osc_count_item_resources(); ?>
<?php for($i = 0; $i < $itemCount; $i++) { ?>
<li data-target="#carousel-example-generic" data-slide-to="<?php echo $i; ?>" class="active"></li>
<?php } ?>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<?php $i = 0; ?>
<?php while( osc_has_item_resources() ) { ?>
<div class="item<?php echo ($i === 0) ? ' active': ''; ?>">
<img src="<?php echo osc_resource_url(); ?>" alt="...">
</div>
<?php $i++; ?>
<?php } ?>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
对于botstrap4,可与replace一起使用
<div class="carousel-item <?php echo ($i === 0) ? ' active': ''; ?>">
<img src="<?php echo osc_resource_url(); ?>" alt="...">
</div>
简单地说,我尝试使用推特引导旋转木马包含函数以友好方式创建HTML,但效果不好……如果有人来这里寻求答案,osc_has_item_resources()
不能在不重置查询的情况下使用两次。在第一次循环后尝试osc\u reset\u items()
。这没关系,谢谢,但是当我编写相同的代码时,html工作很好,但是这是一个手动创建的,然后工作不好。。。代码在两种情况下是相同的……我得到的是:但我不知道为什么会隐藏这个?现在我知道问题出在哪里了。第一个类=项目必须是class=“项目活动”。。。我怎么做?我更新了密码。我检查了它是否是循环中第一个回送活动的<代码>现在,所有类都处于活动状态。。。所以不要再工作了