对图集进行分割,可以这样:
<?php
$arr
=
array
();
$arr
=
$navinfor
[
'morepic'
];
$newarr
=
explode
(egetzy(
'rn'
),
$arr
);
$count
=
count
(
explode
(egetzy(
'rn'
),
$navinfor
[morepic]));
//图集的图片数量
for
(
$i
=0;
$i
<
$count
;
$i
++)
{
$s_arr
=
array
();
$s_arr
[] =
$newarr
[
$i
];
$str
=
$s_arr
[0];
$bot_arr
=
explode
(
"::::::"
,
$str
);
$spic
=
$bot_arr
[0];
//小图
$bpic
=
$bot_arr
[1];
//大图
$picinfo
=
$bot_arr
[2];
//图片说明
echo
' <li><img src="'
.
$spic
.
'" alt="'
.
$picinfo
.
'" bigimg="'
.
$bpic
.
'" text="'
.
$picinfo
.
'" /></li>'
;
}
?>
内容页图片统计
<?php
$sl
=
empty
(
$navinfor
[morepic])?0:
count
(
explode
(
chr
(13),
$navinfor
[morepic]));
echo
$sl
;
?>
首页获取单张小图调用方法:
$morepic
=
''
;
if
(
$r
[morepic])
{
$fr
=
$empire
->fetch1(
"select * from {$dbtbpre}ecms_news where id='$r[id]'"
);
$rexp
=
"\r\n"
;
$fexp
=
"::::::"
;
$rr
=
explode
(
$rexp
,
$fr
[morepic]);
$count
=
count
(
$rr
);
for
(
$i
=1;
$i
<2;
$i
++)
{
$frt
=
explode
(
$fexp
,
$rr
[
$i
-1]);
$listtemps
.=(
'<li><i><a href="[!--titleurl--]" title="[!--oldtitle--]"><img src="'
.
$frt
[0].
'"></a></i><span class="picture-item">[!--oldtitle--]</span></li>'
);
}
}
$listtemp
=(
''
.
$listtemps
.
''
);
内容页:
<?php
$picr
=
explode
(egetzy(
'rn'
),
$navinfor
[morepic]);
for
(
$p
=0;
$p
<
count
(
$picr
);
$p
++)
{
$spicr
=
explode
(
"::::::"
,
$picr
[
$p
]);
?>
<li>
<div
class
=
"picimg"
><img src=
"<?=$spicr[0]?>"
/></div>
<div
class
=
"pictxt"
>
<h3>[!--title--]</h3>
</div>
</li>
<?php
}
?>
字段说明
小图地址 | <?=$spicr[0]?> |
大图地址 | <?=$spicr[1]?> |
图片名称 | <?=$spicr[2]?> |
图片集提取第一帧图片
<?php
$str
=
$navinfor
[morepic];
$exp
=
explode
(
"::::::"
,
$str
);
?>
<img src=
"<?=$a=$exp[1];?>"
alt=
"第一张"
/>
<?php
?>
本文摘自网络,不代表短经典网立场 https://www.duanjingdian.com/785.html