NP_Table - tool for automatic creation of tables and lists
MyEgo.cz
NP_Table - tool for automatic creation of tables and lists
NP_Table is a new plugin for Nucleus CMS. And I believe, and immensely useful one! It allows to create, in a very user-friendly way, a table, assign a name and description to this table, add, edit and delete items, and, also, create templates (header, footer, odd item, even item), that will display this table in your skin (skinVar) or even in your article (by subscribing to PreItem event)!
Of course, you can create as much tables as you like! And, because of templating system for each "table", they do not have to look like <table>s, but, e.g., like lists ( <ul>, .. <li> ), or separated by <br />.
How it can be used? Imagine, e.g., that you wrote 10 articles about Nucleus. Now, you would like, for each article, to include an updated list of links to few sites that inspired you. Support forums, and such. With NP_Table, you will create a new "table", called, e.g., nucleuslinks. You will, in Nucleus admin interface, add items to this table. And change them, any time. And by calling % ++Table(nucleuslinks)++ % (no spaces inside) in your articles body, NP_Table will automatically display this table, or list, or whatever (as each "table" has its own template) in all your articles.
You can also create a list of your favourite links, bookmarks (and maintain this in a very user-friendly way from admin interface) and display it on you homepage, by using a skinVar called <%Table(nucleuslinks)%>.
Possibilities for usage are unlimited… Phone numbers, email lists, come to mind…
Want to see some examples?
- homepage of NP_Table with 2 tables already defined.
- adding, editing and deleting items for a selected table.
- table, a user-defined item template.
- list, a user-defined item template,
Download:
Download at: NP_Table.zip (20kB).
Installation:
Copy-over all files in nucleus directory. There are sub-directories styles, plugins, and table. Copy all of them, overwriting files that already exist. NP_Table will work with Nucleus 2.0 and above, including non-XE and XE versions.
After that, install the plugin in admin interface and set its options, especially how much columns wil NP_Table support (you can set it to any number you want, this will only influence how big the form for creating the table will be constructed). You’re done.
After that, you will see a new menu option, called Tables, in admin area QuickMenu.
Basic Usage:
NP_Table has 2 basic column types. Text and Number (integer). When creating a table, you have to specify table name (only letters a-z, and numbers 0-9). Table name is used as a the only parameter when you call NP_Table plugin in your skins.
You will also have to create table fields. Maximum number of fields is determined by NP_Table plugin options. Each field has its name, again, 0-9, a-z only, which identifies this field in templates, and description, which will be displayed as a table header, if defined.
After creating a table, default header, item1 (odd rows), item2 (even rows) and footer templates will created. These default templates look like this:
Header template:
<h4><%tabledescription%></h4> <table><thead><tr> <th>link</th> <th>http</th> </tr></thead><tbody>
Item (individual row) template:
<tr> <td><%link%></td> <td><%http%></td> </tr>
Footer template:
</tbody></table>
Alternate Usage:
You can change these templates to anything you wish, e.g. for a link list, you could define header:
<h4><%tabledescription%></h4><ul>
Item:
<li><a href='<%uri%>'><%title%></a></li>
And footer:
</ul>
As simple as that.
Calling the plugin:
Now, you can call this table by:
%++ Table(name) ++% (default, ascending sort by 1st column) or %++ Table(name,column,asc/desc/none) ++% (sort by asc/desc/none order, by column)
in your article(s), no spaces inside, or by
<%Table(name)%> (default, ascending sort by 1st column) or <%Table(name,column,asc/desc)%> (sort by asc/desc/none order, by column)
in your default / detailed / archive / search skins.
Anything else?
Sure, if you like this plugin, let me know. I coded about 20 plugins up to now, and… your feedback keeps me working on additional ones :) Let me know also your wishes for next plugin versions in Nucleus XE Support Forum.
This looks very, very nice! 8)
This is cool! However when I add it to my Main Index it seems to mess up the way the page is displayed. Check out http://www.howlifeis.com to see what I mean.
Also it would me nice to be able to go back and change the name of the Table or Description. :P
[2] Jack, you have error in your template syntax.
header (a list):
<ul>
item:
<li><a href=...>Ebay</a></li>
footer (table, this is wrong!):
</tbody></table>
[3] Man I feel so stupid. This plugin is going to make my life so much easier. Thanks again for your help! :P