473,386 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Web page content in database + formatting?

Hi all,

Ok - this leads on from speaking to a couple here and in the SQL server
group...

I've an application which allows the user to type in their text into a form,
they add 'happy' tags around their words, the app then replaces these with
the html equivalent and saves it to the database...

Thus far this has been working very well.

I've been asked to add search functionality to the site now, and whilst I've
already made a good start on this, one slight fly in my coding oink-ment
(:@\) is the fact that when I search through it I have things like :

<b>hello world</b>

My initial search syntax might end something like this:

where PageContent Like '% hello %'

this would run off and try to find all the instances of 'hello' where its a
word in its own right, but as I've seen now - in the example above it
wouldn't find the word because of the first <b> tag.

Aaron (and others) mentioned a few ways to get around this but suggested the
problem was because I have the formatting and data in the same table....

There are currently 100+ pages, so therefore fixing/changing this could be a
bit of a sod, lucky I work closely with the company using this so I am happy
to spend the extra time and page by page if need be change each one to
correct it.

What I am unable to come up with yet is a 'good' way to seperate the
formatting from the text.

Thoughts so far :

2 tables - one with formatted text used only for display - and the second
then only used for searching, the content would be written to both tables at
the time of the page being created and then both again when updated etc.

This would be the 'easiest' way (apart from the 100+ already created), but I
dont 'personally' think its the best approach because of the data
replication.

Another thought was to have a lookup table, this would contain the page id,
and then many rows for each page with the character position of an opening
formatting tag, and the closing character position of a formatting tag, the
type of tag, and the 'detail' for the tag, ie

pageid 1
charpos 10
tagtype 1 (<a href>)
tagdetail <a href="http://www.mydomain.com" title="my domain">

This would enable me to strip the tags from the data table (only one now) -
but then there would be an overhead when putting it all together, and
obviously when saving the page initially or updating it later as it would
have to run through this procedure and try and find them all....

Because of the freedom the user has, ie, its not just 'header' and 'body'
and then I always make the header bold or something there are quite a few
tags that can be used, and some of them with variable data inside, ie the
hyperlinks for web pages or email addresses, I have image and document tags
for a repository for images and documents and so on...

Other than these 2 ideas I cannot at this time think of anything else, I
cant just use css because again I have the hyperlinks etc, and even then
there would need to be 'something' in the data that says "this has to be
bold"...

Anyone got any thoughts/ideas...?

As I said, I'm more than happy to change the 100+ pages and remove the tags
from the text, thus correcting the problem with the search, but I need a way
that will definately work before I even think about climbing that mountain!

Thanks for your time,

Regards

Rob
Jul 19 '05 #1
4 1820
Rob
Why not put a start and stop character on all non text values, .
In database store something like this [<b>]Hellow[</b>]World or if you use
them try | & ~
Than write 1 asp function that strips them out of the imcomming string, and
one function that puts them in.
That should be easy,.
As far as converting existing tags, you should work on copies of the
database and write a few throw away temp functions to prepare the existing
data,.
You will need to filter incoming user data to not accept your control
characters or all will go down toilet 8-)

Regards
Don
"Rob Meade" <ro********@NO-SPAM.kingswoodweb.net> wrote in message
news:xz*********************@news-text.cableinet.net...
Hi all,

Ok - this leads on from speaking to a couple here and in the SQL server
group...

I've an application which allows the user to type in their text into a form, they add 'happy' tags around their words, the app then replaces these with
the html equivalent and saves it to the database...

Thus far this has been working very well.

I've been asked to add search functionality to the site now, and whilst I've already made a good start on this, one slight fly in my coding oink-ment
(:@\) is the fact that when I search through it I have things like :

<b>hello world</b>

My initial search syntax might end something like this:

where PageContent Like '% hello %'

this would run off and try to find all the instances of 'hello' where its a word in its own right, but as I've seen now - in the example above it
wouldn't find the word because of the first <b> tag.

Aaron (and others) mentioned a few ways to get around this but suggested the problem was because I have the formatting and data in the same table....

There are currently 100+ pages, so therefore fixing/changing this could be a bit of a sod, lucky I work closely with the company using this so I am happy to spend the extra time and page by page if need be change each one to
correct it.

What I am unable to come up with yet is a 'good' way to seperate the
formatting from the text.

Thoughts so far :

2 tables - one with formatted text used only for display - and the second
then only used for searching, the content would be written to both tables at the time of the page being created and then both again when updated etc.

This would be the 'easiest' way (apart from the 100+ already created), but I dont 'personally' think its the best approach because of the data
replication.

Another thought was to have a lookup table, this would contain the page id, and then many rows for each page with the character position of an opening
formatting tag, and the closing character position of a formatting tag, the type of tag, and the 'detail' for the tag, ie

pageid 1
charpos 10
tagtype 1 (<a href>)
tagdetail <a href="http://www.mydomain.com" title="my domain">

This would enable me to strip the tags from the data table (only one now) - but then there would be an overhead when putting it all together, and
obviously when saving the page initially or updating it later as it would
have to run through this procedure and try and find them all....

Because of the freedom the user has, ie, its not just 'header' and 'body'
and then I always make the header bold or something there are quite a few
tags that can be used, and some of them with variable data inside, ie the
hyperlinks for web pages or email addresses, I have image and document tags for a repository for images and documents and so on...

Other than these 2 ideas I cannot at this time think of anything else, I
cant just use css because again I have the hyperlinks etc, and even then
there would need to be 'something' in the data that says "this has to be
bold"...

Anyone got any thoughts/ideas...?

As I said, I'm more than happy to change the 100+ pages and remove the tags from the text, thus correcting the problem with the search, but I need a way that will definately work before I even think about climbing that mountain!
Thanks for your time,

Regards

Rob

Jul 19 '05 #2
"Don Grover" wrote ...
Rob
Why not put a start and stop character on all non text values, .
In database store something like this [<b>]Hellow[</b>]World or if you use them try | & ~
Than write 1 asp function that strips them out of the imcomming string, and one function that puts them in.


Hi Don, thanks for the reply.

This is kinda what I have at the moment, from the user entering the data on
the form like this :

bold etc

which then gets changed using my function to

<b>bold</b>

which is then saved to the database.

I'm sure I could come up with something in ASP to remove the tags, ie, a
regular expression or something (with help from this group of course :D) -
but its on the SQL side I need to do this, when I execute the
searches...unless I have a clean, non-formatted version of the data in the
first place. I dont think I would want to retrieve every page and its
contents/data from the database into ASP then search through it in ASP.

Regards

Rob
Jul 19 '05 #3
Hi Rob

Sounds like an sql user function, i would be asking in sql programing or a
similar newsgroup.
But creating a filter for searching would not be that hard i would assume in
sql, you can you could create a stored procedure that called from the asp
page and in turn calls a function being passed whats to be searched for and
let the func retrieve and pass back data to return of sp ?.
Anyway it does sound like an sql newsgroup question.
Don

"Rob Meade" <ro********@NO-SPAM.kingswoodweb.net> wrote in message
news:1q*********************@news-text.cableinet.net...
"Don Grover" wrote ...
Rob
Why not put a start and stop character on all non text values, .
In database store something like this [<b>]Hellow[</b>]World or if you use
them try | & ~
Than write 1 asp function that strips them out of the imcomming string,

and
one function that puts them in.


Hi Don, thanks for the reply.

This is kinda what I have at the moment, from the user entering the data

on the form like this :

bold etc

which then gets changed using my function to

<b>bold</b>

which is then saved to the database.

I'm sure I could come up with something in ASP to remove the tags, ie, a
regular expression or something (with help from this group of course :D) -
but its on the SQL side I need to do this, when I execute the
searches...unless I have a clean, non-formatted version of the data in the
first place. I dont think I would want to retrieve every page and its
contents/data from the database into ASP then search through it in ASP.

Regards

Rob

Jul 19 '05 #4
"Don Grover" wrote ...
Anyway it does sound like an sql newsgroup question.


Hi Don,

Yes, if I do that in SQL then I should ask elsewhere :)

However....It was the theory, ie, has anyone else produced anything similar,
and done it a different way, ie the formatting not being in the same tables
as the data that I was interested in knowing as well, if they have then
maybe they'll have another stance on the way forward that I could adopt.

Regards

Rob
Jul 19 '05 #5

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

Similar topics

4
by: Rob Meade | last post by:
Lo all, Ok - just spotted another problem I'm going to have. All of the rows for the page content in the database contain formatting ie, <b>some bold text</b> This will cause me a problem...
2
by: sonic | last post by:
Hello, I've searched the web, and can't seem to find a good reference for msword ( content type ) formatting. I am presenting my information as microsoft word doc. I was able to format the text...
0
by: ian | last post by:
Hi, I am having problems formatting a web part zone when then zone appears within a content page. If I add a zone to a normal page, and auto format it then the zone appears as it should,...
9
by: sck10 | last post by:
Hello, I have a page with an ImageButton that is used to redirect to another page. When the page first opens, everything looks as expected. However, when I click on the image, the new page...
0
by: Managed Code | last post by:
Hello All, Here is my issue and thanks in advance for any assistance. I have a base page with a dropdownlist that fires an event with the selected index. The content page catches the event and...
8
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). This is my first foray into CSS in a style sheet...
2
by: Just Me | last post by:
Hi, Im playing with this concept at the moment and was hoping to design an image retreival system which would allow me to place images into the web page " Where I want them", but draw them from...
11
by: PW | last post by:
One of my ASP's was working fine for a long time. Now it has started constantly refreshing itself. Everytime I run it I just get the first part of the page, then it refreshes itself, the rest of...
5
by: =?Utf-8?B?UmJydA==?= | last post by:
There is a lot of good material related to using Master Pages for formatting controls and putting common design elements on multiple pages. I have VB.NET code that is common to all of my pages...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.