Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2010-03-12 03:21:50

JanDW
Plugin Author
From: Providence, RI, USA
Registered: 2008-07-18
Posts: 327
Website

Re: Q4T - Trance music parties in the Netherlands.

Thanks a lot, Gil. Really useful stuff!


TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX

Offline

#14 2010-04-05 15:50:38

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Q4T - Trance music parties in the Netherlands.

Sorry to post this comment here instead than on txptips but I don’t seem to be allowed to paste code there. On submit it reports “Your comment was marked as spam.”

Hi, finally I found a moment to examine this tip more thoroughly.

You made a good work, that’s just the kind of customization I had in mind when I wrote the plugin… anyway I’d like to point out (especially for people who don’t want to use javascript) that you could achieve almost the same results using only the standard plugins interface and css instead.

In particular you can take advantage of the valid and widely supported css capability to apply multiple classes (separated by spaces) to an html element. These can be set directly through the plugin interface inserting a series of space separated classes.

For example a (pseudo) table header cf could have the following classes: cft cfth cfth_special_type and so on.

Another thing I noticed is an error in you code: You can’t use a specific id multiple times in the same html page (it’s not valid). But this is not a great problem, use a class instead (like .cft in your case), as I explained before.

Below are my comments to your snippets (published on txptips). Maybe they will be useful for anyone who wants to abtain a similar layout without using jquery

<script type="text/javascript">

$(document).ready(function(){

// ---

// --- Changing the header columns titles.

$("label[for='custom-1']").replaceWith("<label for='custom-1' class='custom-1'>Column #1 title</label>");

$("label[for='custom-2']").replaceWith("<label for='custom-2' class='custom-2'>Column #2 title</label>");

$("label[for='custom-3']").replaceWith("<label for='custom-3' class='custom-3'>Column #3 title</label>");

// ---

// --- Adding ID attribute to the <p> tag of all the fields.

$("label[for='custom-1'],[for='custom-2'],[for='custom-3'],[for='custom-4'],[for='custom-5'],[for='custom-6'],[for='custom-7'],[for='custom-8'],[for='custom-9']").parent().attr('id', 'cft');

// ==> You can't use an id multiple times in the same html page. No problem, use a class instead

// ---

// --- Adding CLASS attribute to the <p> tag of the header fields.

$("label[for='custom-1'],[for='custom-2'],[for='custom-3']").parent().attr('class', function (arr) {return "glz_custom_field cfth cfthc" + arr;});

// ==> add a class directly through the bot_wtc interface and use css

// ---

// --- Adding CLASS attribute to the <p> tag of the other regular fields.

$("label[for='custom-4'],[for='custom-5'],[for='custom-6'],[for='custom-7'],[for='custom-8'],[for='custom-9']").parent().attr('class', function (arr) {return "glz_custom_field cftc c" + arr;});

// ==> add a class through the bot_wtc interface and use css

// ---

// --- Adding a blank <div> tag above the field that comes right after the table for controling the space between.

$("label[for='body']").before("<div class='cftbs'>&nbsp;</div>");

// ==> you can use css margins after applying a specific class to the body element

// ---

// --- Removing the <br /> tag in all the table fields.

$("p#cft br").remove();

// ==> you can use use css .cft br {display:none;}

// ---

// --- Removing the <label> tag in all the table fields beside the header columns.

$("p.cftc label").remove();

// ==> again, you can use use only css: .cft label {display:none;} and then .cfth label {display:block;}

// ---

});

</script>

Offline

#15 2010-04-05 18:57:13

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 619
Website

Re: Q4T - Trance music parties in the Netherlands.

redbot wrote:

you could achieve almost the same results using only the standard plugins interface and css instead.

Ohh yea and that will make the page loading time to be much faster without all the JS manipulations ;)

redbot wrote:

Another thing I noticed is an error in you code: You can’t use a specific id multiple times in the same html page (it’s not valid). But this is not a great problem, use a class instead (like .cft in your case), as I explained before.

Ohh #2, right I don’t really use ID attributes in my sites,
so I totally forgot that you use each only ones, Thanks!

redbot wrote:

Below are my comments to your snippets

Cool, when I will have some free time I will do the changes and post them on txptips. =)

Offline

#16 2010-06-07 17:47:13

Vide-Dressing
Member
Registered: 2010-06-07
Posts: 31

Re: Q4T - Trance music parties in the Netherlands.

This is one of the most amazing txp design i’ve seen. You did a great work !

Offline

Board footer

Powered by FluxBB