Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript][PHP]kod php w .js
lukko
post
Post #1





Grupa: Zarejestrowani
Postów: 49
Pomógł: 0
Dołączył: 12.03.2009

Ostrzeżenie: (10%)
X----


Helou,

Pewien skrypt .js przerabiam sobie:

Kod
function test(trialArray){
      var htmlString = '';
  htmlString += '<div>test_test';
  htmlString += '</div>';
  return htmlString;
  }


Chce koniecznie do pliku .js zaciągnąć coś z php:

Kod
function test(trialArray){
      var htmlString = '';
  htmlString += '<div>test_test <?php "_test"; ?>';
  htmlString += '</div>';
  return htmlString;
  }


No ale <?php "_test"; ?> nie pójdzie omija to...


Pytanie czy w ogóle do pliku javascript da się zagnieździć php albo jakaś alternatywa ?

Ten post edytował lukko 15.12.2009, 12:45:06
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
darko
post
Post #2





Grupa: Zarejestrowani
Postów: 2 885
Pomógł: 463
Dołączył: 3.10.2009
Skąd: Wrocław

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


Może generuj sobie funkcje js w php:

  1. <?php
  2. $test = "test";
  3. <script type=\"text/javascript\">
  4. function test(trialArray) {
  5. var htmlString = '';
  6. htmlString += '<div>coś tam $test';
  7. htmlString += '</div>';
  8. return htmlString;
  9. }
  10. </script>";
  11. ?>


  1. document.write(test('cokolwiek'));


?
Go to the top of the page
+Quote Post

Posty w temacie


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: 11.10.2025 - 12:28