Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP] CuteNews i problem z menu
Forum PHP.pl > Forum > Przedszkole
Martinas
Uzywam CuteNews to zadządzania artykułami ale napotkałem dziwny problem, gdy wstawie artykuły przez
  1. <?php 
  2. $category = "1";
  3. $static = TRUE;
  4. include("news/show_news.php");
  5. ?>

Wszystko działa jak należy tzn można przeglądnąć cały artykuł po kliknieciu na link "wiecej" itd

problem pojawia sie gdy ten fragment wstawie do kody który obsluguje moje menu
  1. <a class="web" href="index.php?id=glowna">Strona główna</a>
  2.  
  3.  <?php
  4.  if(empty($_GET['id']) or $_GET['id']=="glowna"){
  5. $number = "3";
  6. $category = "1";
  7. $static = TRUE;
  8.  include("news/show_news.php");
  9.  }
  10.  
  11.  if($_GET['id']=="link1"){
  12.  include("data/site1.php");
  13.  }
  14.  
  15.  if($_GET['id']=="link2"){
  16.  include("data/site2.php");
  17.  }
  18.  ?>

Wtedy wyświetla tylko początkową zawartość a po kliknieciu na "wiecej", środkowy box jest pusty, mecze sie juz 2 dni z tym, i nie wiem co robie nie tak.
Z góry dzięki za pomoc


Cysiaczek
Popraw proszę tytuł topiku na zgodny z zasadami forum Przedszkole i dodaj bbcode
Martinas
No i znowu ja, zadałem moje wcześniejszcze pytanie na forum CuteNews, dostałem następująca odpowiedź, i tu prośba do was może ktoś mi to wytłumaczyć w bardziej przystępny sposób.
Cytat

That's because the generated link that CuteNews does won't put id=site1 in the query string.

Now there's an easy and a hard way to solve this, basically:
  • You can either create two files so that one only has CuteNews on it without requiring it to have some sort of id.
    This might be a hassle because you'd have to update two pages then when it comes to things like the header, footer and similar.
  • Instead of saying that ?id has to be defined, make CuteNews your default option. So having something like
    Kod
    <?php
       switch ($_GET['id']){
         case 'site2': include('data/site2.php'); break;
         default: include('cutenews/show_news.php'); break;
       }
       ?>
    [/php]
    would always make CuteNews go if ?id didn't match any case before. However watch out as CuteNews uses id to refer to a news article, but chances of you defining a page with a name as an article are very, very slim. (They're 10 digit numbers or more).
  • Edit the files so that the generated links of CuteNews will have that id thing defined. Now there's another problem you'll encounter, and that one is that CuteNews uses id to refer to the news article, so I suggest you change ?id you use on your site for navigation to something like ?page or similar - you get the idea.
    Yes, it is possible to edit every file so that the CuteNews use of id will be some other name, but you won't find anyone willing to do that on here as it's completely useless seeing that you could just rename the navigation.
Hope that helped.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.