include Newsscript P-News V²

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • include Newsscript P-News V²

    Hallo,
    ich habe mir das News Script P-News V² herunter geladen und installiert. Dann bin ich wie in der Readme steht vorgegangen und wollte es per Include in meine index.php einbauen.

    Ich habe die news.php bearbeitet:
    PHP-Code:
    $mainPath 'news'
    und in meine index.php folgenden Code eingefügt:

    PHP-Code:
    <?php if($_GET['action'] == 'news'){ include("news/news.php"); } ?>
    Wenn ich jetzt die index.php aufrufe wird das Script nicht angezeigt. Rufe ich die index.php allerdings mit dem Angang index.php?action=news auf erscheint das Script.

    Was kann ich machen damit das Script gleich in der index.php erscheint?

  • #2
    Hi,

    Versuch doch folgendes in deine Index einzubauen:
    if ($_GET['action'] == "")
    {
    $_GET['action'] = 'news');
    }

    Gruß Thomas

    Kommentar


    • #3
      PHP-Code:
      if(emtpy(trim($_GET['action'])) XOR isset($_GET['action']) === false){
          
      header('Location: [url]http://www.meine_seite.de/index.php?action=news[/url]');
          exit;
      else{
         
      //action müsste gesetzt und nicht leer sein

      Gruss

      tobi
      Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

      [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
      Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

      Kommentar


      • #4
        Original geschrieben von Alrik
        Hi,

        Versuch doch folgendes in deine Index einzubauen:
        if ($_GET['action'] == "")
        {
        $_GET['action'] = 'news');
        }

        Gruß Thomas
        Hallo Thomas wenn ich deinen Code verwende erhalte ich folgene Fehlermelung:
        Parse error: syntax error, unexpected ')' in www/htdocs/.... index.php on line 71.

        Ich glaube vor news fehlt eine Klammer:

        PHP-Code:
        <?php if ($_GET['action'] == "") { $_GET['action'] = ('news'); } ?>
        Allerdings bleibt dann das Feld leer wo das Script einfügt werden soll.

        @ Tobi

        bei deinem Code erhalte ich folgende Fehlermeldung:

        Parse error: syntax error, unexpected T_ELSE in www/htdocs/.... index.php on line 74.

        Kommentar


        • #5
          @topicstarter
          Dann bau einfach noch ne schliessende }-Klammer vor dem else ein.
          Sorry aber beim schnell tippen passiert sowat leider immer wieder mal

          sorry und gruss

          tobi
          Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

          [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
          Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

          Kommentar


          • #6
            Original geschrieben von jahlives
            @topicstarter
            Dann bau einfach noch ne schliessende }-Klammer vor dem else ein.
            Sorry aber beim schnell tippen passiert sowat leider immer wieder mal

            sorry und gruss

            tobi
            Klammer } habe ich vor else eingefügt. Jetzt erhalte ich diese Meldung:

            Fatal error: Call to undefined function: emtpy() in www/htdocs/.... index.php on line 71.

            Kommentar


            • #7
              Man kann empty() nur auf Variablen anwenden, nicht auf Ergebnisse von Funktionsaufrufen wie bspw. trim().
              I don't believe in rebirth. Actually, I never did in my whole lives.

              Kommentar


              • #8
                Ich denke der Fehler kam daher, dass ich den Fkt Namen falsch geschrieben habe. Oder ?
                Also besser
                PHP-Code:
                $test trim($_GET['action']);
                if(empty(
                $test) XOR isset($test) === false){
                ...

                Gruss

                tobi
                Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

                [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
                Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

                Kommentar

                Lädt...
                X