Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php] błąd T_string
meteseron2
post 10.01.2016, 12:16:54
Post #1





Grupa: Zarejestrowani
Postów: 21
Pomógł: 0
Dołączył: 10.01.2016

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


Witam na początku pragnę dodąc ze jestem troche jeszcze zielony w tych sprawach i nie rozumiem za bardzo tego błedu dlatego prosze o pomoc.Błą jest następujący Parse error: syntax error, unexpected T_STRING on line 10
  1. <?php
  2.  
  3. define('imgFolder','galeria');
  4. define('emptylmgName','empty');
  5. define('extension','.jpg');
  6. define('imgCount,5);
  7. $prevlmgPath = $currentlmgPath = $nextlmgPath = imgFolder.'/'.
  8. epmtylmgName.extension;
  9.  
  10. $photolndex = (isset($_GET['photo'])&& $_GET['photo']<=imgCount)?
  11. intval($_GET['photo']):1;
  12. $left = ($photolndex>1)? true:false;
  13. $right = ($photolndex<imgCount)? true:false;
  14.  
  15. $prevlmgPath = imgFolder.'/'.str_pad(($photolndex-1),3,'0',
  16. STR_PAD_LEFT).'.jpg';
  17. $currentlmgPath = imgFolder.'/'.str_pad($photolndex,3,'0',
  18. STR_PAD_LEFT).'.jpg';
  19. $nextlmgPath = imgFolder.'/'.str_pad(($photolndex+1),3,'0',
  20. STR_PAD_LEFT).'.jpg';
  21. ?>
  22. <table id="galleryTable">
  23. <td width="15%">
  24. <tr> 
  25. <?php
  26. if($left)echo '<a href="index.php?a=galeria&photo='.($photolndex-1).
  27. ""><img id="prevlmg"src="".$prevlmgPath.""/></a>';else echo'<img
  28. src="".(imgFolder.'/'.emptylmgName.extension).""/>';?>
  29. </tr>


Ten post edytował meteseron2 10.01.2016, 12:17:32
Go to the top of the page
+Quote Post
qbson69
post 10.01.2016, 12:21:36
Post #2





Grupa: Zarejestrowani
Postów: 20
Pomógł: 7
Dołączył: 3.01.2016

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


Niezamknięty string w linii 6:
  1. define('imgCount,5);

powinno być:
  1. define('imgCount',5);


Ten post edytował qbson69 10.01.2016, 12:22:01
Go to the top of the page
+Quote Post
meteseron2
post 10.01.2016, 12:25:37
Post #3





Grupa: Zarejestrowani
Postów: 21
Pomógł: 0
Dołączył: 10.01.2016

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


Dziekuję lecz teraz wyszukuje bład w 27 wierszy a mianowicie
  1. if($left)echo '<a href="index.php?a=galeria&photo='.($photolndex-1).
  2. ""><img id="prevlmg"src="".$prevlmgPath.""/></a>';else echo'<img
  3. src="".(imgFolder.'/'.emptylmgName.extension).""/>';?>
coś tu musi nie grac ale nie wiem co sad.gif
Go to the top of the page
+Quote Post
qbson69
post 10.01.2016, 12:42:15
Post #4





Grupa: Zarejestrowani
Postów: 20
Pomógł: 7
Dołączył: 3.01.2016

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


Mieszasz cudzysłów z apostrofem - poczytaj o łączeniu stringów - na necie mnóstwo artykułów na ten temat. Do tego tak wpisany kod bez formatowania jest nieczytelny, proponuję coś takiego:
  1. if($left){
  2. echo '<a href="index.php?a=galeria&photo='.($photolndex-1).'"><img id="prevlmg" src="'.$prevlmgPath.'"/></a>';
  3. }
  4. else {
  5. echo '<img src="'.(imgFolder.'/'.emptylmgName.extension).'"/>';
  6. }


Przy okazji w linii 8 masz literówkę.

Ten post edytował qbson69 10.01.2016, 12:42:51
Go to the top of the page
+Quote Post
meteseron2
post 10.01.2016, 13:33:47
Post #5





Grupa: Zarejestrowani
Postów: 21
Pomógł: 0
Dołączył: 10.01.2016

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


a przy okazji zakończenie pisania tego skryptu w php natknąłem się na kolejny błąd otóż - chodzi mi o to aby zrobić galerie aby zdjęcie pierwsze było największe i po kliknięciu otwierało się w nowym oknie natomiast u mnie pierwsze zdjęcie działa natomiast gdy klikam drugie zdjęcie aby się powiększyło wywala mnie na stronę główna jaka może być tego przyczyna?TUtaj ta galeria : http://student.pwsz.elblag.pl/~16230/mri/galeria.php a tu kod
  1. <?php
  2.  
  3. define('imgFolder','galeria');
  4. define('emptylmgName','empty');
  5. define('extension','.jpg');
  6. define('imgCount',5);
  7. $prevlmgPath = $currentlmgPath = $nextlmgPath = imgFolder.'/'.
  8. emptylmgName.extension;
  9.  
  10. $photolndex = (isset($_GET['photo'])&& $_GET['photo']<=imgCount)?
  11. intval($_GET['photo']):1;
  12. $left = ($photolndex>1)? true:false;
  13. $right = ($photolndex<imgCount)? true:false;
  14.  
  15. $prevlmgPath = imgFolder.'/'.str_pad(($photolndex-1),3,'0',
  16. STR_PAD_LEFT).'.jpg';
  17. $currentlmgPath = imgFolder.'/'.str_pad($photolndex,3,'0',
  18. STR_PAD_LEFT).'.jpg';
  19. $nextlmgPath = imgFolder.'/'.str_pad(($photolndex+1),3,'0',
  20. STR_PAD_LEFT).'.jpg';
  21. ?>
  22. <table id="galleryTable">
  23. <td width="15%">
  24. <tr>&nbsp;
  25. <?php
  26. if($left){
  27. echo '<a href="index.php?a=galeria&photo='.($photolndex-1).'"><img id="prevlmg" src="'.$prevlmgPath.'"/></a>';
  28. }
  29. else {
  30. echo '<img src="'.(imgFolder.'/'.emptylmgName.extension).'"/>';
  31. }?>
  32.  
  33. </tr>
  34. </td>
  35. <td width="68%">
  36. <tr>
  37. <a href="<?=$currentlmgPath;?>"target="_blank"><img id=
  38. "currentlmg"src="<?=$currentlmgPath;?>"/></a>
  39. </tr>
  40. </td>
  41. <td width="15%"style="min-width:150px;">
  42. <tr>
  43. <?php if($right)echo '<a href="index.php?a=galeria&photo='.(
  44. $photolndex+1).'"><img id="nextlmg"src="'.$nextlmgPath.'"/></a>';
  45. ?>
  46. </tr>
  47. </td>
  48. </table>
  49. <style>
  50. #galleryTable td{vertical-align:top;}
  51. #currentlmg{width:30%}
  52. #prevlmg,#nextlmg{width:15%;top:0;}
  53. </style>
Go to the top of the page
+Quote Post
qbson69
post 10.01.2016, 17:05:01
Post #6





Grupa: Zarejestrowani
Postów: 20
Pomógł: 7
Dołączył: 3.01.2016

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


Nie do końca zrozumiałem, ale tutaj nic czarodziejskiego się nie dzieje, przekierowuje do strony głównej, bo tak jest napisane w kodzie. W liniach 43-44 masz link do pliku index.php, więc do tamtego miejsca idzie przekierowanie.
Go to the top of the page
+Quote Post
meteseron2
post 10.01.2016, 17:44:11
Post #7





Grupa: Zarejestrowani
Postów: 21
Pomógł: 0
Dołączył: 10.01.2016

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


własnie kolego a są tam w folderze galeria 5 zdjęcia, pierwsze zdjęcie po kliknięcu w galerie sie wyswietla gdy klikam drugie zeby sie powiekszylo wtedy wyskakuje mi na strone głowna .. a powinno ladowac sie kolejne zdjęcie
Go to the top of the page
+Quote Post
qbson69
post 10.01.2016, 19:08:46
Post #8





Grupa: Zarejestrowani
Postów: 20
Pomógł: 7
Dołączył: 3.01.2016

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


Nie będzie ładowało się zdjęcie, bo Twoja galeria znajduje się w pliku galeria.php, a w kodzie zrobiłeś linki do pliku index.php, a więc do całkiem innej strony.
Go to the top of the page
+Quote Post
meteseron2
post 10.01.2016, 19:56:08
Post #9





Grupa: Zarejestrowani
Postów: 21
Pomógł: 0
Dołączył: 10.01.2016

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


czyli jak to moge poprawic?
@@@ juz działa dzięki!

Ten post edytował meteseron2 10.01.2016, 20:35:08
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 14.07.2025 - 09:20