Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [WordPresss] Kolorowanie składni i numerowanie linii
Bryla
post
Post #1





Grupa: Zarejestrowani
Postów: 31
Pomógł: 0
Dołączył: 16.01.2010

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


Witam, ściągnąłem sobie plugin do Wordpressa: WP-GeSHi-Highlight. Kolorowanie składni działa. Niestety nie mogę dojść w jaki sposób włączyć numerowanie linii. Mógłby mi ktoś podpowiedzieć jak to zrobić? W pliku geshi.php znalazłem:
  1. // Line numbers - use with enable_line_numbers()
  2. /** Use no line numbers when building the result */
  3. define('GESHI_NO_LINE_NUMBERS', 0);
  4. /** Use normal line numbers when building the result */
  5. define('GESHI_NORMAL_LINE_NUMBERS', 1);
  6. /** Use fancy line numbers when building the result */
  7. define('GESHI_FANCY_LINE_NUMBERS', 2);

i zmieniłem na:
  1. // Line numbers - use with enable_line_numbers()
  2. /** Use no line numbers when building the result */
  3. define('GESHI_NO_LINE_NUMBERS', 0);
  4. /** Use normal line numbers when building the result */
  5. enable_line_numbers('GESHI_NORMAL_LINE_NUMBERS', 1);
  6. /** Use fancy line numbers when building the result */
  7. define('GESHI_FANCY_LINE_NUMBERS', 2);


ale dalej nie działa.

Z góry dzięki (IMG:style_emoticons/default/smile.gif)

Ten post edytował Bryla 17.01.2011, 11:34:09
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
vokiel
post
Post #2





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

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


http://qbnz.com/highlighter/geshi-doc.html...ng-line-numbers
Go to the top of the page
+Quote Post
Bryla
post
Post #3





Grupa: Zarejestrowani
Postów: 31
Pomógł: 0
Dołączył: 16.01.2010

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


Dodałem:

  1. $geshi->enable_line_numbers('GESHI_NORMAL_LINE_NUMBERS', 1);


i wywala:

Fatal error: Call to a member function enable_line_numbers() on a non-object in ... public_html/wp-content/plugins/wp-geshi-highlight/geshi/geshi.php on line 70

Ten post edytował Bryla 17.01.2011, 11:50:57
Go to the top of the page
+Quote Post
MWL
post
Post #4





Grupa: Zarejestrowani
Postów: 493
Pomógł: 32
Dołączył: 14.04.2008
Skąd: Lenkowski.net

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


a co jest w zmiennej $geshi? No właśnie...
Go to the top of the page
+Quote Post
fiszol
post
Post #5





Grupa: Zarejestrowani
Postów: 453
Pomógł: 16
Dołączył: 25.05.2004
Skąd: Gorzów Wlkp.

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


Nie zapomniałeś czasem o $geshi = new GeSHi($source, $language);?
Go to the top of the page
+Quote Post
Bryla
post
Post #6





Grupa: Zarejestrowani
Postów: 31
Pomógł: 0
Dołączył: 16.01.2010

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


Próbowałem także:

  1. // Line numbers - use with enable_line_numbers()
  2. /** Use no line numbers when building the result */
  3. define('GESHI_NO_LINE_NUMBERS', 0);
  4. /** Use normal line numbers when building the result */
  5. enable_line_numbers(define('GESHI_NORMAL_LINE_NUMBERS', 1));
  6. /** Use fancy line numbers when building the result */
  7. define('GESHI_FANCY_LINE_NUMBERS', 2);


ale też nie działa (ten sam bład).

Cytat(fiszol @ 17.01.2011, 12:56:55 ) *
Nie zapomniałeś czasem o $geshi = new GeSHi($source, $language);?


Ale gdzie to mam dać w geshi.php czy w poście?

PS: Wszystko z oprócz numerowania działa.

Ten post edytował Bryla 17.01.2011, 13:07:54
Go to the top of the page
+Quote Post
vokiel
post
Post #7





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

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


Dodając wpis możesz ręcznie ustawić numerowanie:
Kod
<pre lang="php" line="1">
    // kod
</pre>
Go to the top of the page
+Quote Post
Bryla
post
Post #8





Grupa: Zarejestrowani
Postów: 31
Pomógł: 0
Dołączył: 16.01.2010

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


Dzięki, już działa (IMG:style_emoticons/default/smile.gif)
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: 24.12.2025 - 22:55