zpbase : deprecated function on news categories

vincent3569 Member, Translator
hi,
with zpbase 0.95 on zenphoto 1.4.6, there is a fatal error on news category.
the theme uses a deprecated function :

`Fatal error: Call to undefined function printNewsBreadcrumb() in /public_html/zenphoto_dev/themes/zpbase/news.php on line 65`

Comments

  • acrylian Administrator, Developer
    That has been renamed as the name was misleading because it does not print any breadcrumb. It is now named `printNewsTitle()`(again).
  • gjr Member
    Thanks Vincent.

    @Acrylian: printNewsBreadcrumb is not listed as deprecated. printNewsTitle is not a replacement as they do very different things. printNewsBreadcrumb (pasted below) prints "Archive" in the breadcrumb when applicable, or "News" or custom name for News. I think this function or a version there of is very much needed. I am wondering if it was removed by mistake (since not listed in deprecated file). PrintNewsTitle prints the title of a single news item, very different.

    `
    /**
    * Prints the full link of the news index page (news page 1)
    *
    * @param string $name The linktext
    * @param string $before The text to appear before the link text
    */
    function printNewsBreadcrumb($name = NULL, $before = '', $archive = NULL) {
    global $_zp_post_date;
    if ($_zp_post_date) {
    if (is_null($archive)) {
    $name = '' . gettext('Archive') . '';
    } else {
    $name = strip_tags(html_encode($archive));
    }
    $link = zp_apply_filter('getLink', rewrite_path(_ARCHIVE_ . '/', "/index.php?p=archive"), 'archive.php', NULL);
    } else {
    if (is_null($name)) {
    $name = gettext('News');
    } else {
    $name = strip_tags(html_encode($name));
    }
    $link = getNewsIndexURL();
    }
    if ($before) {
    echo '' . html_encode($before) . '';
    }
    echo "" . $name . "";
    }
    `
  • gjr Member
    This is the context I use it at the top of news.php loop:

    `

    <?php if (in_context(ZP_ZENPAGE_NEWS_CATEGORY)) { ?>
    <?php printNewsBreadcrumb($newsname); echo ' / '; ?>

    <?php printCurrentNewsCategory(); ?>

    <?php } else if (in_context(ZP_ZENPAGE_NEWS_DATE)) { ?>
    <?php printNewsBreadcrumb($newsname); echo ' / '; ?>

    <?php printCurrentNewsArchive(); ?>

    <?php } ?>

    `
  • acrylian Administrator, Developer
    On the current 1.4.6 build there is actually no `printNewsBreadcrumb` anymore, it has been renamed as I said. No mistake actually. See the news.php of Zenpage theme how we do it actually.

    News articles don't have any breadcrumb anyway as they have no hierachy, only pages and categories have. For those there is `printZenpageItemsBreadcrumb()` for that purpose.
  • gjr Member
    OK I see now that printNewsIndexURL replaces it, not printNewsTitle.

    Looks like printNewsIndexURL is an exact duplication of the former printNewsBreadcrumb.

    Had not caught this before because printNewsBreadcrumb is not showing up deprecated.
  • acrylian Administrator, Developer
    Yes, sorry, my mistake answering inbetween. It was not deprecated but just renamed (actually it was named that before) as it "breadcrumb" was misleading as it does not print a real breadcrumb in the meainig of hierachical links.
  • It is not deprecated because it "never really existed". We had deprecated the prior in 1.4.6 function in favor of printNewsBreadcrumb, but the team voted that this was a misleading name so it went back as on 1.4.5. No deprecation because printNewsBreadcrumb was never a released function.
  • gjr Member
    Oh OK got it. I started patching my theme for 1.4.6 early, that is why. Thanks!
Sign In or Register to comment.