Ergebnis 1 bis 7 von 7

Thema: Grafik Parent Menu Aktiv wenn Child aktiv ist

  1. #1
    Contao-Nutzer
    Registriert seit
    25.11.2009.
    Beiträge
    34

    Standard Grafik Parent Menu Aktiv wenn Child aktiv ist

    Hallo

    Ich benutze für meine Parent Menu Punkten ein Bild (mit mod hit_graphical_navigation) und der Child Menu Punkten sind text.

    Jetzt wollte ich das wenn der Child aktiv sind auch der parent aktiv ist.

    Ich habe mal der Template File von modul gechecked aber komm dar nicht aus :-(

    File: nav_graphicalnavi_activenuninkable.tpl

    PHP-Code:
    <?php 
    // Navigationsgrafiken laden
    $this->import('Database');
    $x=0;
    foreach(
    $this->arrData['items'] as $NaviItem) {
        
    $objPage $this->Database->execute('SELECT nopic,ropic,actpic FROM tl_page WHERE title="' $NaviItem['title']. '"');
        
    $strNOPic $objPage->nopic;
        
    $strROPic = ($objPage->ropic!='') ? $objPage->ropic $strNOPic;
        
    $strACTPic = ($objPage->actpic!='') ? $objPage->actpic $strROPic;
        
    array_insert($this->arrData['items'][$x],0,array('nopic'=>$strNOPic,'ropic'=>$strROPic,'actpic'=>$strACTPic));
        
    $x++;
    }
    ?>
    <div class="graphicalnavigation">
    <ul class="<?php echo $this->level?>">
    <?php foreach ($this->items as $item): ?>
        <?php if ($item['isActive']): ?>
        <li class="active
            <?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>">
        
            <?php if($item['actpic']): ?>
                <img src="<?php echo $item['actpic']; ?>" alt="<?php echo $item['link']; ?>
                title="<?php echo $item['pageTitle']; ?>
                class="active
                <?php if($item['class']): ?><?php echo $item['class']; ?><?php endif;?>" />
        
                <?php else: ?>
                <span class="active
                    <?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><?php echo $item['link']; ?>
                </span>
            <?php endif; ?>
                <?php echo $item['subitems']; ?>
        </li>
        
        
        
        
        <?php else: ?>
            <li<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>>
                <a href="<?php echo $item['href']; ?>" title="<?php echo $item['pageTitle'] ? $item['pageTitle'] : $item['title']; ?>"<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>
                <?php if ($item['accesskey'] != ''): ?> accesskey="<?php echo $item['accesskey']; ?>"<?php endif; ?>
                <?php if ($item['tabindex']): ?> tabindex="<?php echo $item['tabindex']; ?>"<?php endif; ?>
                <?php if ($item['nofollow']): ?> rel="nofollow"<?php endif; ?> onclick="this.blur();<?php echo $item['target']; ?>">
                <?php if($item['nopic']): ?><img src="<?php echo $item['nopic']; ?>" alt="<?php echo $item['link']; ?>
                    onmouseover="this.src='<?php echo $item['ropic']; ?>';" onmouseout="this.src='<?php echo $item['nopic']; ?>';" />
                <?php else: ?>
                <?php echo $item['link']; ?>
                <?php endif; ?></a>
                <?php echo $item['subitems']; ?>
            </li>
        <?php endif; ?>

    <?php endforeach; ?>
    </ul>
    </div>
    Was muss ich hier ändern das der Parent Menu Items auch Aktiviert sind?

    Beilage der Bilder:
    Bild 1.png: So ist jetzt
    Bild 2.png: So sollte es sein:

    Und ich entschuldigen mir vor meine Deutsch.....bin Holländer :-)
    Angehängte Grafiken Angehängte Grafiken
    • Dateityp: png 1.png (26,7 KB, 26x aufgerufen)
    • Dateityp: png 2.png (22,9 KB, 22x aufgerufen)

  2. #2
    Community-Moderator Avatar von schman
    Registriert seit
    19.06.2009.
    Ort
    Dornbirn
    Beiträge
    3.739
    User beschenken
    Wunschliste

    Standard

    das parent bekommt die .trail Klasse dazu damit kannst du dann dein Elternelement stylen

  3. #3
    Contao-Nutzer
    Registriert seit
    25.11.2009.
    Beiträge
    34

    Standard Eintragen in code?

    Hallo schman

    Danke für deine rasche Antwort.
    Ich habe der .trail class gefunden im frontend mit firebug aber wie bau ich das in der code rein?

    So:

    Aber funktioniert noch nicht....was mach ich falsch?

    PHP-Code:
    <?php 
    // Navigationsgrafiken laden
    $this->import('Database');
    $x=0;
    foreach(
    $this->arrData['items'] as $NaviItem) {
        
    $objPage $this->Database->execute('SELECT nopic,ropic,actpic FROM tl_page WHERE title="' $NaviItem['title']. '"');
        
    $strNOPic $objPage->nopic;
        
    $strROPic = ($objPage->ropic!='') ? $objPage->ropic $strNOPic;
        
    $strACTPic = ($objPage->actpic!='') ? $objPage->actpic $strROPic;
        
    array_insert($this->arrData['items'][$x],0,array('nopic'=>$strNOPic,'ropic'=>$strROPic,'actpic'=>$strACTPic));
        
    $x++;
    }
    ?>
    <div class="graphicalnavigation">
    <ul class="<?php echo $this->level?>">
    <?php foreach ($this->items as $item): ?>
        <?php if ($item['isActive']): ?>
        <li class="active
            <?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>">
        
            <?php if($item['actpic']): ?>
                <img src="<?php echo $item['actpic']; ?>" alt="<?php echo $item['link']; ?>
                title="<?php echo $item['pageTitle']; ?>
                class="active
                <?php if($item['class']): ?><?php echo $item['class']; ?><?php endif;?>" />
                
                <?php else: ?>
                <span class="active
                    <?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><?php echo $item['link']; ?>
                </span>
            <?php endif; ?>
            
     /* search for trail class and make a activestate button */

            <?php if ($item['class']=='trail'): ?>
                <img src="<?php echo $item['actpic']; ?>" alt="<?php echo $item['link']; ?>
                title="<?php echo $item['pageTitle']; ?>
                class="active
                <?php if($item['class']): ?><?php echo $item['class']; ?><?php endif;?>" />
            <?php endif; ?>

    /*End trail class */
            
                <?php echo $item['subitems']; ?>
        </li>
        
        
        
        
        <?php else: ?>
            <li<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>>
                <a href="<?php echo $item['href']; ?>" title="<?php echo $item['pageTitle'] ? $item['pageTitle'] : $item['title']; ?>"<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>
                <?php if ($item['accesskey'] != ''): ?> accesskey="<?php echo $item['accesskey']; ?>"<?php endif; ?>
                <?php if ($item['tabindex']): ?> tabindex="<?php echo $item['tabindex']; ?>"<?php endif; ?>
                <?php if ($item['nofollow']): ?> rel="nofollow"<?php endif; ?> onclick="this.blur();<?php echo $item['target']; ?>">
                <?php if($item['nopic']): ?><img src="<?php echo $item['nopic']; ?>" alt="<?php echo $item['link']; ?>
                    onmouseover="this.src='<?php echo $item['ropic']; ?>';" onmouseout="this.src='<?php echo $item['nopic']; ?>';" />
                <?php else: ?>
                <?php echo $item['link']; ?>
                <?php endif; ?></a>
                <?php echo $item['subitems']; ?>
            </li>
        <?php endif; ?>

    <?php endforeach; ?>
    </ul>
    </div>

  4. #4
    Contao-Nutzer
    Registriert seit
    25.11.2009.
    Beiträge
    34

    Standard Bitte ??? Wie kann mir Hilfen??

    Bitte Wie kann mir Hilfen mit dieses Problem??

    Grüsse Rogier

  5. #5
    Contao-Nutzer
    Registriert seit
    25.11.2009.
    Beiträge
    34

    Standard Lösung gefunden :-)

    Ich habe ein zwischen Lösung gefunden.....mit css und modul anpassungen :-)

    Ich benutze im:
    system/modules/hit_graphical_navigation/templates/nav_graphicalnavi_activenuninkable.tpl

    der id="{{env:parent_alias}}" um jede menupunkt zu bestimmen.

    PHP-Code:
    <?php 
    // Navigationsgrafiken laden
    $this->import('Database');
    $x=0;
    foreach(
    $this->arrData['items'] as $NaviItem) {
        
    $objPage $this->Database->execute('SELECT nopic,ropic,actpic FROM tl_page WHERE title="' $NaviItem['title']. '"');
        
    $strNOPic $objPage->nopic;
        
    $strROPic = ($objPage->ropic!='') ? $objPage->ropic $strNOPic;
        
    $strACTPic = ($objPage->actpic!='') ? $objPage->actpic $strROPic;
        
    array_insert($this->arrData['items'][$x],0,array('nopic'=>$strNOPic,'ropic'=>$strROPic,'actpic'=>$strACTPic));
        
    $x++;
    }
    ?>
    <div class="graphicalnavigation">

    <ul class="<?php echo $this->level?>">
    <?php foreach ($this->items as $item): ?>
        <?php if ($item['isActive']): ?>
        <li class="active
            <?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>">
            
            
            
            <?php if($item['actpic']): ?>
                <img  src="<?php echo $item['actpic']; ?>" alt="<?php echo $item['link']; ?>
                title="<?php echo $item['pageTitle']; ?>" height="20" width="270" 
                class="active
                <?php if($item['class']): ?><?php echo $item['class']; ?><?php endif;?>" />
                
                <?php else: ?>
                <span class="active
                    <?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><?php echo $item['link']; ?>
                </span>
            <?php endif; ?>
        
                <?php echo $item['subitems']; ?>
                
        </li>
        
        
        
        
        <?php else: ?>
            <li  <?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>>
                <a id="{{env::parent_alias}}" href="<?php echo $item['href']; ?>" title="<?php echo $item['pageTitle'] ? $item['pageTitle'] : $item['title']; ?>"<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>
                <?php if ($item['accesskey'] != ''): ?> accesskey="<?php echo $item['accesskey']; ?>"<?php endif; ?>
                <?php if ($item['tabindex']): ?> tabindex="<?php echo $item['tabindex']; ?>"<?php endif; ?>
                <?php if ($item['nofollow']): ?> rel="nofollow"<?php endif; ?> onclick="this.blur();<?php echo $item['target']; ?>">
                <?php if($item['nopic']): ?><img class="{{env::parent_alias}}" src="<?php echo $item['nopic']; ?>" height="20" width="270" alt="<?php echo $item['link']; ?>
                    onmouseover="this.src='<?php echo $item['ropic']; ?>';" onmouseout="this.src='<?php echo $item['nopic']; ?>';" />
                <?php else: ?>
                <?php echo $item['link']; ?>
                <?php endif; ?></a>
                <?php echo $item['subitems']; ?>
                
            </li>
        <?php endif; ?>

    <?php endforeach; ?>
    </ul>
    </div>
    Und im CSS
    Code:
    .graphicalnavigation .trail img{display: none;}
    .graphicalnavigation .trail a#ueber-uns{display:block;padding:10px 0 13px 44px;background-image:url("tl_files/Solutionlabs/images/navi/uberuns_active.jpg");background-repeat:no-repeat;}
    .graphicalnavigation .trail a#mediencorner{display:block;padding:10px 0 13px 44px;background-image:url("tl_files/Solutionlabs/images/navi/mediencorner_active.jpg");background-repeat:no-repeat;}
    .graphicalnavigation .trail a#about-us{display:block;padding:10px 0 13px 44px;background-image:url("tl_files/Solutionlabs/images/navi/about_us_active.jpg");background-repeat:no-repeat;}
    .graphicalnavigation .trail a#media-corner{display:block;padding:10px 0 13px 44px;background-image:url("tl_files/Solutionlabs/images/navi/media_corner_active.jpg");background-repeat:no-repeat;}
    .mod_navigation .level_2 a#ueber-uns,.mod_navigation .level_2 a#mediencorner,.mod_navigation .level_2 a#about-us,.mod_navigation .level_2 a#media-corner{padding:0;background-image: none;}
    Der "a#ueber-uns" sind der Title der Parent (Kategorien) so diese muss du mal ersetzen.

    Viel spass,

    Gr Rogier

  6. #6
    Contao-Nutzer
    Registriert seit
    25.11.2009.
    Beiträge
    34

    Standard Menu springt...

    In IE und Safari Springt meine Menu 1px nach unten......
    Ich habe mal die Width und Height von Bild im Code integriert und ein bischen mit die Padding gespielt aber meine Menu springt noch immer...

  7. #7
    Contao-Urgestein Avatar von Tim G
    Registriert seit
    13.02.2010.
    Ort
    Lübeck
    Beiträge
    2.210
    User beschenken
    Wunschliste

    Standard

    Hi Leute,
    schon bissel altes Thema, aber sicher noch interessant für den einen oder anderen.
    Ich hab für ein aktuelles Projekt das Modul mal aufgebohrt (Contao 2.9.1) und auch mit der .trail - Funktionalität ausgestattet.
    Der Hauptmenupunkt bleibt aktiv und "klickbar" wenn ein Untermenu aktiv ist, aber der Zustand geht auf "active".
    Desweiteren benutzt das Modul die SeitenID als Bezug und nicht wie ehemals den Seitentitel. So können Dopplungen vermieden werden.

    PHP-Code:
    <?php 
    // Navigationsgrafiken laden
    $this->import('Database');
    $x=0;
    foreach(
    $this->arrData['items'] as $NaviItem) {
        
    //$objPage = $this->Database->execute('SELECT nopic,ropic,actpic FROM tl_page WHERE title="' . $NaviItem['title']. '"');
        
    $objPage $this->Database->execute('SELECT id, nopic,ropic,actpic FROM tl_page WHERE id="' $NaviItem['id']. '"');
        
    $strNOPic $objPage->nopic;
        
    $strROPic = ($objPage->ropic!='') ? $objPage->ropic $strNOPic;
        
    $strACTPic = ($objPage->actpic!='') ? $objPage->actpic $strROPic;
        
    $boolACT $objPage->actpic != '';
        
    array_insert($this->arrData['items'][$x],0,array('nopic'=>$strNOPic,'ropic'=>$strROPic,'actpic'=>$strACTPic,'useAct'=>$boolACT));
        
    $x++;

    }
    ?>
    <div class="graphicalnavigation">
    <ul class="<?php echo $this->level?>">
    <?php foreach ($this->items as $item): ?>
    <?php 
    if ($item['isActive']): ?>
    <li class="active<?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><?php if($item['actpic'][0]): ?><img src="<?php echo $item['actpic'][0]; ?>" alt="<?php echo $item['link']; ?>" title="<?php echo $item['pageTitle']; ?>" class="active<?php if($item['class']): ?> <?php echo $item['class']; ?><?php endif;?>" /><?php else: ?><span class="active<?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><?php echo $item['link']; ?></span><?php endif; ?><?php echo $item['subitems']; ?></li>
    <?php else: ?>
    <?php 
    if ( strpos($item['class'], 'trail') ): ?>
    <li<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>><a href="<?php echo $item['href']; ?>" title="<?php echo $item['pageTitle'] ? $item['pageTitle'] : $item['title']; ?>"<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?><?php if ($item['accesskey'] != ''): ?> accesskey="<?php echo $item['accesskey']; ?>"<?php endif; ?><?php if ($item['tabindex']): ?> tabindex="<?php echo $item['tabindex']; ?>"<?php endif; ?><?php if ($item['nofollow']): ?> rel="nofollow"<?php endif; ?> onclick="this.blur();<?php echo $item['target']; ?>"><?php if($item['nopic'][0]): ?><img src="<?php echo $item['actpic'][0]; ?>" alt="<?php echo $item['link']; ?>" onmouseover="this.src='<?php echo $item['actpic'][0]; ?>';" onmouseout="this.src='<?php echo $item['actpic'][0]; ?>';" /><?php else: ?><?php echo $item['link']; ?><?php endif; ?></a><?php echo $item['subitems']; ?></li>
    <?php else: ?>
    <li<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?>><a href="<?php echo $item['href']; ?>" title="<?php echo $item['pageTitle'] ? $item['pageTitle'] : $item['title']; ?>"<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?php endif; ?><?php if ($item['accesskey'] != ''): ?> accesskey="<?php echo $item['accesskey']; ?>"<?php endif; ?><?php if ($item['tabindex']): ?> tabindex="<?php echo $item['tabindex']; ?>"<?php endif; ?><?php if ($item['nofollow']): ?> rel="nofollow"<?php endif; ?> onclick="this.blur();<?php echo $item['target']; ?>"><?php if($item['nopic'][0]): ?><img src="<?php echo $item['nopic'][0]; ?>" alt="<?php echo $item['link']; ?>" onmouseover="this.src='<?php echo $item['ropic'][0]; ?>';" onmouseout="this.src='<?php echo $item['nopic'][0]; ?>';" /><?php else: ?><?php echo $item['link']; ?><?php endif; ?></a><?php echo $item['subitems']; ?></li>
    <?php endif; ?>
    <?php 
    endif; ?>
    <?php 
    endforeach; ?>
    </ul>
    </div>
    Viele Grüße,
    Tim
    Geändert von Tim G (12.10.2010 um 12:33 Uhr)

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Ähnliche Themen

  1. Antworten: 2
    Letzter Beitrag: 18.02.2011, 06:57
  2. Menu Links verspringen wenn aktiv
    Von han im Forum Layout / Templates / Holy Grail
    Antworten: 2
    Letzter Beitrag: 01.06.2010, 18:55
  3. parent elemente bleiben nicht aktiv
    Von samoth im Forum Layout / Templates / Holy Grail
    Antworten: 2
    Letzter Beitrag: 10.05.2010, 19:12
  4. Antworten: 1
    Letzter Beitrag: 30.04.2010, 12:44

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •