![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 72 Pomógł: 0 Dołączył: 7.08.2003 Skąd: czwa Ostrzeżenie: (0%) ![]() ![]() |
Jak w termacie, w ogole nic mi sie nie wyswietla, ani ze blad, ani kod. Rozszerzenie stony to .php.
-------------------- Czy tak bedzie juz zawsze????
|
|
|
![]()
Post
#2
|
|
![]() Grupa: Przyjaciele php.pl Postów: 2 335 Pomógł: 6 Dołączył: 7.03.2002 Ostrzeżenie: (0%) ![]() ![]() |
Ke ?
JavaScritpt jest dolaczany do XHTMLa a nie jako czesc samego php. Poza tym podj jakis kod jak to wstawiasz i co wogole ten skrypt ma robic. |
|
|
![]()
Post
#3
|
|
![]() Grupa: Przyjaciele php.pl Postów: 1 789 Pomógł: 41 Dołączył: 30.10.2003 Skąd: Wrocław Ostrzeżenie: (0%) ![]() ![]() |
Jezeli strona jest z rozszeżeniem php to musisz wpisac:
[php:1:efce2f348c]<?php echo "<script>"; echo "tu tresc....."; echo "</script>"; ?>[/php:1:efce2f348c] to powinno działać.... |
|
|
![]()
Post
#4
|
|
![]() Grupa: Przyjaciele php.pl Postów: 2 335 Pomógł: 6 Dołączył: 7.03.2002 Ostrzeżenie: (0%) ![]() ![]() |
albo tak:
[php:1:be060438f6]print <<<STR <script Language='JavaScript'> // tresc </script> STR;[/php:1:be060438f6] |
|
|
![]()
Post
#5
|
|
![]() Grupa: Zarejestrowani Postów: 72 Pomógł: 0 Dołączył: 7.08.2003 Skąd: czwa Ostrzeżenie: (0%) ![]() ![]() |
chce wrzucic takie 2 zwykle skrypty : pierwszy to pokazuje jaki dzien tygodnia i godzine. Jak mam tak to wyskakuje blad :"Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /www/user/elfotomedia/sklep/includes/header.php on line 65"
Kod <?php
echo "<script language="JavaScript">"; echo "<!-- Hide it // Returns today's date in a string with full day and month names DayName = new Array(7) DayName[0] = " Niedziela " DayName[1] = " Poniedziałek " DayName[2] = " Wtorek " DayName[3] = " ¦roda " DayName[4] = " Czwartek " DayName[5] = " Pi±tek " DayName[6] = " Sobota " MonthName = new Array(12) MonthName[0] = " Stycznia " MonthName[1] = " Luty " MonthName[2] = " Marzec " MonthName[3] = " Kwiecień " MonthName[4] = " Maj " MonthName[5] = " Czerwiec " MonthName[6] = " Lipiec " MonthName[7] = " Sierpień " MonthName[8] = " Wrzesień " MonthName[9] = " PaĽdziernik " MonthName[10] = " Listopad " MonthName[11] = " Grudzień " function getDateStr(){ var Today = new Date() var WeekDay = Today.getDay() var Month = Today.getMonth() var Day = Today.getDate() var Year = Today.getYear() if(Year <= 1000) Year += 1900 return DayName[WeekDay] + " " + " " + Day + " " + MonthName[Month] + " " + Year } //--> </script> </p> <font face="Arial"><!--mstheme--></font><div align="center"><center> <table CELLSPACING="0" BORDER="0" CELLPADDING="4" WIDTH="750"> <tr> <td VALIGN="TOP" width="205" align="center"><!--mstheme--><font face="Arial"><p align="left"> <script>document.write("" + getDateStr())</script> <script> <!-- /////////////////////////////////////////////////////////// /////////////// CONFIGURATION ///////////////////////////// // Set the clock's font face: var myfont_face = "Arial"; var myback_color = "#FFFFFF"; // Set the clock's font size (in point): var myfont_size = "13"; // Set the clock's font color: var myfont_color = "#000000"; // Set the clock's background color: // Set the text to display before the clock: var mypre_text = ""; // Set the width of the clock (in pixels): var mywidth = 65; // Display the time in 24 or 12 hour time? // 0 = 24, 1 = 12 var my12_hour = 0; // How often do you want the clock updated? // 0 = Never, 1 = Every Second, 2 = Every Minute // If you pick 0 or 2, the seconds will not be displayed var myupdate = 1; // Display the date? // 0 = No, 1 = Yes var DisplayDate = 0; /////////////// END CONFIGURATION ///////////////////////// /////////////////////////////////////////////////////////// // Global varibale definitions: var dn = ""; var mn = ""; var old = ""; // The following arrays contain data which is used in the clock's // date function. Feel free to change values for Days and Months // if needed (if you wanted abbreviated names for example). var DaysOfWeek = new Array(7); DaysOfWeek[0] = "Niedziela"; DaysOfWeek[1] = "Poniedzialek"; DaysOfWeek[2] = "Wtorek"; DaysOfWeek[3] = "Sroda"; DaysOfWeek[4] = "Czwartek"; DaysOfWeek[5] = "Piatek"; DaysOfWeek[6] = "Sobota"; var MonthsOfYear = new Array(12); MonthsOfYear[0] = "Stycznia"; MonthsOfYear[1] = "Lutego"; MonthsOfYear[2] = "Marca"; MonthsOfYear[3] = "Kwietnia"; MonthsOfYear[4] = "Maja"; MonthsOfYear[5] = "Czerwca"; MonthsOfYear[6] = "Lipca"; MonthsOfYear[7] = "Sierpnia"; MonthsOfYear[8] = "Wrzesnia"; MonthsOfYear[9] = "Pazdziernika"; MonthsOfYear[10] = "Listopada"; MonthsOfYear[11] = "Grudnia"; // This array controls how often the clock is updated, // based on your selection in the configuration. var ClockUpdate = new Array(3); ClockUpdate[0] = 0; ClockUpdate[1] = 1000; ClockUpdate[2] = 60000; // For Version 4+ browsers, write the appropriate HTML to the // page for the clock, otherwise, attempt to write a static // date to the page. if (document.all) { document.write('<span id="LiveClockIE" style="width:'+mywidth+'px; background-color:'+myback_color+'"></span>'); } else if (document.layers) { document.write('<ilayer bgColor="'+myback_color+'" id="ClockPosNS" visibility="hide"><layer width="'+mywidth+'" id="LiveClockNS"></layer></ilayer>'); } else { old = "true"; show_clock(); } // The main part of the script: function show_clock() { if (old == "die") { return; } //show clock in NS 4 if (document.layers) document.ClockPosNS.visibility="show" // Get all our date variables: var Digital = new Date(); var day = Digital.getDay(); var mday = Digital.getDate(); var month = Digital.getMonth(); var hours = Digital.getHours(); var minutes = Digital.getMinutes(); var seconds = Digital.getSeconds(); // Fix the "mn" variable if needed: if (mday == 1) { mn = ""; } else if (mday == 2) { mn = ""; } else if (mday == 3) { mn = ""; } else if (mday == 21) { mn = ""; } else if (mday == 22) { mn = ""; } else if (mday == 23) { mn = ""; } else if (mday == 31) { mn = ""; } // Set up the hours for either 24 or 12 hour display: if (my12_hour) { dn = "AM"; if (hours > 12) { dn = "PM"; hours = hours - 12; } if (hours == 0) { hours = 12; } } else { dn = ""; } if (minutes <= 9) { minutes = "0"+minutes; } if (seconds <= 9) { seconds = "0"+seconds; } // This is the actual HTML of the clock. If you're going to play around // with this, be careful to keep all your quotations in tact. myclock = ''; myclock += '<font style="color:'+myfont_color+'; font-family:'+myfont_face+'; font-size:'+myfont_size+'pt;">'; myclock += mypre_text; myclock += hours+':'+minutes; if ((myupdate < 2) || (myupdate == 0)) { myclock += ':'+seconds; } myclock += ' '+dn; if (DisplayDate) { myclock += '<br> '+DaysOfWeek[day]+', '+mday+mn+' '+MonthsOfYear[month]; } myclock += '</font>'; if (old == "true") { document.write(myclock); old = "die"; return; } // Write the clock to the layer: if (document.layers) { clockpos = document.ClockPosNS; liveclock = clockpos.document.LiveClockNS; liveclock.document.write(myclock); liveclock.document.close(); } else if (document.all) { LiveClockIE.innerHTML = myclock; } if (myupdate != 0) { setTimeout("show_clock()",ClockUpdate[myupdate]); } } (+show_clock()) //-->"; echo "</script>"; ?> -------------------- Czy tak bedzie juz zawsze????
|
|
|
![]()
Post
#6
|
|
![]() Grupa: Przyjaciele php.pl Postów: 2 335 Pomógł: 6 Dołączył: 7.03.2002 Ostrzeżenie: (0%) ![]() ![]() |
Zauwaz, ze w skrypcie JS masz " , wiec wrzucajac takie cos do echo parser uznaje to za zakonczenie stringa. Najlatwiej zrob to w ten sposb, ze skrypt trzymasz w oobnym pliku i dajesz tylko <script language='JavaScript' src='sciezka do skryptu' /> i wtedy tylko to wrzucasz do echa.
|
|
|
![]()
Post
#7
|
|
Grupa: Zarejestrowani Postów: 1 Pomógł: 0 Dołączył: 23.11.2003 Skąd: Szczebrzeszyn Ostrzeżenie: (0%) ![]() ![]() |
albo przed cudzysłowem wstaw "" (backslash) potem będzie to wyglądało "
:!: Tylko nie wstawiaj tego do komendy echo czy innych poleceń php. Stosuj to tylko tam gdzie php wypisuje wartości znaczników HTML lub XHTML -------------------- Pisanie programów komputerowych jest sztuką natomiast uruchamianie zmorą :P
|
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 19.07.2025 - 04:00 |