473,796 Members | 2,609 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Containing ANY data in a table cell.

I am truncating data from an SQL database and have a script that populates a
cell. The problem that I have is I have HTML tags in my database so if the
data gets truncated in the middle of a tag, then my page goes...well, you
know. What I am looking for is a way that I can contain ANY data (i.e.
characters, tags, etc.) directly in that cell. So...If I have a <table> tag
it will not throw off the rest of the table tags throughout my page.

Please, any idea would be appreciated.

Thanks,

Joe
Jul 20 '05 #1
1 1853

"Joe Conlin" <jo*@bellyusa.c om> wrote in message
news:dh******** *************** @twister2.starb and.net...
I am truncating data from an SQL database and have a script that populates a cell. The problem that I have is I have HTML tags in my database so if the
data gets truncated in the middle of a tag, then my page goes...well, you
know. What I am looking for is a way that I can contain ANY data (i.e.
characters, tags, etc.) directly in that cell. So...If I have a <table> tag it will not throw off the rest of the table tags throughout my page.


I can think of two different things you might have in mind:

1. You want the data to be treated as actual HTML inside the table cell. For
example, if your data (after truncation) were:

This is the <em>last</em> time that I will ever trav

then you would want this string to be displayed with the word "last"
italicized (assuming that is how the browser handles <em>), and without
explicitly displaying the <em> and </em> tags.

2. You want to display HTML tags from the data literally. Using the sample
string above, you would want to display, literally,

This is the <em>last</em> time that I will ever trav

with explicit tags, and without any change in the appearance of the word
"last".

In the latter case, you're escaping your data anyway, replacing < with &lt;
and > with &gt;. Once you've done that, there's no problem: it won't matter
whether the truncation occurs between opening and closing tags, or within a
tag.

In the former case, I think you're out of luck. Depending on whether there
are any restrictions on the tags you permit to be stored in the data in the
first place, your problems may go beyond the ones you mentioned. What if the
data includes tags that can't appear inside a TD, like <head> or <title> or
<body>? What if there's an <img> tag whose source is a relative URL that has
no meaning from the perspective of your web site? Unless you develop some
extraordinarily sophisticated code to reduce your data to something that can
appear properly inside a TD, as well as accounting for and filling in
missing end tags and even missing tag *parts*, you're going to have trouble.

The only practical solution I can think of is to filter out *all* tags and
just display plain text. (In that case, you would probably filter first,
then truncate.) This is what search engines do when they display excerpts
from pages that match your query.

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
8367
by: christian9997 | last post by:
Hi I was trying to create a page where a SubMenu would appear when the user moved the mouse over an item of a Menu (= Table Cell <TD>). Unfortunately there seems to be a problem; the onMouseOver event is fired as soon as the mouse enters the cell but then the onMouseOut event is fired when it is moved over the writing inside the cell. The browsers seem to consider that the writing is not part of the cell. After a lot of waisted time I...
10
2338
by: Andrew Thompson | last post by:
http://www.physci.org/test/chem/element.html, represents information on a chemical element. (http://www.physci.org/test/chem/ for the CSS's) Not yet coded for links to other forms of the element. Suggestions for layout welcome. NN 4.8 displays lambda, kappa and rho as '?'. Is there any way of getting the greek letters to appear for NN 4.8?
1
5906
by: Uthuras | last post by:
Greetings, Machine : Pentium IV Os Windows 2000 server Product : DB2 UDB Release : 7.2 We are fail to load the following data file format into db2 database table that has long varchar data type. The load command with 'delprioritychar' option does not seem to help much on the loading process.
0
1999
by: Pat Sagaser via .NET 247 | last post by:
I'm trying to add LinkButtons to a Repeater control using adynamic template. The docs state that you should be able tobubble the click event to the containing Repeater. There areplenty of examples in the documentation for doing this using an<ItemTemplate> tag, but I haven't found any indication for howyou would do this in a dynamic template (implementing theITemplate interface). I'm adding the LInkButton in the TemplateDataBinding...
2
1991
by: John A Grandy | last post by:
anyone know why this is ? Imports System.Data Imports System.Diagnostics Public Class WebForm12
4
1605
by: toby989 | last post by:
Hi All Anyone came across this problem before? I have an X<L file created by excel <xml id="model"> <root> <Row>
10
2316
by: Frank van Wensveen | last post by:
Friend, coders, fellow wage slaves, lend my your ears. I believe that in a perfect world the design of a website (or feature on a website) should be totally separated from its design and the data it serves up. I'd like some suggestions on good ways to do this, because in the real world it can be quite difficult. For example, if I'm rummaging around in a MySQL database, the table structure and the code that generates the SQL requests...
7
3385
by: Mariusf | last post by:
I am a novice Perl programmer and need to change a perl script that I use to create web pages with thumbnail images and some text. Currently the script created a web page for each artist / category with all the thumb images below one another in the table. Thus the table has one column with a row for each image. I am trying to change the script to have 3 columns in the table in the end (first testing with second column as in the attached...
6
2946
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1) Constraint pk_table1 Primary Key,
0
9535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10242
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9061
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.