CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Reduce Characters in a grid

Print topic Send  topic

Author Message
popularanky

Posts: 53
Posted: 09/21/2010, 7:06 AM

I have a grid field for news and I want to reduce the characters to 100 with a "Read More" link, so that users can click on the link to read the full news.
_________________
EKERE UBONG UBONG
IT Officer
CognitiveDrive
View profile  Send private message
datadoit
Posted: 09/21/2010, 7:18 AM

What's your environment? Language and database.
popularanky

Posts: 53
Posted: 09/21/2010, 7:53 AM

I am using CCS 4.3, PHP MYSQL
_________________
EKERE UBONG UBONG
IT Officer
CognitiveDrive
View profile  Send private message
solesz

Posts: 137
Posted: 09/22/2010, 1:04 AM

Hello,

I propose to create a separate field in your database for the summary text then when you display you can put a link to view more.
When visitor clicks view more link, you can redirect him into a page where summary text and article body is composed together as a simple block.

This soluiton let you control how do you want to catch your visitor attention - with a summary text - , and there is no need to find out logic and program it which can cut your text into two parts, at the right place (will be understable after cutting, cut not within a nbsp sign... etc.)

solesz

datadoit: I think the base solution is language and database independent...
View profile  Send private message
popularanky

Posts: 53
Posted: 09/22/2010, 1:23 AM

I have been doing that, but the problem here is that this process the users has to input the sentences ,so I don't have control over their length of input and I don't want to stop the length of sentence. and also don't want to give them two fields for same values. I just want the same control Facebook uses for comment reduction.
_________________
EKERE UBONG UBONG
IT Officer
CognitiveDrive
View profile  Send private message
MaFi

Posts: 49
Posted: 09/22/2010, 2:04 AM

why don't you use MySQL Function LEFT(str,len) ?
SELECT LEFT(Field1, 100) AS NewField FROM Table1
View profile  Send private message
popularanky

Posts: 53
Posted: 09/22/2010, 2:21 AM

hOW CAN i INCLUDE THIS INTO MYSQL OR CCS?
_________________
EKERE UBONG UBONG
IT Officer
CognitiveDrive
View profile  Send private message
MaFi

Posts: 49
Posted: 09/22/2010, 11:52 PM

You can use the Visual Query Builder in CCS to specify the the field LEFT(Field1, 100) in the SELECT area under Column/Expression and NewField in the Alias .
View profile  Send private message
datadoit
Posted: 09/23/2010, 6:20 AM

For your data column's label, we'll call it Lbl_News, in the Server ->
Before Show for the label, add custom code:

if (strlen($Component->GetValue()) > 100)
{
$Component->SetValue(substr($Component->GetValue(),0,100) . " ... [<a
href='YourMorePage.php?'" . CCGetQueryString("QueryString","") . "
alt='' title='Click to read more.'>more</a>]");
}

Make sure Lbl_News' Content property is changed from the default Text to
HTML.

See http://www.php.net/manual/en/ref.strings.php for more wonderful
string functions.
CodeChargeMVP

Posts: 473
Posted: 09/23/2010, 6:51 AM

There many possible solutions,

javascript and Visual query builder seems the faster and easiest.


_________________
Best Regards
Entrepeneur | NT Consultant
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.