{BREADCRUMB} vs. gegenwärtige position in der seite

Hier bekommst Du deutschsprachigen Support. Keine Fehlermeldungen oder Erweiterungswünsche bitte!
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Re: {BREADCRUMB} vs. gegenwärtige position in der seite

Post by phalancs »

Nein ich meine ja die Variante die hier schon verlinkt ist, kann also ruhig ins frontend_render VZ ;-)
2008
nameless1
Posts: 882
Joined: Sun 27. Apr 2008, 23:22

Re: {BREADCRUMB} vs. gegenwärtige position in der seite

Post by nameless1 »

das

Code: Select all

$content['struct'][$item]['acat_name']
ist doch hier der ansatz. muß noch n li davor und dahinter.
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Re: {BREADCRUMB} vs. gegenwärtige position in der seite

Post by phalancs »

Ich habe es angepasst und erledigt. Es fügt jetzt auch News-Titel hinzu. Habe das rt_breadcrumb_article.php Script als Basis genommen, nicht das rt_breadcrumb_article_start.php das hat in der neuesten phpwcms Version irgendwie keinen Output erzeugt (1.6.522).

Beispiel: [url http://www.enym.com]www.enym.com[/url]
Breadcrump wird nicht auf der Home Seite angezeigt, nur auf den anderen Seiten.

Code: Select all

<?php
 
/** ----------------------------------------------------------------------------
 * Alternative way of building a breadcrumb
 * It will show article title too and act different when in article list mode
 * This works different from default breadcrumb because it is level based
 *
 * (c) 2012 Oliver Georgi
 *
 * V1.1
 * V2.0 5.12.2012: Enhanced by enym.com
 *       - now creates an ul with "current" class in current level 
 *       - adds article subtitle as well (only if there is one)  
 *       - adds  news-title and subtitle to breadcrump-list if in newsdetail mode
 *
 * Forum: http://forum.phpwcms.org/viewtopic.php?p=118076#p118076
 * Condition V1.4.2 r334
 *
 * Tag: {BREADCRUMB_ARTICLE}
 * ---------------------------------------------------------------------------- */
 
// -----------------------------------------------------------------------------
// OBLIGATE CHECK FOR PHPWCMS CONSTANTS
if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");}
// -----------------------------------------------------------------------------
 
if(strpos($content['all'], '{BREADCRUMB_ARTICLE}')) {
 
        // Set level where to start with breadcrumb - default 0 = Root level
        $_breadcrumb_start_level        = 0;
 
        // Separate Breadcrumb items with
        $_breadcrumb_spacer                     = '';
 
        // Wrap inner link text by prefix/suffix <a> %PREFIX% Linktext %SUFFIX% </a>
        $_breadcrumb_link_prefix        = '';
        $_breadcrumb_link_suffix        = '';
 
        // additional link attributes like class, rel, style
        // remember there is no active link - active (last) item has no link
        $_breadcrumb_link_attribute     = 'class="breadcrumb-link"';
 
 
        ////// Do not edit below ////////
 
        $_breadcrumb = array();
 
        if(count($LEVEL_ID) > $_breadcrumb_start_level) {
 
                foreach($LEVEL_ID as $level => $item) {
 
                        if($level < $_breadcrumb_start_level) {
                                continue;
                        }
 
                        if($content['struct'][$item]["acat_hidden"] == false) {
                                $_breadcrumb[] = "<li>".
                                getStructureLevelLink(
                                                ($content['cat_id'] == $item && $content['list_mode']) ? $content['struct'][$item]['acat_name'] : $content['struct'][$item],
                                                $_breadcrumb_link_attribute,
                                                $_breadcrumb_link_prefix,
                                                $_breadcrumb_link_suffix
                                        )."</li>";
                        }
 
                }
 
        }
 

 
        // If Articledetail
        if($aktion[1]) {
 
                if ($content['articles'][$aktion[1]]['article_subtitle'] != '') { 
                $adder = ' - ';
                }
                        
                if(!isset($_getVar['newsdetail'])) {
                //current article is current level if u r not in newsdetail
                $current = ' class="current"';    
                }
                
                if(isset($_getVar['newsdetail'])) {
                    //if u r in newsdetail container article needs a link
                    if ($phpwcms['rewrite_ext'] != "" && $phpwcms['rewrite_url']) { 
                    $link = $content['articles'][$aktion[1]]['article_alias'].$phpwcms['rewrite_ext'];
                    } else {
                    $link = "index.php?".$content['articles'][$aktion[1]]['article_alias'];
                    }
                } else {
                $link = "#";
                }
                
                //$_breadcrumb[] = '<li><a href"#">'.html_specialchars( $content['article_title'] ).' - '.html_specialchars( $content['article_subtitle'] ).'</a></li>';
                $_breadcrumb[] = '<li><a href="'.$link.'"'.$current.'>'.html_specialchars( $content['article_title'] ).$adder. html_specialchars( $content['articles'][$aktion[1]]['article_subtitle'] ) .'</a></li>';
 
        }
        
        // If Newsdetail
        if(isset($_getVar['newsdetail'])) {
        
                if ($news['result'][0]['cnt_subtitle'] != '') { 
                $adder = ' - ';
                }
                
                $_breadcrumb[] = '<li><a href"#" class="current">'.html_specialchars( $news['result'][0]['cnt_title'] ).$adder. html_specialchars( $news['result'][0]['cnt_subtitle'] ) .'</a></li>';
        
        }
        
 
        $_breadcrumb = implode($_breadcrumb_spacer, array_diff( $_breadcrumb , array('', NULL) ) );
 
        $content['all'] = str_replace('{BREADCRUMB_ARTICLE}', '<ul>'.$_breadcrumb.'</ul>', $content['all']);
}
 
?>
2008
nameless1
Posts: 882
Joined: Sun 27. Apr 2008, 23:22

Re: {BREADCRUMB} vs. gegenwärtige position in der seite

Post by nameless1 »

können wir das ins wiki packen?
Old Boy
Posts: 1203
Joined: Fri 23. Nov 2012, 13:52

Re: {BREADCRUMB} vs. gegenwärtige position in der seite

Post by Old Boy »

Ein Problem besteht da aber noch.
Der hinterste Eintrag des Breadcrumbmenues ist immer mit der Homepage verlinkt, das ist nicht sinnvoll!

Kann man da vielleicht noch was dran korrigieren?
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Re: {BREADCRUMB} vs. gegenwärtige position in der seite

Post by phalancs »

Ja das stimmt, ich hab auch schon überlegt wie mans lösen kann. #top hilft auch nicht gut weiter. Man müsste aber einfach nur den href kram entfernen bei dem artikel-und news-part, bzw. bei dem artikel nur wenn nicht im newsdetail-modus.
2008
Old Boy
Posts: 1203
Joined: Fri 23. Nov 2012, 13:52

Re: {BREADCRUMB} vs. gegenwärtige position in der seite

Post by Old Boy »

Genau, für das current-Element... keinen Link sondern reinen Text generieren im li-Element
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Re: {BREADCRUMB} vs. gegenwärtige position in der seite

Post by phalancs »

Ja. dann lösche das da doch einfach raus und fertig ist's :)
2008
User avatar
Oliver Georgi
Site Admin
Posts: 9918
Joined: Fri 3. Oct 2003, 22:22
Contact:

Re: {BREADCRUMB} vs. gegenwärtige position in der seite

Post by Oliver Georgi »

OT Schiebt doch möglichst Code raus aus dem Forum und dorthin, wo man diesen besser pflegen und verbessern kann.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон
phalancs
Posts: 793
Joined: Thu 19. Feb 2004, 05:09
Location: Germany

Re: {BREADCRUMB} vs. gegenwärtige position in der seite

Post by phalancs »

Okay, ich mache da eine Extension bei git draus.

Sofern Du das meinst :)

Aber der Code basiert ja ein bisschen auf dem "Rewrite der News" Hack ... Hmm, vll. sollte ich da auch ein Fork draus machen ;)
2008
Post Reply