Hi,
How do you limit characters on just one of the fields within a loop ..?
Thanks
Limit characters
Moderator: General Moderators
Hi,
Kinda thought I was gunna get a reply like that .. soz
.. I have an admin panel to update news etc .. When the data is called back its in an alternating colour row format .. there are 3 fields been displayed back from the database " id, date, description" ..
What I want to do is limit the amount of characters that get displayed within the description field to say 50 characters .. as it is only a preview pane with a link off to edit | delete record .. Basically its so the rows dont end up to big as some of the descriptions hold alot of characters ..
Hopefully that makes better sence ..
Thanks ..
Kinda thought I was gunna get a reply like that .. soz
.. I have an admin panel to update news etc .. When the data is called back its in an alternating colour row format .. there are 3 fields been displayed back from the database " id, date, description" ..
What I want to do is limit the amount of characters that get displayed within the description field to say 50 characters .. as it is only a preview pane with a link off to edit | delete record .. Basically its so the rows dont end up to big as some of the descriptions hold alot of characters ..
Hopefully that makes better sence ..
Thanks ..
- harrisonad
- Forum Contributor
- Posts: 288
- Joined: Fri Oct 15, 2004 4:58 am
- Location: Philippines
- Contact:
re
supposing that you have a class named "Field", and an array of it's instance named $fields_aray....
if that's not what you're trying to ask, just forget about it, OK?
feyd | Please use
Code: Select all
//-------------------------
foreach($fields_aray as $field){
if($field->setType()==TYPE_TEXTBOX)
$field->setSize(50);
else
$field->setSize(DEFAULT_SIZE);
$field->showInputBox();
}
//----------------------------feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]