Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]wstawianie skryptu daty
mark014
post
Post #1





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 1.08.2009
Skąd: Wielkopolska

Ostrzeżenie: (0%)
-----


Próbowałem już wiele razy i nie wiem już co może być źle wpisane, choć wiem, że pewnie sprawa jest banalnie prosta.
Chciałem zmodyfikować theme w moim cms i zamiast baneru wstawić skrypt z datą. Mam plik data.php osobno i teraz mam wstawić
  1. <? include ("data.php");?>
który w pliku theme.php ma się odnieść do tego pliku, ale właśnie tu trzeba coś zmodyfikować, bo pokazuje się błąd (expected "," or ";"). Oto fragment pliku theme, gdzie powinno być odniesienie:

  1. <?php
  2. function render_header($header_content) {
  3. global $theme_width,$settings;
  4.    
  5. echo "<table class='page' align='center' cellpadding='0' cellspacing='0'><tr>
  6. <td class='border_left' rowspan='6'> </td>
  7. <td class='top_nav' colspan='3'> </td>
  8. <td class='border_right' rowspan='6'> </td></tr>
  9. <tr><td style='vertical-align:top;' class='header' colspan='3'>
  10. <div id='header'><div class='slogan'></div>
  11. <div class='moto'></div>
  12. <div class='logo'><a target='_blank' href='".BASEDIR."index.php'>
  13. <img src='".THEME."images/header.jpg' alt='".$settings[sitename]."' title='".$settings[sitename]."' style='border: 0pt none ;' width='468' height='60'></a></div>
  14. </div></td></tr>
  15. <tr><td id='navigation' class='sub_nav'>
  16. <table border='0' cellpadding='0' cellspacing='0' width='100%'><tr>
  17. <td class='sub_nav' width='100%'>".showsublinks("","navigation")."
  18. </td></tr>
  19. </table>
  20. </td></tr>
  21. <tr><td class='filler_nav' colspan='3'> </td></tr>
  22. <tr><td valign='top'>
  23. <table width='100%' cellpadding='0' cellspacing='0' border='0' align='center'><tr>";
  24. }
  25.  
  26. function render_footer($license=false) {
  27. global $theme_width, $settings;
  28. ?>


Ten skrypt ma zastąpić obiekt z klasy slogan. Będę wdzięczny za pomoc, bo nie jestem jak widać najlepszy w php (IMG:http://forum.php.pl/style_emoticons/default/sadsmiley02.gif) .
Go to the top of the page
+Quote Post
hedrazer
post
Post #2





Grupa: Zarejestrowani
Postów: 15
Pomógł: 1
Dołączył: 27.03.2009
Skąd: Pułtusk

Ostrzeżenie: (0%)
-----


nie rozumiem twojego problemu, moze dlatego ze go nie widac...

jezeli echujesz (echo) ciag znakow i chcesz pomiedzy ten ciag wstawic funkcje include musisz go podzielic na 2 tzn
  1. <?php
  2. echo "<div> cos tam na poczatku";
  3. include ("plik.inc.php");
  4. echo "dalszy ciag </div>";
  5. ?>


o to chodzi ?
Go to the top of the page
+Quote Post
mark014
post
Post #3





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 1.08.2009
Skąd: Wielkopolska

Ostrzeżenie: (0%)
-----


Wiem jak wstawić sam skrypt, ale chcę go wstawić w konkretne miejsce na stronie, z czym jest już gorzej. Podam może przykład tego thema http://www.wyspa-socjologow.wspa.pl/news.php Ja chcę akurat zamiast napisu www.wyspa-socjologów.pl lub "Koło naukowe ... " wstawić skrypt by pokazywał datę (w skrypcie który podałem wyżej odpowiadają klasie "slogan" i "moto"). Chcę też wstawić tam info o imieninach, ale na razie męczę się z datą...

Dzięki za odpowiedź

Ten post edytował mark014 1.08.2009, 08:56:45
Go to the top of the page
+Quote Post
hedrazer
post
Post #4





Grupa: Zarejestrowani
Postów: 15
Pomógł: 1
Dołączył: 27.03.2009
Skąd: Pułtusk

Ostrzeżenie: (0%)
-----


to nie jest problem PHP, tylko HTML i CSS, ten napis jest rzucony na tlo komorki tabeli przez CSS ( background-image: )
musisz przebudować sobie nagłówek.
Go to the top of the page
+Quote Post
mark014
post
Post #5





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 1.08.2009
Skąd: Wielkopolska

Ostrzeżenie: (0%)
-----


W styles.css modyfikowałem fragment:
  1. #header { position:relative }
  2. .header { height:75px; background-image: url(images/main_head_bg.jpg) }
  3. .datetime {
  4. font-family: Tahoma, Arial, helvetica, serif;
  5. font-size:10px;
  6. color:#444;
  7. padding-right:10px;
  8. }
  9. .slogan { position:absolute; top:0px; right:5px; width:303px; height:37px; background-image: url(images/slogan.jpg) }
  10. .slogan span { display:none }
  11. .moto { position:absolute; top:38px; right:5px; width:214px; height:18px; background-image: url(images/moto.jpg) }
  12. .moto span { display:none }
  13. .logo { position:absolute; bottom:0px; top:-7px; left:5px; width:468px; height:60px; overflow:hidden }
  14. .footer { padding-top: 15px; padding-bottom: 4px; font: normal 11px tahoma, verdana, arial, sans-serif; text-align: center; color:#333; background: #FFFFFF url(images/footer_bg.jpg) top left repeat-x }


Zmieniłem część na:

  1. .datetime { position:absolute; top:38px; right:5px;width:214px; height:18px;
  2. font-family: Tahoma, Arial, helvetica, serif;
  3. font-size:10px;
  4. color:#444;
  5. padding-right:10px;
  6. }
  7. .datetime span { display:none }
  8. .slogan { position:absolute; top:0px; right:5px; width:303px; height:37px; background-image: url(images/slogan.jpg) }
  9. .slogan span { display:none }


No i ta data się wyświetla, ale bezpośrednio nad menu, a nie obok loga...

Ten post edytował mark014 1.08.2009, 10:13:22
Go to the top of the page
+Quote Post
marian2299
post
Post #6





Grupa: Zarejestrowani
Postów: 272
Pomógł: 9
Dołączył: 6.06.2009

Ostrzeżenie: (0%)
-----


Jak chcesz coś mieć obok loga, to wstaw:
  1. <div class='logo'><a target='_blank' href='".BASEDIR."index.php'>
  2. <img src='".THEME."images/header.jpg' alt='".$settings[sitename]."' title='".$settings[sitename]."' style='border: 0pt none ;' width='468' height='60'></a>TUTAJ!</div>
Go to the top of the page
+Quote Post
mark014
post
Post #7





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 1.08.2009
Skąd: Wielkopolska

Ostrzeżenie: (0%)
-----


Wstawiłem tam
  1. <?php include ("plik.inc.php"); ?>

ale wyskakuje błąd, poza tym zdaje mi się, że efekt skryptu pojawi się bezpośrednio obok loga, a ja chciałbym by to było w miejsce pod krokami po prawej, gdzie na przykładowej stronie są napisy...
Go to the top of the page
+Quote Post
marian2299
post
Post #8





Grupa: Zarejestrowani
Postów: 272
Pomógł: 9
Dołączył: 6.06.2009

Ostrzeżenie: (0%)
-----


Cytat(mark014 @ 1.08.2009, 20:44:53 ) *
Wstawiłem tam
  1. <?php include ("plik.inc.php"); ?>

ale wyskakuje błąd, poza tym zdaje mi się, że efekt skryptu pojawi się bezpośrednio obok loga, a ja chciałbym by to było w miejsce pod krokami po prawej, gdzie na przykładowej stronie są napisy...

Nie dziwie się, bo pewnie nie masz pliku "plik.inc.php".
Wstaw
  1. <? include ("data.php");?>
.

A gdzie to ci powiem, jak dasz link do strony, bo nie rozumiem o które miejsce ci chodzi.
Poza tym napisałeś "ale bezpośrednio nad menu, a nie obok loga... " wywnioskowałem, że chodzi ci o miejsce obok loga.

Dobra, chyba wiem:
  1. <?php
  2. function render_header($header_content) {
  3. global $theme_width,$settings;
  4.  
  5. echo "<table class='page' align='center' cellpadding='0' cellspacing='0'><tr>
  6. <td class='border_left' rowspan='6'> </td>
  7. <td class='top_nav' colspan='3'> </td>
  8. <td class='border_right' rowspan='6'> </td></tr>
  9. <tr><td style='vertical-align:top;' class='header' colspan='3'>
  10. <div id='header'><div class='slogan'></div>
  11. <div class='moto'></div>
  12. <a target='_blank' href='".BASEDIR."index.php'><div class='logo' style='background-image: url(".THEME."images/header.jpg);'>
  13. <p style='vertical-align: middle; text-align: right; margin-right: 20px;'>include ("data.php");</p></div></a>
  14. </div></td></tr>
  15. <tr><td id='navigation' class='sub_nav'>
  16. <table border='0' cellpadding='0' cellspacing='0' width='100%'><tr>
  17. <td class='sub_nav' width='100%'>".showsublinks("","navigation")."
  18. </td></tr>
  19. </table>
  20. </td></tr>
  21. <tr><td class='filler_nav' colspan='3'> </td></tr>
  22. <tr><td valign='top'>
  23. <table width='100%' cellpadding='0' cellspacing='0' border='0' align='center'><tr>";
  24. }
  25.  
  26. function render_footer($license=false) {
  27. global $theme_width, $settings;
  28. ?>


Powinno działać, miejsce określ sobie "left: XXpx; right: XXpx;" itp

Ten post edytował marian2299 1.08.2009, 21:17:55
Go to the top of the page
+Quote Post
mark014
post
Post #9





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 1.08.2009
Skąd: Wielkopolska

Ostrzeżenie: (0%)
-----


Właśnie znowu wyskoczył błąd:
Cytat
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/s/l/e/slesin/www/themes/Entourage/theme.php on line 47



Linia 47, bo plik jest większy, całego nie wklejałem. Błąd odnosi się do tego include'a, że jest chyba źle wstawiony. Oczywiście plik data.php jestw tym samym folderze co theme.php, zresztą skrypt działał, ale nie w tym miejscu co miał. To jest theme Entourage od php-fusion. Ten plik.inc.php, akurat źle tu wkleiłem, w pliku zmieniłem na data.pl. Skrypt wyświetla się gdy da się
  1. <?php
  2. include ("data.php");
  3. ?>
kiedy jest poza obrębem tych tabel z logiem.
Chciałem by data była tam gdzie na stronie <a href="http://www.wyspa-socjologow.wspa.pl/news.php" target="_blank">http://www.wyspa-socjologow.wspa.pl/news.php</a> jest napis "Koło naukowe studentów socjologii". Swojej strony nie podaję, bo tam mam innego thema, więc i pliki są nie te, no i jest inny układ.

Może trzeba zmienić faktycznie coś w styles.css, bo to ma być w miejscu, gdzie już jest baner z napisem...

Ten post edytował mark014 2.08.2009, 19:04:30
Go to the top of the page
+Quote Post
iVorIus
post
Post #10





Grupa: Zarejestrowani
Postów: 145
Pomógł: 18
Dołączył: 11.11.2008
Skąd: Pwo

Ostrzeżenie: (0%)
-----


Nie miałem problemu z themami PHP-Fusion:

  1. <?php
  2.  
  3. echo '<div id="data-do-wstawienia">'; // początek diva na date
  4. include('data.php'); // wklejamy date w środek treść diva
  5. echo '</div>'; // zamykamy diva razem z datą
  6. ?>
Go to the top of the page
+Quote Post
marian2299
post
Post #11





Grupa: Zarejestrowani
Postów: 272
Pomógł: 9
Dołączył: 6.06.2009

Ostrzeżenie: (0%)
-----


Cytat
Chciałem by data była tam gdzie na stronie <a href="http://www.wyspa-socjologow.wspa.pl/news.php" target="_blank">http://www.wyspa-socjologow.wspa.pl/news.php</a> jest napis "Koło naukowe studentów socjologii".

To jest obrazek ;].

Jeżli ma zastąpić obiekt z klasy slogan, to:
  1. <?php
  2. function render_header($header_content) {
  3. global $theme_width,$settings;
  4.  
  5. echo "<table class='page' align='center' cellpadding='0' cellspacing='0'><tr>
  6. <td class='border_left' rowspan='6'> </td>
  7. <td class='top_nav' colspan='3'> </td>
  8. <td class='border_right' rowspan='6'> </td></tr>
  9. <tr><td style='vertical-align:top;' class='header' colspan='3'>
  10. <div id='header'><div class='slogan'>"; include('data.php'); echo"</div>
  11. <div class='moto'></div>
  12. <div class='logo'><a target='_blank' href='".BASEDIR."index.php'>
  13. <img src='".THEME."images/header.jpg' alt='".$settings[sitename]."' title='".$settings[sitename]."' style='border: 0pt none ;' width='468' height='60'></a></div>
  14. </div></td></tr>
  15. <tr><td id='navigation' class='sub_nav'>
  16. <table border='0' cellpadding='0' cellspacing='0' width='100%'><tr>
  17. <td class='sub_nav' width='100%'>".showsublinks("","navigation")."
  18. </td></tr>
  19. </table>
  20. </td></tr>
  21. <tr><td class='filler_nav' colspan='3'> </td></tr>
  22. <tr><td valign='top'>
  23. <table width='100%' cellpadding='0' cellspacing='0' border='0' align='center'><tr>";
  24. }
  25.  
  26. function render_footer($license=false) {
  27. global $theme_width, $settings;
  28. ?>
Go to the top of the page
+Quote Post
iVorIus
post
Post #12





Grupa: Zarejestrowani
Postów: 145
Pomógł: 18
Dołączył: 11.11.2008
Skąd: Pwo

Ostrzeżenie: (0%)
-----


Marian a co ja napisałem (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

Niech pomyśli trochę i sam wykombinuje rozwiązanie.

'Daj człowiekowi rybę, nakarmisz go na jeden dzień, naucz go łowić, nakarmisz go na całe życie.'
Go to the top of the page
+Quote Post
marian2299
post
Post #13





Grupa: Zarejestrowani
Postów: 272
Pomógł: 9
Dołączył: 6.06.2009

Ostrzeżenie: (0%)
-----


Cytat
'Daj człowiekowi rybę, nakarmisz go na jeden dzień, naucz go łowić, nakarmisz go na całe życie.'

Widziałem to u kogoś w podpisie ;].
Go to the top of the page
+Quote Post
mark014
post
Post #14





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 1.08.2009
Skąd: Wielkopolska

Ostrzeżenie: (0%)
-----


Działa. Wielkie dzięki! Sam sens znałem. Też wstawiałem tam include'a, ale był źle zapisany.

Cytat(iVorIus @ 2.08.2009, 20:45:30 ) *
Niech pomyśli trochę i sam wykombinuje rozwiązanie.

'Daj człowiekowi rybę, nakarmisz go na jeden dzień, naucz go łowić, nakarmisz go na całe życie.'

Dzięki. Też się z tym zgadzam (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) Po Twoim poście już chyba bym sam doszedł.

Ten post edytował mark014 2.08.2009, 21:16:39
Go to the top of the page
+Quote Post
iVorIus
post
Post #15





Grupa: Zarejestrowani
Postów: 145
Pomógł: 18
Dołączył: 11.11.2008
Skąd: Pwo

Ostrzeżenie: (0%)
-----


Cytat
Widziałem to u kogoś w podpisie ;].

Ja też i uważam, że cytat daje do myślenia, dlatego go zapamiętałem (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 12.10.2025 - 20:42