Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-04-26 07:39:44

kemie
Plugin Author
From: mexico<-->sweden
Registered: 2004-05-20
Posts: 495
Website

Override custom field character limit?

I want to have about a paragrph’s worth of text inside a custom field, but it seems to be getting cut off after x amount of characters. is this limit changeable/hackable, and if so where/how? thanks!

edit: Just read mary’s post on the 255 char limit, question still stands, any way to override it?

Last edited by kemie (2006-04-26 07:41:02)


~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~

Offline

#2 2006-04-26 15:51:22

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

Re: Override custom field character limit?

You can change the type of the field in the database, using phpMyAdmin, see here for possible types. What I don’t know is how this will affect performance.

Offline

#3 2006-05-25 15:50:31

eric2007
Member
Registered: 2006-05-25
Posts: 18

Re: Override custom field character limit?

So, how do you do this? I am trying to do the same thing — to add 3 custom fields with no character limits.

Also, once the tweak is done, how will I change the custom field in the textpattern backend to be multi-line instead single-line?

Offline

#4 2006-05-26 00:48:23

eric2007
Member
Registered: 2006-05-25
Posts: 18

Re: Override custom field character limit?

I found the relevant code in txp_article.php, I think:
<code> // custom fields, believe it or not ($custom_1_set) ? custField( 1, $custom_1_set, $custom_1 ) : ‘’, ($custom_2_set) ? custField( 2, $custom_2_set, $custom_2 ) : ‘’, ($custom_3_set) ? custField( 3, $custom_3_set, $custom_3 ) : ‘’, ($custom_4_set) ? custField( 4, $custom_4_set, $custom_4 ) : ‘’, ($custom_5_set) ? custField( 5, $custom_5_set, $custom_5 ) : ‘’, ($custom_6_set) ? custField( 6, $custom_6_set, $custom_6 ) : ‘’, ($custom_7_set) ? custField( 7, $custom_7_set, $custom_7 ) : ‘’, ($custom_8_set) ? custField( 8, $custom_8_set, $custom_8 ) : ‘’, ($custom_9_set) ? custField( 9, $custom_9_set, $custom_9 ) : ‘’, ($custom_10_set) ? custField( 10, $custom_10_set, $custom_10 ) : ‘’,</code>

How do I change those one-line input fields into textareas?

Last edited by eric2007 (2006-05-26 00:48:56)

Offline

#5 2006-05-26 12:56:09

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: Override custom field character limit?

You would need to change the custField() function in textpattern/includes/txp_article.php to output a textarea instead of an input.

Look in textpattern/lib/txplib_forms.php for the form related functions.


Shoving is the answer – pusher robot

Offline

#6 2006-05-26 22:47:02

eric2007
Member
Registered: 2006-05-25
Posts: 18

Re: Override custom field character limit?

Here’s the custfield() function:

<code>// ——————————————————————————————- function custField($num,$field,$content) { return graf($field . br . fInput(‘text’, ‘custom_’.$num, $content,‘edit’)); }
</code>

I don’t know much (any) php, but I figure I have to do something like this:
<code>
////////// from text_area() function in lib/txplib_forms.php: function text_area_cust($name,$thing=’‘) { return ‘<textarea name=”’.$name.’” cols=“1” rows=“1” style=“width:100px;height:80px” margin-bottom:1em;”>’.$thing.’</textarea>’; }

////////// and this is from custField(): function custFieldArea($num,$field,$content) { return graf($field . br . text_area_cust(‘custom_’.$num, $content)); }
</code>

Then, for all custom field #s whose mysql formats I’ve changed from varchar(255) to text, I replace
<code>($custom_7_set) ? custField( 7, $custom_7_set, $custom_7 ) : ‘’,</code>
with
<code>($custom_7_set) ? custFieldArea( 7, $custom_7_set, $custom_7 ) : ‘’,</code>

This seems to work, except that line breaks don’t come out.

How do I fix that, and are my functions ok? Advice?

Last edited by eric2007 (2006-05-26 22:49:52)

Offline

Board footer

Powered by FluxBB