Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript][PHP]php w javascript
cent4
post
Post #1





Grupa: Zarejestrowani
Postów: 415
Pomógł: 0
Dołączył: 24.12.2008

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


Jak zaimplementować wynik skryptu php w javascript. Tz. skrypt java odpowiada za przesuwany tekst, natomiast w skrypcie php mam dane z kanałów rss, które chcę wyświetlać i przesuwać.
Skrypt javascript, który odpowiada za przesuwanie tekstu to:
Cross browser Marquee script- © Dynamic Drive (www.dynamicdrive.com).

element, który powoduje przesuwanie tekstu to:
  1. var marqueecontent='<nobr><a href="#" onclick="nowe_okno();" style="font-size: 14px; color: #18026C;">tekst</a></nobr>'


jak zaimplementować w to skrypt php?

  1. var marqueecontent='<nobr><?php include("rss/rss.php"); ?></nobr>'

Niestety to nie działa :-(
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
cent4
post
Post #2





Grupa: Zarejestrowani
Postów: 415
Pomógł: 0
Dołączył: 24.12.2008

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


To jest plik php:
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.  
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <title>RSS Reader with PHP</title>
  7. <link type="text/css" rel="stylesheet" href="style/rss.css" />
  8. </head>
  9. <body>
  10. <div class="inside">
  11. <?php
  12.  
  13. /* feed URIs */
  14. $urls = array('http://biznes.gazetaprawna.pl/rss.xml', 'http://podatki.gazetaprawna.pl/rss.xml');
  15.  
  16. /* number of items for each feed */
  17. $num_items = 10;
  18.  
  19. @require_once('rss_fetch.inc');
  20. define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');
  21.  
  22. foreach($urls as $url) {
  23. $rss = fetch_rss($url);
  24. if($rss) {
  25. $items = array_slice($rss->items, 0, $num_items);
  26. foreach($items as $item) {
  27. $title = iconv("UTF-8","ISO-8859-2",$item['title']);
  28. $url = $item['link'];
  29. echo "<a href='".$url."'>".$title."</a>"."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  30. }
  31. echo "</ul>";
  32. }
  33. else {
  34. echo "An error occured!<br />Error Message: ".magpie_error();
  35. }
  36. }
  37.  
  38. ?>
  39.  
  40.  
  41. </div>
  42. </body>
  43. </html>
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: 16.10.2025 - 04:45