Simon
|
| Posted: 11/29/2002, 8:04 PM |
|
Hi - I've taken the Classifieds example and used it as the basis for a project of my own. I'm trying to do something which I'm unsure about and wondered if there was anyone out there kind enough to help.
I have a main page that displays recently added items, but I want to limit the description of the items to, say, 15 words. The item page will have the full description but I want a truncated verion on the main page - I figure I need to to write custom code in the Before Show event of the form to truncate the field value, but I don't know how to do this. Any suggestions?
I'm grateful for any help!
Simon
|
|
|
 |
Roeby
|
| Posted: 11/30/2002, 6:10 AM |
|
Hi,
Are you using Codecharge 2 or Studio?
If you are using Studio I have enclosed an example below or if you are using Codecharge 2 if you get the gotocode project and have a look at the 'apps' page it does the same thing there.
function news_newstext_BeforeShow() { //news_newstext_BeforeShow @18-F72D4A2C
//Custom Code @19-2A29BDB7
// -------------------------
global $news;
$news->newstext->SetValue(substr($news->newstext->GetValue(),0,50). '...');
// -------------------------
//End Custom Code
|
|
|
 |
custom code
|
| Posted: 11/30/2002, 12:53 PM |
|
Hi Roeby - thanks so much! Much appreciated - I use CodeCharge 2.
However, I'm a little confused - where do I go to see the example?
Sorry for being dim.....!
Simon
|
|
|
 |
Roeby
|
| Posted: 11/30/2002, 2:07 PM |
|
The Gotocode app is at:
http://www.codecharge.com/download/files/examples/gotocodev2.zip
But the bit of php code I was talking about is:
if( strlen($flddemo_url) > 35 ) $flddemo_url = substr($flddemo_url,0,32) . "...";
The asp is in the app as well if that is what you want.
|
|
|
 |
lneisius
|
| Posted: 11/30/2002, 2:12 PM |
|
click the word bulletins below
|
|
|
 |
Simon
|
| Posted: 11/30/2002, 7:52 PM |
|
Got it - thanks so much.
Simon
|
|
|
 |
|