tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
3
ZUGRIFFE
235
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    techniker techniker ist offline Rookie
    Registriert seit
    Jul 2003
    Ort
    asd
    Beiträge
    6
    HUHU Ich hab ein riesen Problem.

    Ich habe meine alte Homepage mit Müh und Not auf PHP umcodiert. Ich habe ein Navigationssystem. Dieses besteht aus 7 Punkten. per click auf einen öffnet sich im selben Menü ein Untermenü. Soll heissen ne Art Ziamonikamenü :P.

    Jetzt soll aber das Untermenü nich mit dem selben Hintergrund angezeigt werden. Ich hab das mit einem Hover-Effekt gemacht. Aber jetzt bekomm ich nicht hin wie ich das für das Untermenü ändere Ich hoff ich habt mich verstanden und könnt mir helfen.

    Ich füge mal den Script bei.

    Dateien:
    - include/global_funk.inc.php
    - templates/style.css
    Wenn ihr noch mehr braucht schreib ich den rest auch noch...

    include/global_funk.inc.php
    ________________________________________________________
    PHP-Code:
    <?php
    error_reporting
    (E_ALL & ~E_NOTICE);

    if (!
    defined('SCRIPTNAME')) {
    echo 
    'Unzul&auml;ssiger Scriptaufruf';
    exit;
    }

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    // Templatedaten holen fuer Templates ohne Ersatzvariablen
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    function get_tdata($tmplname) {
    if(
    file_exists($tmplname)) {
    $lines implode("",file($tmplname));
    return 
    $lines;
    } else {
    print_scripterror("Fehler!""Die Datei: $tmplname kann nicht ge&ouml;ffnet werden");
    exit;
    }
    }
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    // Templateinhalt holen fuer Einzelausgaben und Ausgaben in
    // while, for und foreach Schleifen
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    function get_tpldata($templatename) {

    if(
    file_exists($templatename)) {
    $templatecontent file($templatename);
    return 
    $templatecontent;
    } else {
    print_scripterror("Fehler!""Die Datei: $templatename kann nicht ge&ouml;ffnet werden");
    exit;
    }
    }

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    // Templateparser
    // Aufrufbeispiel:
    // echo $tp_content_out = templateparser($templatecontent, $wertearray);
    // $templatecontent  = Template HTML Code
    // $wertearray      = Zu ersetztende Platzhalterdaten
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    function templateparser($templatedatei$wertearray) {

    if(
    is_array($wertearray)) {
    foreach(
    $wertearray as $key => $value) {
    $suchmuster "/<%%(".strtoupper($key).")%%>/si";

    // Gefundene Platzhalter mit Werten aus $wertearray ersetzen
    $templatedatei preg_replace($suchmuster$value$templatedatei);
    }
    // Nicht ersetzte Platzhalter aus Template entfernen
    $templatedatei preg_replace("/((<%%)(.+?)(%%>))/si"''$templatedatei);
    }

    return (
    implode(""$templatedatei));
    }

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    // Globaler Header
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    function globaler_header($seitentitel =''$zusatzcontent ='') {

    $contentarray = array(
    "SEITENTITEL"    => $seitentitel,
    "ZUSATZCONTENT"  => $zusatzcontent
    );
    // Templatename
    $templatecontent get_tpldata("templates/header.html");
    return 
    $tp_content_out templateparser($templatecontent$contentarray);
    }

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    // Globales oberes Layout
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    function globallayoutoben($seitentitel ''$navimenue ''$navlink '') {

    $contentarray = array(
    "SEITENUEBERSCHRIFT"  => $seitentitel,
    "MENUEAUSGABE"      => get_navi($navimenue$navlink)
    );
    // Templatename
    $templatecontent get_tpldata("templates/layoutoben.html");
    return 
    $tp_content_out templateparser($templatecontent$contentarray);
    }

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    // Globaler Footer
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    function globaler_footer() {

    // Templatename
    $contentarray = array(
    "FOOTERCONTENT"  =>  ''
    );
    $templatecontent get_tpldata("templates/footer.html");
    return 
    $tp_content_out templateparser($templatecontent$contentarray);

    }

    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    // Navigation
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    function get_navi($navimenue '' $aktiverlink '') {

    if (
    $navimenue == 'HOME') {

      
    $menuedaten = array(
      
    'index'    => '>Home',
      
    'home_news'  => '--->News',
      
    'firma'    => '>Firma',
      
    'produktionen'  => '>Produktionen',
      
    'bilder'    => '>Bilder',
      
    'tutorials'  => '>Tutorials',
      
    'gb'      => '>Gästebuch',
      
    'kontakt'    => '>Kontakt'
      
    );
     
    } elseif (
    $navimenue == 'FIRMA') {

      
    $menuedaten = array(
      
    'index'        => '>Home',
      
    'firma'        => '>Firma',
      
    'firma_ausruestung'  => '--->Ausrüstung',
      
    'firma_team'      => '--->Team',
      
    'produktionen'      => '>Produktionen',
      
    'bilder'        => '>Bilder',
      
    'tutorials'      => '>Tutorials',
      
    'gb'          => '>Gästebuch',
      
    'kontakt'        => '>Kontakt'
      
    );
     
    } elseif (
    $navimenue == 'FIRMA-AUSRUESTUNG') {

      
    $menuedaten = array(
      
    'index'        => '>Home',
      
    'firma'        => '>Firma',
      
    'firma_ausruestung'  => '--->Ausrüstung',
      
    'firma_aus_arbeitsplatz'  => '------>Arbeitsplatz',
      
    'firma_aus_camcorder'  => '------>Camcorder',
      
    'firma_aus_waffen'    => '------>Waffen',
      
    'firma_aus_sonstiges'  => '------>Sonstiges',
      
    'firma_team'      => '--->Team',
      
    'produktionen'      => '>Produktionen',
      
    'bilder'        => '>Bilder',
      
    'tutorials'      => '>Tutorials',
      
    'gb'          => '>Gästebuch',
      
    'kontakt'        => '>Kontakt'
      
    );

    ---->
    Unterbrochen<----

    }

    while(list(
    $key$val) = each($menuedaten)) {

      if (
    $key != $aktiverlink) {
      
    $menuelinks .= "<a href=\"$key.php\">$val</a>\n";
      } else {
      
    $menuelinks .= "<div class=\"aktuell\">$val</div>\n";
      }

    }
    return 
    $menuelinks;
    }


    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    // Scripterror
    // Sofortiger Scriptabbruch bei Fehlern
    // gibt einfache HTML Seite aus mit Fehlerhinweisen
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    function print_scripterror($titel ''$fehlertext '') {

    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">

    <title><?php echo $titel?></title>

    <style type="text/css">
    body {
    background-color: #f7f7f7;
    font-family: Verdana, Arial;
    font-size: 12px;
    color: #000000;
    }
    .err {
    background-color: #000000;
    }
    .errtop {
    background-color: #ffcc00;
    font-size: 12px;
    color: #000000;
    padding: 4px;
    }

    .errcont {
    background-color: #ffffff;
    font-size: 12px;
    color: #000000;
    padding: 4px;
    }
    </style>

    </head>
    <body>
    <div align="center">
    <table cellspacing="1" cellpadding="0" border="0" width="600" class="err">
    <tr>
        <td class="errtop"><b><?php echo $titel?></b></td>
    </tr>
    <tr>
        <td class="errcont"><?php echo $fehlertext?></td>
    </tr>
    </table>
    </div>
    </body>
    </html>
    <?php
    exit;
    }
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //
    ?>
    _____________________________________________________________

    templates/style.css
    _____________________________________________________________
    PHP-Code:
    /* - - - - - - - - - - - - - - - - - - - - */
    /* BODY */
    /* - - - - - - - - - - - - - - - - - - - - */
    bodyhtml {
    background#000000;
    font-familyVerdanaArialsans-serif;
    font-size12px;
    color#000000;
    }
    /* - - - - - - - - - - - - - - - - - - - - */
    /* AEUSSERE CONTENTBOX */
    /* - - - - - - - - - - - - - - - - - - - - */
    #inhalt {
    margin:10px auto;
    text-align:left;
    width738px;
    padding0px;
    background#000000;
    }

    /* - - - - - - - - - - - - - - - - - - - - */
    /* DESIGNTABELLE*/
    /* - - - - - - - - - - - - - - - - - - - - */
    #design {
    width738px;
    background#000000;
    }

    #head {
    background-imageurl(../colorschemes/colorscheme1/images/static/bg_header.jpg);
    background-repeatno-repeat;
    height160px;
    text-aligncenter;
    color#ffffff;
    }

    #tnleft {

    background-imageurl(../colorschemes/colorscheme1/images/static/bg_sub_container1.gif);
    color#ecdc93;
    font-size14px;
    height32px;
    padding-right6px;
    background-repeatno-repeat;
    }
    #tnright {
    background-imageurl(../colorschemes/colorscheme1/images/static/bg_sub_container2.gif);
    color#ecdc93;
    font-size14px;
    }

    #menue {
    backgroundurl(images/dynamic/buttonset1/sub_nav.gif);
    background-image:url(../colorschemes/colorscheme1/images/static/bg_main_container3.gif);
    background-repeat:repeat-y;
    padding-right6px;
    color#000000;
    vertical-aligntop;
    }

    .
    menuelinks a {
    displayblock;
    width187px;
    background-image:url(../images/dynamic/buttonset1/sub_nav.gif);
    height26px;
    color#000000;
    font-size10px;
    font-weightbold;
    text-indent18px;
    text-decorationnone;
    line-height26px;

    }

    .
    menuelinks a:hover {
    background-image:url(../images/dynamic/buttonset1/sub_nav_active.gif);
    text-decorationnone;
    text-indent18px;
    line-height26px;
    }

    .
    menuelinks .aktuell {
    displayblock;
    width187px;
    background-image:url(../images/dynamic/buttonset1/sub_nav_active.gif);
    height26px;
    font-size10px;
    font-weightbold;
    text-indent18px;
    line-height26px;
    }

    #untermenue {
    backgroundurl(images/dynamic/buttonset1/unter_nav.gif);
    background-image:url(../colorschemes/colorscheme1/images/static/bg_main_container3.gif);
    background-repeat:repeat-y;
    padding-right6px;
    color#000000;
    vertical-aligntop;
    }

    .
    untermenuelinks a {
    displayblock;
    width187px;
    background-image:url(../images/dynamic/buttonset1/unter_nav.gif);
    height26px;
    color#000000;
    font-size10px;
    font-weightbold;
    text-indent18px;
    text-decorationnone;
    line-height26px;

    }

    .
    untermenuelinks a:hover {
    background-image:url(../images/dynamic/buttonset1/unter_nav_active.gif);
    text-decorationnone;
    text-indent18px;
    line-height26px;
    }

    .
    untermenuelinks .aktuell {
    displayblock;
    width187px;
    background-image:url(../images/dynamic/buttonset1/unter_nav_active.gif);
    height26px;
    font-size10px;
    font-weightbold;
    text-indent18px;
    line-height26px;
    }

    #unter2menue {
    backgroundurl(images/dynamic/buttonset1/unter2_nav.gif);
    background-image:url(../colorschemes/colorscheme1/images/static/bg_main_container3.gif);
    background-repeat:repeat-y;
    padding-right6px;
    color#000000;
    vertical-aligntop;
    }

    .
    unter2menuelinks a {
    displayblock;
    width187px;
    background-image:url(../images/dynamic/buttonset1/unter2_nav.gif);
    height26px;
    color#000000;
    font-size10px;
    font-weightbold;
    text-indent18px;
    text-decorationnone;
    line-height26px;

    }

    .
    unter2menuelinks a:hover {
    background-image:url(../images/dynamic/buttonset1/unter2_nav_active.gif);
    text-decorationnone;
    text-indent18px;
    line-height26px;
    }

    .
    unter2menuelinks .aktuell {
    displayblock;
    width187px;
    background-image:url(../images/dynamic/buttonset1/unter2_nav_active.gif);
    height26px;
    font-size10px;
    font-weightbold;
    text-indent18px;
    line-height26px;
    }

    #content {
    background-image:url(../colorschemes/colorscheme1/images/static/bg_main_container.gif);
    vertical-aligntop;
    padding10px 10px 10px 10px;
    }

    #content a:visited {
      
    text-decorationnone;
      
    color#c73b00;
    }
    #content a:link {
      
    text-decorationnone;
      
    color#c73b00;
    }
    #content a:hover {
      
    text-decorationunderline;
      
    color#c73b00;
    }
    #content a:active {
      
    text-decorationnone;
      
    color#c73b00;
    }

    #footer {
    background-image:url(../colorschemes/colorscheme1/images/static/bg_footer.gif);
    color#ffffff;
    text-aligncenter;

    _________________________________________________________________

    Danke schonmal für die Hilfe

    LG Techniker
    Geändert von techniker (16.02.08 um 18:33 Uhr)
     

  2. #2
    Avatar von Bratkartoffel
    Bratkartoffel Bratkartoffel ist offline gebratene Kartoffel
    tutorials.de Premium-User
    Registriert seit
    Jun 2007
    Ort
    Passau (Niederbayern)
    Beiträge
    1.394
    1. Bitte den Code erst mit den entprechenden Codetags formatieren, sonst wird sich keiner die Mühe machen den ewig langen Code zu lesen und dir helfen.
    2. Kürze das ganze bitte mal auf 2-3 Menüpunkte, wir brauchen eh nicht alles.
    3. Aber hier mal ein Tip: Warum eine Ellenlange "IF-ELSEIF-ELSEIF..." Anweisung, das ganze kann man um einiges schöner und kürzer auch per switch-case machen.
    Geändert von Bratkartoffel (16.02.08 um 18:27 Uhr)
     
    Über eine gute Bewertung freut sich jeder ;)
    Bitte erledigte Threads als "Erledigt" markieren.

    "Though a program be but three lines long, someday it will have to be maintained.''
    -- Geoffrey James, "The Tao of Programming"

  3. #3
    Registriert seit
    Dec 2002
    Ort
    Trier
    Beiträge
    17.502
    Blog-Einträge
    10
    Für mich scheint das eher ein CSS-Problem zu sein.
     
    Markus Wulftange

  4. #4
    techniker techniker ist offline Rookie
    Registriert seit
    Jul 2003
    Ort
    asd
    Beiträge
    6
    HUHU

    Ja das hab ich mir auch gedacht. Aber ich bekomm die Unterpunkte nicht mit der CSS verknüfpt.

    In der style.css sthen die Untermenüs schon drin. Aber ich weiss nicht wie ich die mit den richtigen Punkten verknüpfen soll.

    LG Techniker
     

Ähnliche Themen

  1. Hilfe - Quellcode funktioniert nicht
    Von knibbel11 im Forum C/C++
    Antworten: 10
    Letzter Beitrag: 26.09.08, 10:35
  2. [VC++ 6.0] Hilfe zu Fehlern im Quellcode!
    Von berwing im Forum C/C++
    Antworten: 0
    Letzter Beitrag: 13.01.08, 01:26
  3. [C++] Quellcode Hilfe für winforms
    Von blotte im Forum C/C++
    Antworten: 2
    Letzter Beitrag: 02.09.06, 14:09
  4. Quellcode bitte erklären
    Von BiggJoee im Forum Visual Basic 6.0
    Antworten: 5
    Letzter Beitrag: 28.07.04, 16:10
  5. BITTE BITTE HILFE ''Laufzeitfehler 713'
    Von anyaa im Forum Visual Basic 6.0
    Antworten: 2
    Letzter Beitrag: 26.04.04, 10:44