H1v3r Posted February 18, 2005 Report Posted February 18, 2005 Lieta taada: uztaisiju format c: savam kompitim un windows 2k vietaa uzmetu XP. Uzmetu atkal apache + php + mysql , konfigureeju cik atceros un kaa maaceeju , bet php tikai uzinstaleeju un pashu php.ini neaiztiku. Probleema tada: dazhas php lapas kuras pirmstam pilniigi normaali straadaaja tagad vai nu nestraadaa vai met aaraa errorus... piemeeram taadus: Use of undefined constant news - assumed 'news' in D:\Web\BMXCesis_new\index.php on line 21 Varbuut kaut kas bija arii ar to php.ini jaadara ?? Ludzu dodiet kadu padomu ja varat :(
Robis Posted February 18, 2005 Report Posted February 18, 2005 Lieta taada: uztaisiju format c: savam kompitim un windows 2k vietaa uzmetu XP. Uzmetu atkal apache + php + mysql , konfigureeju cik atceros un kaa maaceeju , bet php tikai uzinstaleeju un pashu php.ini neaiztiku. Probleema tada: dazhas php lapas kuras pirmstam pilniigi normaali straadaaja tagad vai nu nestraadaa vai met aaraa errorus... piemeeram taadus: Use of undefined constant news - assumed 'news' in D:\Web\BMXCesis_new\index.php on line 21 Varbuut kaut kas bija arii ar to php.ini jaadara ?? Ludzu dodiet kadu padomu ja varat :( 13896[/snapback] Vispirms ludzu parliecinies, vai Tev tiesham konstante news ir defineta ieprieksh, kura izmantota index.php 21 rindinja?
H1v3r Posted February 18, 2005 Author Report Posted February 18, 2005 (edited) <?php $page_id=news; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Jaunumi</a></td></tr>"); $page_id=members; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Tie esam mēs</a></td></tr>"); $page_id=club; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Klubā</a></td></tr>"); $page_id=results; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Rezultāti</a></td></tr>"); $page_id=sponsors; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Sponsori</a></td></tr>"); $page_id=archive; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Arhīvs</a></td></tr>"); ?> It kaa ir un velreiz saku ka pirms pc paarinstaleeshanas viss straadaaja Edited February 18, 2005 by H1v3r
Venom Posted February 18, 2005 Report Posted February 18, 2005 <?php $page_id=news; un kur tad define() vai include ar to?
H1v3r Posted February 18, 2005 Author Report Posted February 18, 2005 Ieveerteejiet luudzu: Lapas adrese: Links uz lapu Lapas koda adrese: Links uz kodu
hu_ha Posted February 18, 2005 Report Posted February 18, 2005 http://lv2.php.net/manual/en/function.constant.php define("MAXSIZE", 100); echo MAXSIZE; echo constant("MAXSIZE"); // same thing as the previous line tagad tev sanāk ka tu "news" konstanti piešķir $page_id, bet kur tad ir news vērtība!?
hu_ha Posted February 18, 2005 Report Posted February 18, 2005 es pieņemu, ka tu esi gribējis rakstīt kaut ko šādu: $page_id="news"; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Jaunumi</a></td></tr>");
Robis Posted February 18, 2005 Report Posted February 18, 2005 Nu Tev tak tur visa lapa ir ar vienu un to pašu kļūdu! Nomaini visiem: <?php $page_id="news"; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Jaunumi</a></td></tr>"); $page_id="members"; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Tie esam mēs</a></td></tr>"); $page_id=club; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Klubā</a></td></tr>"); $page_id=results; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Rezultāti</a></td></tr>"); $page_id=sponsors; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Sponsori</a></td></tr>"); $page_id=archive; echo ("<tr><td><a href=?dest=$page_id class=\"menu\">Arhīvs</a></td></tr>"); ?> Tā kā augšā ir parādīts ar news un members, ieliec arī visus pārējos pēdiņās!
H1v3r Posted February 18, 2005 Author Report Posted February 18, 2005 smiekliigi diezgan ir tas ka man pirmstam straadaaja arii bez peedinjaam ... anyway paldies par paliidziibu taadam laamem kaa man :D
H1v3r Posted February 18, 2005 Author Report Posted February 18, 2005 ehhh tomeer vienalga kaut kas nestraadaa kaa kaadreiz :(
Lynx Posted February 18, 2005 Report Posted February 18, 2005 (edited) Nesaprotu, kapec shaja gadijuma tu taa visu sarezgi :huh: Redz kur mans variants: <?php echo ' <tr><td><a href="?dest=news" class="menu">Jaunumi</a></td></tr> <tr><td><a href="?dest=members" class="menu">Tie esam mēs</a></td></tr> <tr><td><a href="?dest=club" class="menu">Klubā</a></td></tr> <tr><td><a href="?dest=results" class="menu">Rezultāti</a></td></tr> <tr><td><a href="?dest=sponsors" class="menu">Sponsori</a></td></tr> <tr><td><a href="?dest=archive" class="menu">Arhīvs</a></td></tr>'; ?> <?php if (!isset($_GET['dest'])) { include ("news.php"); } else { include ("$_GET['dest']".".php"); } ?> Edit: Un atbildot uz tiesho jautajumu, ja tu nevelies redzet error notices, bet velies parejos glukus, tad lieto koda sakumaa error_reporting (E_ALL ^ E_NOTICE); Edited February 18, 2005 by Lynx
bubu Posted February 18, 2005 Report Posted February 18, 2005 error_reporting() gan atstāj uz E_ALL! Mācīsimies tak vienreiz korektu kodu rakstīt.
Venom Posted February 19, 2005 Report Posted February 19, 2005 domājam par drošīu un elastitāti: $sadalas=array('news'=>'Jaunumi','members'=>'Tie esam mēs','club'=>'Klubā','results'=>'Rezultāt','sponsors'=>'Šponsori','archive'=>'Arhīvs'); if (!isset($_GET['dest']) || !isset($sadalas[$_GET['dest']])) $_GET['dest']='news'; include $_GET['dest'].'.php'; foreach($sadalas as $key=>$val) echo '<a '.($_GET['dest']==$key?' class="active"':'').' href="'.$_SERVER['PHP_SELF'].'?dest='.$key.'">'.$val.'</a>';
Roze Posted February 19, 2005 Report Posted February 19, 2005 error_reporting() gan atstāj uz E_ALL! Mācīsimies tak vienreiz korektu kodu rakstīt. Nu kā to ņem. Ja teiksim if($variable) vietā man jālieto isset() un vienmēr jāuztraucas par to vai $masivs[key] / $masivs['key'] ir korekti un definēts tad zūd php kā mazas netīras valodas pievilcība :)
Recommended Posts