Donations

Help support Pro_News and become a member of our Sponsors Group
The tip jar is at PayPal, but does not require a PayPal account
macavity
$ 20.00
heliown
$ 20.00
rosbif
$ 18.68
rosbif
$ 26.40
Aforo, losViajeros
$ 40.00
User Info
Bienvenido Anónimo
Lista de miembros:
Ultimo: macuserau
Nuevos Hoy: 0
Nuevos Ayer: 0
Total: 146
Gente en línea:
Miembros: 0
Visitantes: 34
Bots: 3
Total: 37
Donde estan todos:
Visitantes:My Account
Pro News Articles
Support Forums
Support Forums
Support Forums
Home
Pro News Articles
Downloads
Pro News Articles
Downloads
Pro News Articles
Support Forums
Pro News Articles
Mitt konto
Support Forums
Support Forums
Support Forums
Pro News Articles
Support Forums
Pro News Articles
Support Forums
Pro News Articles
Support Forums
Pro News Articles
Pro News Articles
الحساب الشخص
Pro News Articles
Nedladdningar
Téléchargement
Support Forums
Support Forums
Support Forums
الحساب الشخص
Support Forums
Bots:Voila > Support Forums
Google > Support Forums
Baidu > Support Forums
Administradores conectados:
No hay Administradores conectados!
Volver arriba
Skip to menu
Skip to content
Yeah! I create a website, and record them all on there!
Also at a detail level I use a diff tool to compare new and old. Meld on Ubuntu, can't remember what I used to use on Windoze - it's been so long... CVS is best solution, but a bit of work to set up for all projects, so I reserve that just for the big stuff. Other possibility might be to save out diffs for all changes - assuming you have editor capable of this.
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1
Tables in BBCode! Updated!
Ir a página 1, 2, 3 SiguienteTables in BBCode! Updated!
Publicado: Wed Apr 29, 2009 2:49 pm
I needed basic table support, plus lists, and got to realising that if I needed it I'd better do it myself! So here it is...
Please note this is only basic table support. You can enter BBCodes that match their HTML equivalents table /table, tr /tr, th /th and td /td. Nothing fancy like colspan is supported. My goal was simple tables, to be entered by end-users to whom I didn't want to give HTML access - not because I didn't trust them, but because they might accidentally leave an open-ended HTML command... All of these have buttons, both on and off, help and FAQ entries.
While I was at it, I added buttons for the list BBCode functions that are already in the code. Plus 2 other functions that I like: IMGURL which lets you accomplish an img within a[url /url in a single operation (thanks to mikiemouse of EHP Designs for coding that), and PDFURL which places a URL link to a pdf and drops in the Adobe pdf icon automatically.
Finally an updated BBCode FAQ and a prominent link to it.
You will need to login to see the attachments.
Hope they are useful to someone.
I know of 1 problem with the table BBCodes: if you concatenate the table, tr and td codes without line breaks the table appears as you would expect. However if you, say, place each tr or td on its own line, then those line breaks are going to appear as extra br's above the table. I believe that these can be eliminated in the preg_replace command, but I couldn't figure out what code to look for. If anyone knows, I'll update.
Insert in includes/nbbcode.php starting at line 190
Also starting at line 273
Also starting at line 539
Insert in language/english/bbcode.php starting at line 104
Update: You also need the following edits, listed further down this thread.
And you will require a PDF icon image if you want to display one, info later in this thread.
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1
Ultima edición por layingback el Fri Oct 23, 2009 10:21 am, editado 2 veces
Please note this is only basic table support. You can enter BBCodes that match their HTML equivalents table /table, tr /tr, th /th and td /td. Nothing fancy like colspan is supported. My goal was simple tables, to be entered by end-users to whom I didn't want to give HTML access - not because I didn't trust them, but because they might accidentally leave an open-ended HTML command... All of these have buttons, both on and off, help and FAQ entries.
While I was at it, I added buttons for the list BBCode functions that are already in the code. Plus 2 other functions that I like: IMGURL which lets you accomplish an img within a[url /url in a single operation (thanks to mikiemouse of EHP Designs for coding that), and PDFURL which places a URL link to a pdf and drops in the Adobe pdf icon automatically.
Finally an updated BBCode FAQ and a prominent link to it.
You will need to login to see the attachments.
Hope they are useful to someone.
I know of 1 problem with the table BBCodes: if you concatenate the table, tr and td codes without line breaks the table appears as you would expect. However if you, say, place each tr or td on its own line, then those line breaks are going to appear as extra br's above the table. I believe that these can be eliminated in the preg_replace command, but I couldn't figure out what code to look for. If anyone knows, I'll update.
Insert in includes/nbbcode.php starting at line 190
PHP:
var imgurl_help = "'. $bbcode_common['imgurl'][0].' '.$bbcode_common['imgurl'][1].'";
var pdfurl_help = "'. $bbcode_common['pdfurl'][0].' '.$bbcode_common['pdfurl'][1].'";
var table_help= "'. $bbcode_common['table'][0].' '.$bbcode_common['table'][1].'";
var tr_help= "'. $bbcode_common['tr'][0].' '.$bbcode_common['tr'][1].'";
var th_help= "'. $bbcode_common['th'][0].' '.$bbcode_common['th'][1].'";
var td_help= "'. $bbcode_common['td'][0].' '.$bbcode_common['td'][1].'";
var list_help = "'. $bbcode_common['list'][0].' '.$bbcode_common['list'][1].'";
var nlist_help = "'. $bbcode_common['nlist'][0].' '.$bbcode_common['nlist'][1].'";
var alist_help = "'. $bbcode_common['alist'][0].' '.$bbcode_common['alist'][1].'";
var ilist_help = "'. $bbcode_common['ilist'][0].' '.$bbcode_common['ilist'][1].'";
var li_help = "'. $bbcode_common['li'][0].' '.$bbcode_common['li'][1].'";
Also starting at line 273
PHP:
if ($allowed) {
$content .= '
</td>
</tr><tr>
<td>
<img alt="'.$bbcode_common['imgurl'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'imgurl\')" onclick="BBCimg(\''.$form.'\',\''.$field.'\',\'imgurl\')" src="'.$bbbttns_path.'imgurl.gif" />
<img alt="'.$bbcode_common['list'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'list\')" onclick="BBCcode(\''.$form.'\',\''.$field.'\',this,\'list\')" src="'.$bbbttns_path.'ulist.gif" />
<img alt="'.$bbcode_common['nlist'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'nlist\')" onclick="BBCode(\''.$form.'\',\''.$field.'\',\'list\',this,\'1\')" src="'.$bbbttns_path.'list_1.gif" />
<img alt="'.$bbcode_common['alist'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'alist\')" onclick="BBCode(\''.$form.'\',\''.$field.'\',\'list\',this,\'a\')" src="'.$bbbttns_path.'list_a.gif" />
<img alt="'.$bbcode_common['ilist'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'ilist\')" onclick="BBCode(\''.$form.'\',\''.$field.'\',\'list\',this,\'i\')" src="'.$bbbttns_path.'list_i.gif" />
<img alt="'.$bbcode_common['li'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'li\')" onclick="BBCli(\''.$form.'\',\''.$field.'\')" src="'.$bbbttns_path.'bullet.gif" />
<img alt="'.$bbcode_common['pdfurl'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'pdfurl\')" onclick="BBCpdf(\''.$form.'\',\''.$field.'\',\'pdfurl\')" src="'.$bbbttns_path.'pdfurl.gif" />
<img alt="'.$bbcode_common['table'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'table\')" onclick="BBCcode(\''.$form.'\',\''.$field.'\',this,\'table\')" src="'.$bbbttns_path.'table.gif" />
<img alt="'.$bbcode_common['tr'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'tr\')" onclick="BBCcode(\''.$form.'\',\''.$field.'\',this,\'tr\')" src="'.$bbbttns_path.'tr.gif" />
<img alt="'.$bbcode_common['th'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'th\')" onclick="BBCcode(\''.$form.'\',\''.$field.'\',this,\'th\')" src="'.$bbbttns_path.'th.gif" />
<img alt="'.$bbcode_common['td'][0].'" class="bbcbutton" onmouseover="helpline(\''.$form.'\',\''.$field.'\',\'td\')" onclick="BBCcode(\''.$form.'\',\''.$field.'\',this,\'td\')" src="'.$bbbttns_path.'td.gif" />
<a href="index.php?name=Forums&file=faq&mode=bbcode" target="_blank" class="tiny">BBCode FAQ</a>
';
}
PHP:
# [table] and [/table] for table.
$patterns[] = '#\[table\]\r?\n?\t?(.*?)\[/table\]\r?\n?\t?#si';
$replacements[] = '<table class="BBCtable" style="border:0" cellpadding="5">\1</table>';
# [tr] and [/tr] for table row.
$patterns[] = '#\[tr\]\r?\n?\t?(.*?)\[/tr\]\r?\n?\t?#si';
$replacements[] = '<tr>\1</tr>';
# [th] and [/th] for table title.
$patterns[] = '#\[th\]\r?\n?\t?(.*?)\[/th\]\r?\n?\t?#si';
$replacements[] = '<th>\1</th>';
# [td] and [/td] for table field.
$patterns[] = '#\[td\]\r?\n?\t?(.*?)\[/td\]\r?\n?\t?#si';
$replacements[] = '<td>\1</td>';
// [imgurl url= ]image_url_here[/imgurl] code..
$patterns[] = "#\[imgurl url=([\w]+?://[^ \"\n\r\t<]*?)]([\w]+(://|\.|/)[^ (\"\n\r\t<]*?)\[/imgurl\]#si";
$replacements[] = "<a href=\"\\1\" target=\"_blank\"><img src=\"\\2\" border=\"0\" alt=\"\" /></a>";
# [pdfurl url=xxxx://www.cpgnuke.com]cpgnuke[/pdfurl]
$patterns[] = "#\[pdfurl url=([\w]+://[^ (\"\n\r\t<]*?)\](.*?)\[/pdfurl\]#is";
$replacements[] = "<a href=\"\\1\" target=\"_blank\" title=\"\\1\" class=\"postlink\" rel=\"nofollow\">\\2 <img src=\"images/pdf_icon.gif\" border=\"0\" alt=\"\" /></a>";
Insert in language/english/bbcode.php starting at line 104
PHP:
'imgurl' => array('URL with Image:','[imgurl url=Page URL]http://image path[/imgurl]'),
'pdfurl' => array('URL with PDF icon:','[pdfurl url=PDF URL]link text[/pdfurl]'),
'table' => array('Table:','[table]text[/table]'),
'tr' => array('Table row:','[tr]text[/tr] usage: [table][tr]text[/tr][/table]'),
'th' => array('Table title:','[th]text[/th] usage: [table][tr][th]text[/th][th]..[/th][/tr][/table]'),
'td' => array('Table field:','[td]text[/td] usage: [table][tr][td]text[/td][td]..[/td][/tr][/table]'),
'list' => array('Bulleted List:','[list]list[/list]'),
'nlist' => array('Numbered List:','[list=1]list[/list]'),
'alist' => array('Alpha List:','[list=a]list[/list]'),
'ilist' => array('Roman List:','[list=i]list[/list]'),
'li' => array('List item:','[*]text usage (all lists): [list][*]text[*]text [/list]'),
Update: You also need the following edits, listed further down this thread.
And you will require a PDF icon image if you want to display one, info later in this thread.
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1
Ultima edición por layingback el Fri Oct 23, 2009 10:21 am, editado 2 veces

layingback- Site Admin

- Mensajes: 1119
- Registrado: Mar 18, 2006
Re: Tables in BBCode! Done!
Publicado: Tue May 12, 2009 7:45 am
Have made these changes and looks like it works a treat! Thanks layingback.
Do you have an easy way of remembering what files you have edited? Only reason I ask is that when it comes to updating the site I tend to forget and end up overwriting all the little changes like this one
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1
Do you have an easy way of remembering what files you have edited? Only reason I ask is that when it comes to updating the site I tend to forget and end up overwriting all the little changes like this one
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1

rosbif- BetaTester

- Mensajes: 424
- Registrado: Aug 01, 2007
- Ubicación: Chantilly, France
Re: Tables in BBCode! Done!
Publicado: Tue May 12, 2009 8:05 am
rosbif:
Do you have an easy way of remembering what files you have edited?
Yeah! I create a website, and record them all on there!
Also at a detail level I use a diff tool to compare new and old. Meld on Ubuntu, can't remember what I used to use on Windoze - it's been so long... CVS is best solution, but a bit of work to set up for all projects, so I reserve that just for the big stuff. Other possibility might be to save out diffs for all changes - assuming you have editor capable of this.
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1

layingback- Site Admin

- Mensajes: 1119
- Registrado: Mar 18, 2006
Re: Tables in BBCode! Done!
Publicado: Tue May 12, 2009 9:19 am
I knew it wouldn't be simple!
I haven't used a diff tool before so maybe I should go looking at one. Forum would be easiest I agree!
I'm using SuperEdi as my editor but it doesn't seem to be that happy in vista. What do you use?
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1
I haven't used a diff tool before so maybe I should go looking at one. Forum would be easiest I agree!
I'm using SuperEdi as my editor but it doesn't seem to be that happy in vista. What do you use?
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1

rosbif- BetaTester

- Mensajes: 424
- Registrado: Aug 01, 2007
- Ubicación: Chantilly, France
Re: Tables in BBCode! Done!
Publicado: Tue May 12, 2009 9:30 am
Geany, although Notepad++ is pretty good under Windoze. Of course, nothing's very good under Vista
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1

layingback- Site Admin

- Mensajes: 1119
- Registrado: Mar 18, 2006
Re: Tables in BBCode! Done!
Publicado: Fri Jun 05, 2009 12:10 am
Is it possible to implement this with the NBBCode module from ehpdesigns.com?
I tried and got an error, so I was wondering if I was trying to do the impossible with no hope of success.
Thanks.
warden's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
L-2.26 A-1.3.3 M-5.0x P-5.0x DF-9.2.1
I tried and got an error, so I was wondering if I was trying to do the impossible with no hope of success.
Thanks.
warden's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
L-2.26 A-1.3.3 M-5.0x P-5.0x DF-9.2.1

warden- Newbie

- Mensajes: 5
- Registrado: Mar 26, 2007
Re: Tables in BBCode! Done!
Publicado: Fri Jun 05, 2009 10:14 am
warden, it should be quite straightforward I would have thought, although the locations and perhaps a few variable names will be different. But to be honest I don't have the time or the inclination to potentially mess up EHP's fine module. It may happen that I need it, but currently I have NBBCode for some sites and my Tables code on others - I've not needed both on the same site, as yet.
But I did post a feature request on EHP's site for you ...
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1
But I did post a feature request on EHP's site for you ...
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1

layingback- Site Admin

- Mensajes: 1119
- Registrado: Mar 18, 2006
Re: Tables in BBCode! Done!
Publicado: Fri Jun 05, 2009 2:46 pm
Thank you.
warden's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
L-2.26 A-1.3.3 M-5.0x P-5.0x DF-9.2.1
warden's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
L-2.26 A-1.3.3 M-5.0x P-5.0x DF-9.2.1

warden- Newbie

- Mensajes: 5
- Registrado: Mar 26, 2007
Re: Tables in BBCode! Done!
Publicado: Tue Jun 23, 2009 11:45 am
I've just discovered that the list function doesn't seem to work. [list] just appears as [list] without being translated. It does funny things here on your site too if you follow the format shown in the hover tip..
Have I done something wrong?
eg
gives
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1
Have I done something wrong?
eg
Code:
[list][*]text[/*][/list]
gives
- text[/*]
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1

rosbif- BetaTester

- Mensajes: 424
- Registrado: Aug 01, 2007
- Ubicación: Chantilly, France
Re: Tables in BBCode! Done!
Publicado: Sun Jun 28, 2009 6:36 pm
Should be:
Click on BBCode FAQ for instructions
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1
- text
- text
- text
Click on BBCode FAQ for instructions
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1

layingback- Site Admin

- Mensajes: 1119
- Registrado: Mar 18, 2006
Re: Tables in BBCode! Done!
Publicado: Sun Jun 28, 2009 8:05 pm
Ah ok, it's correct in the FAQ but the mouseover instructions by the bullet are wrong..
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1

rosbif- BetaTester

- Mensajes: 424
- Registrado: Aug 01, 2007
- Ubicación: Chantilly, France
Re: Tables in BBCode! Done!
Publicado: Mon Jun 29, 2009 9:08 am
Thanks. Yes, too late to fix last nite, but edited now I believe. Last line of last insert.
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1
layingback's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
2.6.32 / 1.3.39 - 2.2.12 / 4.4.7 - 5.1.37 / 5.3.0 / 9.2.1

layingback- Site Admin

- Mensajes: 1119
- Registrado: Mar 18, 2006
Re: Tables in BBCode! Done!
Publicado: Thu Sep 03, 2009 12:23 pm
I seem to have a problem now with URL with Image, List Item and URL with PDF. The error shows up as Line 826, submit.html, object expected.
Incidentally there's a reference to images/pdf_icon.gif which I don't seem to have. Should I have that from somewhere?
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1
Incidentally there's a reference to images/pdf_icon.gif which I don't seem to have. Should I have that from somewhere?
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1

rosbif- BetaTester

- Mensajes: 424
- Registrado: Aug 01, 2007
- Ubicación: Chantilly, France
Re: Tables in BBCode! Done!
Publicado: Sun Sep 13, 2009 10:44 am
Also, I think I mentioned this before somewhere but can't remember where, pressing any BBCode button always puts the code at the bottom of the text, rather than around the highlighted text for example...
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1

rosbif- BetaTester

- Mensajes: 424
- Registrado: Aug 01, 2007
- Ubicación: Chantilly, France
Re: Tables in BBCode! Done!
Publicado: Fri Oct 16, 2009 10:08 am
Any thoughts on these last two posts (now that 3.2 is launched!!)
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1
rosbif's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux/2.2.11/4.1.22/5.2.5/9.2.1

rosbif- BetaTester

- Mensajes: 424
- Registrado: Aug 01, 2007
- Ubicación: Chantilly, France
Puede publicar nuevos temas en este foro
No puede responder a temas en este foro
No puede editar sus mensajes en este foro
No puede borrar sus mensajes en este foro
No puede votar en encuestas en este foro
You cannot attach files in this forum
Tu puedes descargar archivos en este foro
No puede responder a temas en este foro
No puede editar sus mensajes en este foro
No puede borrar sus mensajes en este foro
No puede votar en encuestas en este foro
You cannot attach files in this forum
Tu puedes descargar archivos en este foro
Todas las horas son GMT











