对 2 个 for_each 数组使用 Array_merge
我使用它来显示从我的 cms 调用的缩略图列表:
<?php if($gallery_images) { ?>
<?php
$slide_page = 1;
foreach($gallery_images as $count => $image) { ?>
<li><a href="<?php echo $image->getResizedImage(); ?>" rel="example1" title="********"><img width="125" height="80" src="<?php echo $image->getThumbnailImage()
?>" /></a></li>
<?php if(($count+1) % 3 == 0) {
$slide_page += 1;
?>
它从我的 CMS 中调用图像并以 3 组的形式显示它们,并添加一些 jquery 来滚动浏览集合。
我想做的是将其与我的视频合并到同一列表中。
视频代码如下:
<?php foreach($videos as $count => $video) { ?>
<a href="<?php echo $video->getLocation(); ?>" class="videolink"><img src="{thumbnail}" />Video A</a>
<?php } ?>
我尝试使用 array_merge 函数,但似乎遇到困难,任何帮助将不胜感激
Im using this to display a list of thumnails called from my cms:
<?php if($gallery_images) { ?>
<?php
$slide_page = 1;
foreach($gallery_images as $count => $image) { ?>
<li><a href="<?php echo $image->getResizedImage(); ?>" rel="example1" title="********"><img width="125" height="80" src="<?php echo $image->getThumbnailImage()
?>" /></a></li>
<?php if(($count+1) % 3 == 0) {
$slide_page += 1;
?>
It calls images from within my CMS and displays them in groups of 3, with some added jquery to scroll through the sets.
What im trying to do is merge this with my videos within the same list.
The video code is as follows:
<?php foreach($videos as $count => $video) { ?>
<a href="<?php echo $video->getLocation(); ?>" class="videolink"><img src="{thumbnail}" />Video A</a>
<?php } ?>
Ive tried using the array_merge function but seem to be having difficulties any help would be greatly appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很简单:
您可能还想查看
array_chunk()
。更新:
It's easy:
You may also want to look at
array_chunk()
.Update: