Good art is a taste, good design is an opinion.


Come as guest, stay as family.
Board Index

Come as guest, stay as family.


You are not connected. Please login or register

Foto

[Solved] Adding Line Numbers to code?



View previous topic View next topic Go down Message [Page 1 of 1]

1
Offline

  Micul`Wji

Micul`Wji
Punbb Junior
Punbb Junior
  • Description:
How to add a Line Numbers to code? demo:

https://2img.net/h/s30.postimg.cc/og5zxhdi9/screenshot_16.png

thanks

  • Information:
Forum:www.exiled.wow3.infoVersion:PUNBB
Type:Request a codeTags:Adding,Numbers,code?

Powered by PunBB
Currently 0 users have thanked Micul`Wji for this post:

2
Offline

  Guest

Anonymous
Guest
Put this code in javascript.

Code:
[panda=js]    $(function(){
          var codes = document.getElementsByTagName('code');
          for(var i = 0, l = codes.length; i<l; i++)  codes[i].innerHTML = '<ol class="LGlines"><li>' + codes[i].innerHTML.split(/\<br\s?\/?\>/).join('</li><li>') + '</li></ol>';
        });

Powered by PunBB
Currently 0 users have thanked Guest for this post:

3
Offline

  Micul`Wji

Micul`Wji
Punbb Junior
Punbb Junior
don't work... why?

Powered by PunBB
Currently 0 users have thanked Micul`Wji for this post:

4
Offline

  Guest

Anonymous
Guest
Maybe if your forum version is not in English? In that case you need to change [ic]getElementsByTagName('code');[/ic] equal to your language.

Powered by PunBB
Currently 0 users have thanked Guest for this post:

5
Offline

  Micul`Wji

Micul`Wji
Punbb Junior
Punbb Junior
Rapid wrote:[link="/t511-adding-line-numbers-to-code#3065"]Maybe if your forum version is not in English? In that case you need to change [ic]getElementsByTagName('code');[/ic] equal to your language.

my forum language is english...

Powered by PunBB
Currently 0 users have thanked Micul`Wji for this post:

6
Offline

  Micul`Wji

Micul`Wji
Punbb Junior
Punbb Junior
nobody?

Powered by PunBB
Currently 0 users have thanked Micul`Wji for this post:

7
Offline

  Guest

Anonymous
Guest
Put in your css:

Code:
[panda=css].LGlines {
    border-left: 2px solid #008000;
    left: 50px;
    list-style-type: decimal-leading-zero;
    margin: 4px 0px;
    padding: 1px 10px;
    position: relative;
}

So now the previous code should work.

Powered by PunBB
Currently 0 users have thanked Guest for this post:

8
Offline

  Micul`Wji

Micul`Wji
Punbb Junior
Punbb Junior
Now it works. Codes can be colored?

Powered by PunBB
Currently 0 users have thanked Micul`Wji for this post:

9
Offline

  Shadow

Shadow
Administrator
Administrator
Micul`Wji wrote:[link="/t511-adding-line-numbers-to-code#3080"]Now it works. Codes can be colored?

Why don't you just use this tutorial, you'll get all these features.

Powered by PunBB
Currently 0 users have thanked Shadow for this post:

10
Offline

  Micul`Wji

Micul`Wji
Punbb Junior
Punbb Junior
I followed that tutorial but not all codes are colored. Why?

demo: https://2img.net/h/s30.postimg.cc/9fhy4tfvl/screenshot_21.png

Powered by PunBB
Currently 0 users have thanked Micul`Wji for this post:

11
Offline

  Shadow

Shadow
Administrator
Administrator
Because it's a syntax, and it only colors the variables.

Powered by PunBB
Currently 0 users have thanked Shadow for this post:

12
Offline

  Micul`Wji

Micul`Wji
Punbb Junior
Punbb Junior
I understand
But that is not the main problem the problem is that the bar does not appear numbered lines,

demo: https://2img.net/h/s30.postimg.cc/r1uencdcx/screenshot_21.png

Thanks Solved now!

Powered by PunBB
Currently 0 users have thanked Micul`Wji for this post:

13
Offline

  Guest

Anonymous
Guest
[sucesso="Marked as Solved"]The question(s) in this topic have been answered and the owner has been able to solve the problem. Because of this, the topic has been marked as Solved.

If you have further questions, please open a new topic.[/sucesso]

Powered by PunBB
Currently 0 users have thanked Guest for this post:

14
Offline

  Sponsored content



Powered by PunBB
Currently 0 users have thanked Sponsored content for this post:

View previous topic View next topic Back to top Message [Page 1 of 1]


Topic URL's

URL
BBcode
HTML

Permissions in this forum:
You cannot reply to topics in this forum