Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [php]non-object
styx
post
Post #1





Grupa: Zarejestrowani
Postów: 138
Pomógł: 3
Dołączył: 21.11.2005

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


Witam

Używałem kiedyś taką klasę(nie jest moja wzięta z neta), teraz odpalam i mam taki błąd. O co tu chodzi? php4/5

  1. <?php
  2. class ExtraGrid extends Structures_DataGrid
  3. {
  4. function ExtraGrid($limit = null, $page = null)
  5. {
  6. parent::Structures_DataGrid($limit, $page);
  7.  
  8.  $this->renderer->setTableAttribute('width', '100%'); //61 Line
  9.  $this->renderer->setTableAttribute('cellspacing', '0');
  10.  $this->renderer->setTableAttribute('cellpadding', '0');
  11.  $this->renderer->setTableAttribute('style', 'font-size:12px');
  12.  $this->renderer->setTableOddRowAttributes(array('style'=> 'background-color:#AAAAAA;'));
  13.  $this->renderer->setTableEvenRowAttributes(array('style'=> 'background-color:#CCCCCC;'));
  14.  
  15.  }
  16. }
  17. ?>

Błąd

Fatal error: Call to a member function setTableAttribute() on a non-object in /home/lordstyx/public_html/wp/klient.php on line 61
" title="Zobacz w manualu PHP" target="_manual



Pozdrawiam
Go to the top of the page
+Quote Post
misiek172
post
Post #2





Grupa: Zarejestrowani
Postów: 656
Pomógł: 3
Dołączył: 26.10.2005
Skąd: Częstochowa

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


hmm wiesz to że masz PHP4/5 to nie znaczy ze działają 2 na raz (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

to w roszerzeniu lub w .htaccess defniuje się jakim interpreterem ma być otwarty dany plik, PHP 5 czy 4

a jeśli chodzi o twój błąd to mi się wydaje że to jest źle (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)

$this->renderer->setTableAttribute

poniewaz on w tym momencie traktuje renderer jako obiekt, a renderer nim nie jest, ponieważ tym obiektem jest $this

tak wygląda składnia:

obiekt -> funkcja/zmienna/i.tym.podobne

Ten post edytował misiek172 19.04.2007, 16:29:53
Go to the top of the page
+Quote Post
styx
post
Post #3





Grupa: Zarejestrowani
Postów: 138
Pomógł: 3
Dołączył: 21.11.2005

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


Dzięki misiek172 za odpowiedź, ale zauważ że ten skrypt działał poprawnie poprzednio, tylko nie pamiętam pod jakim php-em to było chyba 4-ka bo linuks wtedy był Red-hat 8.0.

Inna sprawa że ten skrypt jest w oparciu o inny skrypt który znalazłem w necie(też nie działa)

  1. <?php
  2. require 'Structures/DataGrid.php';
  3.  
  4. class myDataGrid extends Structures_DataGrid
  5. {
  6. function myDataGrid($limit = null, $page = null)
  7. {
  8. parent::Structures_DataGrid($limit, $page);
  9.  
  10. // Get the rendering layer instance
  11. $renderer =& $this->getRenderer();
  12.  
  13. // Define DataGrid Color Attributes
  14. $renderer->setTableEvenRowAttributes(array('class' => 'evenrow'));
  15. $renderer->setTableOddRowAttributes(array('class' => 'oddrow'));
  16.  
  17. // Define DataGrid Table Attributes
  18. $renderer->setTableAttribute('width', '100%');
  19. $renderer->setTableAttribute('cellspacing', '1');
  20. $renderer->setTableAttribute('cellpadding', '4');
  21. $renderer->setTableAttribute('class', 'datagrid');
  22.  
  23. // Set sorting icons
  24. $renderer->sortIconASC = '&uarr;';
  25. $renderer->sortIconDESC = '&darr;';
  26. }
  27. }
  28. ?>


nie wiem od czego to zależy
Go to the top of the page
+Quote Post
misiek172
post
Post #4





Grupa: Zarejestrowani
Postów: 656
Pomógł: 3
Dołączył: 26.10.2005
Skąd: Częstochowa

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


te klasy co piszesz są napewno w PHP4, ponieważ przy PHP5 jeszcze definiuje sie rodzaje funkcji, czy public, protected, private i takie tam

stwórz sobie plik .htaccess w folderze z tym plikiem
i w .htaccess wpisz:

:Location /*.php
Use php4

Ten post edytował misiek172 19.04.2007, 16:44:19
Go to the top of the page
+Quote Post

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: 20.12.2025 - 15:07