当前位置: 首页>>代码示例>>PHP>>正文


PHP nggGallery::create_navigation方法代码示例

本文整理汇总了PHP中nggGallery::create_navigation方法的典型用法代码示例。如果您正苦于以下问题:PHP nggGallery::create_navigation方法的具体用法?PHP nggGallery::create_navigation怎么用?PHP nggGallery::create_navigation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nggGallery的用法示例。


在下文中一共展示了nggGallery::create_navigation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: nggCreateGallery

/**
 * Build a gallery output
 * 
 * @access internal
 * @param array $picturelist
 * @param bool $galleryID, if you supply a gallery ID, you can add a slideshow link
 * @param string $template (optional) name for a template file, look for gallery-$template
 * @return the content
 */
function nggCreateGallery($picturelist, $galleryID = false, $template = '')
{
    global $nggRewrite;
    $ngg_options = nggGallery::get_option('ngg_options');
    // $_GET from wp_query
    $nggpage = get_query_var('nggpage');
    $pageid = get_query_var('pageid');
    if (!is_array($picturelist)) {
        $picturelist = array($picturelist);
    }
    $gallery = new stdclass();
    $gallery->ID = (int) $galleryID;
    $gallery->show_slideshow = false;
    $maxElement = $ngg_options['galImages'];
    $thumbwidth = $ngg_options['thumbwidth'];
    $thumbheight = $ngg_options['thumbheight'];
    // set thumb size
    $thumbsize = '';
    if ($ngg_options['thumbfix']) {
        $thumbsize = 'width="' . $thumbwidth . '" height="' . $thumbheight . '"';
    }
    if ($ngg_options['thumbcrop']) {
        $thumbsize = 'width="' . $thumbwidth . '" height="' . $thumbwidth . '"';
    }
    // show slideshow link
    if ($galleryID) {
        if ($ngg_options['galShowSlide'] and NGGALLERY_IREXIST) {
            $gallery->show_slideshow = true;
            $gallery->slideshow_link = $nggRewrite->get_permalink(array('show' => "slide"));
            $gallery->slideshow_link_text = $ngg_options['galTextSlide'];
        }
        if ($ngg_options['usePicLens']) {
            $gallery->show_piclens = true;
            $gallery->piclens_link = "javascript:PicLensLite.start({feedUrl:'" . htmlspecialchars(nggMediaRss::get_gallery_mrss_url($gallery->ID)) . "'});";
        }
    }
    // check for page navigation
    if ($maxElement > 0) {
        if (!is_home() || $pageid == get_the_ID()) {
            if (!empty($nggpage)) {
                $page = (int) $nggpage;
            } else {
                $page = 1;
            }
        } else {
            $page = 1;
        }
        $start = $offset = ($page - 1) * $maxElement;
        $total = count($picturelist);
        // remove the element if we didn't start at the beginning
        if ($start > 0) {
            array_splice($picturelist, 0, $start);
        }
        // return the list of images we need
        array_splice($picturelist, $maxElement);
        $navigation = nggGallery::create_navigation($page, $total, $maxElement);
    } else {
        $navigation = '<div class="ngg-clear">&nbsp;</div>';
    }
    //var_dump($picturelist);
    foreach ($picturelist as $key => $picture) {
        // choose link between imagebrowser or effect
        $link = $ngg_options['galImgBrowser'] ? $nggRewrite->get_permalink(array('pid' => $picture->pid)) : $picture->imageURL;
        // get the effect code
        if ($galleryID) {
            $thumbcode = $ngg_options['galImgBrowser'] ? '' : $picture->get_thumbcode($picturelist[0]->name);
        } else {
            $thumbcode = $ngg_options['galImgBrowser'] ? '' : $picture->get_thumbcode(get_the_title());
        }
        // add a filter for the link
        $picturelist[$key]->imageURL = apply_filters('ngg_create_gallery_link', $link, $picture);
        $picturelist[$key]->thumbnailURL = $picture->thumbURL;
        $picturelist[$key]->size = $thumbsize;
        $picturelist[$key]->thumbcode = $thumbcode;
        $picturelist[$key]->description = empty($picture->description) ? ' ' : stripslashes($picture->description);
        $picturelist[$key]->alttext = empty($picture->alttext) ? ' ' : stripslashes($picture->alttext);
    }
    // look for gallery-$template.php or pure gallery.php
    $filename = empty($template) ? 'gallery' : 'gallery-' . $template;
    // create the output
    $out = nggGallery::capture($filename, array('gallery' => $gallery, 'images' => $picturelist, 'pagination' => $navigation));
    // apply a filter after the output
    $out = apply_filters('ngg_gallery_output', $out, $picturelist);
    return $out;
}
开发者ID:pravinhirmukhe,项目名称:flow1,代码行数:94,代码来源:nggfunctions.php


注:本文中的nggGallery::create_navigation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。