Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-08-09 05:21:13

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

[textile] No textile in article 'Title' box?

I’m trying to add a different colour and bolden the first word in my article headings but I now see that TXP is not processing any textile entered into the page title box. Am I doing something wrong or is this not possible – seems an odd ommission though I’m sure there’s a good reason for it. If not possible, does anyone have a better idea of how to achieve the same result?

Offline

#2 2007-08-09 06:04:32

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] No textile in article 'Title' box?

Yep, it does not process any Textile in tittle box, because URL is made automatically by it. This could be fixed by plugin, but there is some other way to do that too.

1. Use custom_field for title or first letter, like:

<txp:if_custom_field name="Title"><span class="first-letter"><txp:custom_field name="Title"></span></txp:if_custom_field> <txp:title />

OR

2. Use CSS, like:

h2:first-word {
font-weight: 900;
color: #333;
}

Cheers!

Last edited by Gocom (2007-08-09 06:19:37)

Offline

#3 2007-08-09 06:14:42

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: [textile] No textile in article 'Title' box?

Unfortunately the :first-word psuedo class is not currently available – first letter and first line but not first word. Possible recomendation for CSS3. I’ll go with the custom field option. Thanks for your help.

Offline

#4 2007-08-09 06:18:46

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: [textile] No textile in article 'Title' box?

Oops, so it was. Somehow I remember that first-word were already suported, sorry :-)
This f***ing summer-illness, heat & wetnose, makes me little confused, can’t even think clearly. Feels like my brains are melting down…

Cheers!

Last edited by Gocom (2007-08-09 06:23:46)

Offline

#5 2007-08-09 06:45:19

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: [textile] No textile in article 'Title' box?

Thats all good – I’m glad of the suggestions either way – and dont worry i went straight to the reference to check on first-word too. I think it is a recommendation for CSS3 so that would be a good implementation. I had the flu a couple of weeks back and it was a shocker – I sympathise strongly. Hope you get better soon ;)

Offline

#6 2007-08-09 11:45:51

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

Re: [textile] No textile in article 'Title' box?

Did you read this?

Offline

#7 2007-08-09 15:27:57

Manfre
Plugin Author
From: North Carolina
Registered: 2004-05-22
Posts: 588
Website

Re: [textile] No textile in article 'Title' box?

The html that wraps the title should be given class “first-word” and then add the below code to the top of your page template. Have the “first-word” css set up however you’d like for only the first word. The script below will find all elements with the “first-word” class, remove the “first-word” class and then replace the enclosed text so that the first word is wrapped with <div class="first-word">.

@<script type=“text/javascript”>
<!—

$(document).ready(function() {

$(“.first-word”).each(function() {

var str = $(this).text();

var i = str.indexOf(” “);

if (i != -1) { $(this).removeClass(“first-word”) .html(‘<div class=“first-word”>’ + str.substring(0,i) + ‘</div> ‘ + str.substring(i)); }

});

});

//—>
</script>@

Offline

#8 2007-08-09 21:52:27

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: [textile] No textile in article 'Title' box?

Wow Manfre, thats awesome. I’ll try that today. Thanks in advance.

Offline

#9 2007-08-10 05:18:43

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: [textile] No textile in article 'Title' box?

Thanks Manfre – took me a while and a bit of head scratching to figure out I needed to load jquery but I got there in the end.

The script doesnt seem to work with 2 word titles such as ‘About Us’ etc. Is there a modification to fix this or is it not possible?

Last edited by damienbuckley (2007-08-10 07:46:00)

Offline

#10 2007-08-19 17:26:21

ardilla
Member
From: California, USA
Registered: 2007-06-09
Posts: 11
Website

Re: [textile] No textile in article 'Title' box?

damienbuckley wrote:

The script doesnt seem to work with 2 word titles such as ‘About Us’ etc. Is there a modification to fix this or is it not possible?

That’s because you have the “prevent widows in article titles” option enabled. The last space will be a non-breaking space (either &#160; or &nbsp;) and the script only checks for regular spaces. Either disable the option (admin prefs), or tweak the script to look for non-breaking spaces too:

var test_sp_normal = str.indexOf(' '), test_nbsp1 = str.indexOf('&#160;'), test_nbsp2 = str.indexOf('&nbsp;');
var i = (test_sp_normal>0) ? test_sp_normal : ((test_nbsp1>0) ? test_nbsp1 : ((test_nbsp2>0) ? test_nbsp2 : -1));
if(i>0){ $(this)…. /* the original yadda yadda */ }

Of course, there are multiple ways to write that (and more efficient too—it’s been a while since the last time I wrote any JavaScript).

Last edited by ardilla (2007-08-19 17:27:36)

Offline

#11 2007-08-19 22:52:49

damienbuckley
Member
From: Brisbane, QLD, AU
Registered: 2006-02-24
Posts: 138
Website

Re: [textile] No textile in article 'Title' box?

Thanks ardilla. Thats now working for two word titles but not one word titles which I guess is because the script is looking for spaces? I’ve implemented a custom field with an if_custom field to check for it and use that instead of the usual title so i can inpt it manually. Unless there’s a simple fix or better way of achieving it?

Here’s the site to make more sense of what i’m doing.

Offline

#12 2007-08-20 14:59:18

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [textile] No textile in article 'Title' box?

Offline

Board footer

Powered by FluxBB