我想在NextGen中浏览特定专辑的图像。
我想使用NextGen相册在主题header.php中创建横幅幻灯片。类似的东西:
loop through images in album = x:
$src = src of image
$title = title of image
echo $src and $title
怎么做?
找到解决方案:
global $nggdb;
$gallery = $nggdb->get_gallery(8, 'sortorder', 'ASC', true, 0, 0);
foreach($gallery as $image) {
echo $image->imageURL;
echo $image->alttext;
echo $image->description;
}
可以打印所有其他$ image属性
答案 0 :(得分:9)
使用 zvinxs 解决方案回答问题:
global $nggdb;
$gallery = $nggdb->get_gallery(8, 'sortorder', 'ASC', true, 0, 0);
foreach($gallery as $image) {
echo $image->imageURL;
echo $image->alttext;
echo $image->description;
}