 |

elbav
User
Jan 14, 2006, 11:52 PM
Post #1 of 5
(919 views)
Shortcut
|
|
How to trim a field?
|
Can't Post
|
|
Hello, A simple formating question, but i could not find the answer here in the forum nore in the AM manual. Instead of displaying the entire $art_summary$ in the index, I would like to display only the first e.g.40 characters of $art_summary$. What is the syntax for this? ( Left 40 $art_summary$ ?? or Trim 40 $art_summary$ ) Thanks in advance.
|
|
|  |
 |

MikeB
Staff
/ Moderator

Jan 15, 2006, 3:50 PM
Post #2 of 5
(910 views)
Shortcut
|
|
Re: [elbav] How to trim a field?
[In reply to]
|
Can't Post
|
|
Hi elbav, Thanks for posting! While there isn't a built-in way to trim down the summary of an article there is a way you could do something like this with a bit of JavaScript. Cliff had actually put together a tutorial that outlines how to do this in Listings Manager here: http://www.interactivetools.com/forum/gforum.cgi?post=43820#43820 To have this work with Article Manager instead, in Step 2 you'll just want to actually find anywhere that this is output in your template files: $art_summary$ And replace it with this: <script> truncate("$art_summary_je$", "$detail_link$"); </script> Give this a try and let me know how it works out for you. If you have any other questions or comments, just let me know! Cheers, Mike Briggs - Product Specialist support@interactivetools.com
Hire me! Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.
|
|
|  |
 |

DesignGroup
User
Jan 16, 2006, 12:01 AM
Post #3 of 5
(906 views)
Shortcut
|
|
Re: [MikeB] How to trim a field?
[In reply to]
|
Can't Post
|
|
Can you please give us a PHP solution also? The javascript solution will mess with the search engines pretty badly, as they can not read the results.
|
|
|  |
 |

Cliff
Staff

Jan 16, 2006, 3:53 PM
Post #4 of 5
(895 views)
Shortcut
|
|
Re: [DesignGroup] How to trim a field?
[In reply to]
|
Can't Post
|
|
Hi DesignGroup, Thanks for posting. We are not really PHP experts, but if you research some of the various PHP resources out there you will probably be able to to tap into a way to get this going. I wish I could have been more help but let me know if you need any more details. Regards, Cliff Stefanuk - Customer Service Manager support@interactivetools.com
|
|
|  |
 |

rjbathgate
User
Oct 6, 2008, 2:46 PM
Post #5 of 5
(429 views)
Shortcut
|
|
Re: [Cliff] How to trim a field?
[In reply to]
|
Can't Post
|
|
Hi, I know this thread is really old, but I was searching for the same question - and have found a solution, so thought I'd update this thread for future readers...
<?php echo substr($tablenameRecord['fieldname'],0,100); ?> The substr returns part of a string, with the numbers at the end (0,100) defining what parts. In this example, it will return the first 100 characters, starting from the start (0). You can get more info on it (for example how to change what characters are displayed etc at: http://nz2.php.net/substr Hope it helps someone - it did me! Rob
|
|
|  |
|