Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Kolorowanie składni kodu php na stronie
Lwie_Serce_
post
Post #1





Grupa: Zarejestrowani
Postów: 38
Pomógł: 0
Dołączył: 2.12.2004
Skąd: Tarnów

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


Chciałem się zapytać w jaki sposób na mojej stronie www mogę zrobić kolorowanie składni kodu php ? Bo jak narazie mam zrobiony taki bbcode [code][/code] np. u mnie w temacie taki kod wygląda tak: http://www.history.is.net.pl/faq/1/4
W jaki sposób zrobić tak, żeby te kody mi kolorowało ? może ktoś mi pomóc w tym ?

Ten post edytował Lwie_Serce_ 6.03.2013, 17:51:48
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Lwie_Serce_
post
Post #2





Grupa: Zarejestrowani
Postów: 38
Pomógł: 0
Dołączył: 2.12.2004
Skąd: Tarnów

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


no wiem, bo to jest w css
ale w php tego nie moge znalesc, jedynie mam w js
Kod
var id='txt';
// ---------- Poniżej tej linii nie trzeba nic zmieniać ----------
var T={}, id='txt';

function $add(con, el, t){
    el=$get(el||id); el.focus();
    if((t=document.selection)&&t.createRange)
        t.createRange().text=con;
    else if(el.selectionStart!==undefined){
        t = el.selectionStart;
        el.value=el.value.substring(0, t)+con+el.value.substr(el.selectionEnd);
        $select(el, t += con.length, t);
    } else
        el.value+=con;
    el.focus();
}
function $sel(e,t){e=$get(e||id);e.focus();return (t=document.selection)&&t.createRange?t.createRange().text:e.value.substring(e.selectionEnd|0,e.selectionStart|0)}
function $get(el){return el.tagName ? el : document.getElementById(el)}
function $status(id, tag, val, r){r=T[id][tag];if(val!==undefined)T[id][tag]=val|0;return r}
function $select(e, from, to){
    e=$get(e);e.focus();
    if(e.setSelectionRange)
        e.setSelectionRange(from, to);
    else if(e.createTextRange) {
        e = e.createTextRange();
        e.collapse(true);
        e.moveEnd('character', to);
        e.moveStart('character', from);
        e.select();    
    }
}

function bbcode(tag, opt, s){
    opt = opt || {};
    var t = opt.name || id, attr = 'attr' in opt ? '' + opt.attr : '';
    T[t] = T[t] || {};
    if(s=$sel(t))
        $add('['+tag+attr+']'+s+'[/'+tag+']',t);
    else {
        (s=T[t])[tag]|=0;
        $add('['+(s[tag]?'/':'')+tag+(s[tag]?'':attr)+']',t);
        s[tag]^=1;
        mark($get(t).form, tag, s[tag]);
    }
}
function mark(frm, name, opened, t){
    frm = frm.getElementsByTagName('*');
    for(var i=0;t=frm[i++];){
        if(t.getAttribute('name')===name)
            t.value = opened ? '/'+t.value : t.value.substr(1);
    }
}

function emoticon(e){
  $add(e,'message');
}

function closeAllTags(name){
    var t = name || id;
    for(var i in T[t]){
        if(T[t][i]===0)continue;
        $add('[/'+i+']',t);
        T[t][i]=0;
        mark($get(t).form, i, 0);
    }
}


Ten post edytował Lwie_Serce_ 7.03.2013, 21:13:57
Go to the top of the page
+Quote Post

Posty w temacie
- Lwie_Serce_   Kolorowanie składni kodu php na stronie   6.03.2013, 17:50:46
- - mstraczkowski   Funkcja highlight_string lub biblioteka Geshi   6.03.2013, 17:57:51
- - acidm   show_source   6.03.2013, 17:58:24
- - Lwie_Serce_   Czyli do kazdego kodu php, który pokazuje na mojej...   6.03.2013, 18:18:03
- - skowron-line   http://www.webresourcesdepot.com/11-syntax...e-pre...   6.03.2013, 18:29:00
- - Lwie_Serce_   To jest tak tam napisane że ja nic z tego nie wiem...   6.03.2013, 19:29:33
- - _Borys_   W przypadku highlight_string() wrzucasz kod który ...   6.03.2013, 19:44:54
- - Lwie_Serce_   Zrobiłem tak i nie działa mi Kod<?php highlig...   6.03.2013, 20:07:55
- - _Borys_   [PHP] pobierz, plaintext echo highlight_string...   6.03.2013, 20:14:18
- - Lwie_Serce_   Nie rozumie o co Ci chodzi ? że brakuje mi echo w ...   6.03.2013, 20:18:37
|- - teez   Cytat(Lwie_Serce_ @ 6.03.2013, 20:18...   6.03.2013, 20:40:40
- - Lwie_Serce_   to mam to zrobić tak ? : Kod <php echo highli...   6.03.2013, 20:56:55
- - _Borys_   No tak, przecież musisz wyświetlić to co kolorujes...   6.03.2013, 21:02:19
- - Lwie_Serce_   Nie działa mi to wogóle, nie koloruje mi kodu tak...   6.03.2013, 21:07:00
- - _Borys_   Pokaż więcej kodu, w czym to wyświetlasz.   6.03.2013, 21:09:03
- - Lwie_Serce_   Jestem w panelu admina mojej strony i tam edytuje ...   6.03.2013, 21:15:05
- - hind   [PHP] pobierz, plaintext <?phpecho highlight_st...   7.03.2013, 08:12:36
- - _Borys_   To nie pomoże mu, pewnie wyświetla kod pomiędzy [C...   7.03.2013, 11:57:22
- - Lwie_Serce_   Dokładnie wyswietlam kod w bbcode [/c ode] w panel...   7.03.2013, 17:58:39
- - _Borys_   A tak tylko ? [PHP] pobierz, plaintext <?php ec...   7.03.2013, 18:05:28
- - Lwie_Serce_   _Borys_ zrobiłem tak, ale zamiast kodu zrobiło mi ...   7.03.2013, 18:12:49
- - !*!   To musisz edytować kod PHP, aby parsował to popraw...   7.03.2013, 18:16:52
- - Lwie_Serce_   czyli jak to mam zrobić żeby mi kolorowało kod ?   7.03.2013, 18:19:37
- - !*!   Zleć to komuś w dziale Oferty. Tak będzie najszybc...   7.03.2013, 18:20:47
- - Lwie_Serce_   faq_pytanie.php Kod<div class="faq-pytanie...   7.03.2013, 18:32:05
- - !*!   A gdzie parser bbcode?   7.03.2013, 18:35:01
- - Lwie_Serce_   mam w css zrobione tak: Kodpre.code { margin...   7.03.2013, 18:57:50
- - !*!   To nie jest PHP.   7.03.2013, 19:40:13
- - Lwie_Serce_   no wiem, bo to jest w css ale w php tego nie moge ...   7.03.2013, 21:10:45


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 - 11:07