Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> nieznany operator PHP
djsalat
post
Post #1





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 20.01.2010
Skąd: łódzkie

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


witam natknąłem się na taki nieznany mi operator -> czy mozecie mi powiedzieć jak go zastąpić lub do czego służy wogóle??

oto przykład w użyciu


  1. <?php echo $ajaxLoginModule->initJquery(); ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
djsalat
post
Post #2





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 20.01.2010
Skąd: łódzkie

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


php

skrypt do strony bez przeładowania wygląda tak:
  1. var default_content="";
  2.  
  3. $(document).ready(function(){
  4.  
  5. checkURL();
  6. $('ul li a').click(function (e){
  7.  
  8. checkURL(this.hash);
  9.  
  10. });
  11.  
  12. //filling in the default content
  13. default_content = $('#pageContent').html();
  14.  
  15.  
  16. setInterval("checkURL()",250);
  17.  
  18. });
  19.  
  20. var lasturl="";
  21.  
  22. function checkURL(hash)
  23. {
  24. if(!hash) hash=window.location.hash;
  25.  
  26. if(hash != lasturl)
  27. {
  28. lasturl=hash;
  29.  
  30. // FIX - if we've used the history buttons to return to the homepage,
  31. // fill the pageContent with the default_content
  32.  
  33. if(hash=="")
  34. $('#pageContent').html(default_content);
  35.  
  36. else
  37. loadPage(hash);
  38. }
  39. }
  40.  
  41.  
  42. function loadPage(url)
  43. {
  44. url=url.replace('#page','');
  45.  
  46. $('#loading').css('visibility','visible');
  47.  
  48. $.ajax({
  49. type: "POST",
  50. url: "load_page.php",
  51. data: 'page='+url,
  52. dataType: "html",
  53. success: function(msg){
  54.  
  55. if(parseInt(msg)!=0)
  56. {
  57. $('#pageContent').html(msg);
  58. $('#loading').css('visibility','hidden');
  59. }
  60. }
  61.  
  62. });
  63.  
  64. }




a zamieniłem go na

  1. var default_content="";
  2.  
  3. $(document).ready(function(){
  4.  
  5. checkURL();
  6. $('ul li a').click(function (e){
  7.  
  8. checkURL(this.hash);
  9.  
  10. });
  11.  
  12. //filling in the default content
  13. default_content = $('#pageContent').html();
  14.  
  15.  
  16. setInterval("checkURL()",250);
  17.  
  18. });
  19.  
  20. var lasturl="";
  21.  
  22. function checkURL(hash)
  23. {
  24. if(!hash) hash=window.location.hash;
  25.  
  26. if(hash != lasturl)
  27. {
  28. lasturl=hash;
  29.  
  30. // FIX - if we've used the history buttons to return to the homepage,
  31. // fill the pageContent with the default_content
  32.  
  33. if(hash=="")
  34. $('#pageContent').html(default_content);
  35.  
  36. else
  37. loadPage(hash);
  38. }
  39. }
  40.  
  41.  
  42. function loadPage(url)
  43. {
  44. url=url.replace('#','');
  45.  
  46. $('#loading').css('visibility','visible');
  47.  
  48. $.ajax({
  49. type: "POST",
  50. url: "load_page.php",
  51. data: 'page='+url,
  52. dataType: "php",
  53. success: function(msg){
  54.  
  55. if(parseInt(msg)!=0)
  56. {
  57. $('#pageContent').html(msg);
  58. $('#loading').css('visibility','hidden');
  59. }
  60. }
  61.  
  62. });
  63.  
  64. }




czyli w niektórych miejscach z html na php zeby obsługiwal to rozszerzenie.
do ładowania strony służy :


  1. <?php
  2.  
  3. if(!$_POST['page']) die("0");
  4.  
  5. $page = (int)$_POST['page'];
  6.  
  7. if(file_exists('pages/page_'.$page.'.html'))
  8. echo file_get_contents('pages/page_'.$page.'.html');
  9.  
  10. else echo 'There is no such page!';
  11. ?>





i zamieniłem go na:

  1. <?php
  2.  
  3. if(!$_POST['page']) die("0");
  4.  
  5. $page = $_POST['page'];
  6.  
  7. if(file_exists(''.$page.'.php'))
  8. echo file_get_contents(''.$page.'.php');
  9.  
  10. else echo 'There is no such page!';
  11. ?>




i wszystko ładnie robi tylko przy
  1. <?php echo $ajaxLoginModule->initJquery(); ?>



poprostu wyświetla tą treść tak jakby było zwykłe echo do wyświetlenia;/
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: 5.10.2025 - 21:39