Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Problem z błędem T_ENDWHILE
przemo191
post
Post #1





Grupa: Zarejestrowani
Postów: 154
Pomógł: 3
Dołączył: 1.08.2011

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


Witam, mam problem z błędem
  1. Parse error: syntax error, unexpected T_ENDWHILE in index.php on line 1


Problem pojawił się po przeniesieniu plików na inny serwer, na starym wszystko chodzi tak jak powinno.

Wiecie może jak to naprawić?

Kod z tego pliku to:
  1. <?php
  2. get_header();
  3. get_sidebar();?>
  4. <content>
  5. <div class="row">
  6. <div class="col-md-8 col-sm-12 col-lg-8">
  7. <div class="container">
  8. <?php if ( have_posts() ) : ?>
  9.  
  10. <?php while ( have_posts() ) : the_post(); ?>
  11.  
  12. <div class="row">
  13. <div class="visible-lg-block visible-md-block" style="margin-top: 20px; display: block;"></div>
  14. <div class="col-md-3 col-sm-5 col-lg-4 col-slg-4 col-f-4 col-fhd4 img-responsive img-news">
  15. <?php
  16. if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
  17. the_post_thumbnail( 'medium', 'class=img-responsive');
  18. }
  19. ?></div>
  20. <div class="col-md-5 col-sm-7 col-lg-5 col-slg-6 col-f-7 col-fhd-8">
  21. <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
  22. <p>
  23. <?php the_content('Czytaj dalej ť'); ?>
  24. </p>
  25. <p class="text-muted small"><?php the_time('d-m-Y'); ?> | autor: <?php the_author(); ?> </p>
  26. </div>
  27. </div>
  28. <?php endwhile; ?>
  29. <?php endif; ?>
  30. <br>
  31. <div class="" style="margin-top: 20px; display: block;"></div>
  32. </div>
  33. </div>
  34. <?php get_template_part('rightbar'); ?>
  35. </div>
  36. </div>
  37. </content>
  38. <?php get_footer(); ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Z komunikatu bledu wynika, ze masz blad w index.php w linii 1. W kodzie co podales nigdzie nie widze, bys w linii pierwszej mial endwhile... Pokaz mi plik index.php


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
przemo191
post
Post #3





Grupa: Zarejestrowani
Postów: 154
Pomógł: 3
Dołączył: 1.08.2011

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


No właśnie najlepsze jest to, że to jest ten plik.
Te same pliki na starym serwerze link, chodzą prawidłowo, natomiast po przeniesieniu ich na nowy serwer link pokazują taki błąd.

// to jest cały kod z tego pliku

Ten post edytował przemo191 2.04.2015, 09:33:01
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Jestes na 100% pewien, ze pokazujesz zawartosc DOKLADNIE tego pliku z podanej tu SCIEZKI:
/home/blaise/public_html/3mamygaz/wp-content/themes/zuzel/index.php
z serwera z ktorego odpalasz ten plik? Sprawdz proszę jeszcze raz.


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
przemo191
post
Post #5





Grupa: Zarejestrowani
Postów: 154
Pomógł: 3
Dołączył: 1.08.2011

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


Na 100% to jest ten plik http://3mamygaz.pl/wp-content/themes/zuzel/index.php
Bo jak usunę wszystko z tego pliku to błąd znika.

Wydaję mi się że jest to błąd z serwerem, na moim wersja php to 5.4.39, a na tym z problemem 5.2.17.
Co dziwne bo taka struktura działa bez problemu na niższych wersjach.

//
Udało mi się ustalić że problem dotyczy tych lini:

  1. if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
  2. the_post_thumbnail( 'medium', 'class=img-responsive');
  3. }


Ten post edytował przemo191 2.04.2015, 09:50:44
Go to the top of the page
+Quote Post
pasman
post
Post #6





Grupa: Zarejestrowani
Postów: 70
Pomógł: 4
Dołączył: 16.03.2012

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


Treść błędu jest trochę inna:

  1. Fatal error: Call to undefined function get_header() in /home/blaise/public_html/3mamygaz/wp-content/themes/zuzel/index.php on line 1
Go to the top of the page
+Quote Post
Beniooo
post
Post #7





Grupa: Zarejestrowani
Postów: 260
Pomógł: 26
Dołączył: 26.01.2012
Skąd: Ci to przyszło do głowy?

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


To dlatego, że w themes/zuzel/index.php nie ma deklaracji tej funkcji, bo strona jest include'owana z głównej strony, w której ta deklaracja juz jest.


--------------------
Mój post rozwiązał Twój problem? Naciśnij co Ci szkodzi? ;-)
Go to the top of the page
+Quote Post
przemo191
post
Post #8





Grupa: Zarejestrowani
Postów: 154
Pomógł: 3
Dołączył: 1.08.2011

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


Ten błąd pojawia się po usunięciu tych trzech lini generujących zdjęcie.
W tym momencie wygląda to tak http://3mamygaz.pl/

Problem powoduje:
  1. if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
  2. the_post_thumbnail( 'medium', 'class=img-responsive');
  3. }


Tylko jeszcze nie wiem dlaczego.

Po otworzeniu samego pliku 3mamygaz/wp-content/themes/zuzel/index.php taki błąd będzie występował, ale wordpress sobie z tym poradzi.

Rozwiązaniem problemu była zamiana tego:

  1. if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
  2. the_post_thumbnail( 'medium', 'class=img-responsive');
  3. }


Na to:

  1. if ( strlen( $img = get_the_post_thumbnail( get_the_ID(), array( 150, 150 ) ) ) ) {
  2. /* display thumbnail */
  3. echo get_the_post_thumbnail(get_the_ID(), 'medium', 'class=img-responsive');
  4. } else {
  5. /* display some other image */
  6. }
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 Aktualny czas: 20.08.2025 - 04:45