Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic text

Status
Not open for further replies.

damipera

Technical User
Dec 1, 2005
134
0
0
GB
hi guys can you give me some advice/direction as to how i should attack this problem.

i have a table myTable1 which contains the markup to be put onto a dynamic page and i have another table which contains some keywords that should alter a bit the first table's contents(when written on a page) when it finds some texts that are also contained in it, like in this example, its color.


Code:
myTable1
---------

id  contentsColumn

.  | blah blah

.  | blah blah

.  | blah blah

23 | <p>In <A href="/wiki/Publishing">publishing</A> and <A href="/wiki/Graphic_design">graphic design</A>, <strong>lorem ipsum</strong><A href="#References">[p]</A><A href="#cite_note-SDop-0">[1]</A><A href="#cite_note-Lgen-1">[2]</A> is placeholder text (filler text) commonly used   to demonstrate the <A title="Graphics" href="/wiki/Graphics">graphic</A> elements   of a document or visual presentation, such as <A href="/wiki/Font">font</A>, <A href="/wiki/Typography">typography</A>, and <A title="Page layout" href="/wiki/Page_layout">layout</A>. The lorem ipsum text is typically a section   of a <A href="/wiki/Latin">Latin</A> text by <A href="/wiki/Cicero">Cicero</A> with words altered, added and removed that make it nonsensical in meaning and   not proper Latin.<A href="#cite_note-SDop-0">[1]</A><A href="#cite_note-Lgen-1">[2]</A> A close English   translation of the words <em>lorem ipsum</em> might be "pain itself"   (<strong>dolorem</strong> = pain, grief, misery, suffering; <strong>ipsum</strong> = itself).</p>


24 | blah blah
.
.
.

Code:
anotherTable
---------------

id   keywords   color
1 |  elements   red
2 |  ipsum	blue
3 |  text 	yellow

the page should look like this: ...../sample.asp?id=23

Code:
<p>In <A href="/wiki/Publishing">publishing</A> and <A href="/wiki/Graphic_design">graphic design</A>, <strong>lorem <font color="#0000FF">ipsum</font></strong><A href="#References">[p]</A><A href="#cite_note-SDop-0">[1]</A><A href="#cite_note-Lgen-1">[2]</A> is placeholder <font color="#FFFF00">text</font> (filler <font color="#FFFF00">text</font>) commonly used   to demonstrate the <A title="Graphics" href="/wiki/Graphics">graphic</A> <font color="#FF0000">elements</font>   of a document or visual presentation, such as <A href="/wiki/Font">font</A>, <A href="/wiki/Typography">typography</A>, and <A title="Page layout" href="/wiki/Page_layout">layout</A>. The lorem <font color="#0000FF">ipsum</font> <font color="#FFFF00">text</font> is typically a section   of a <A href="/wiki/Latin">Latin</A> <font color="#FFFF00">text</font> by <A href="/wiki/Cicero">Cicero</A> with words altered, added and removed that make it nonsensical in meaning and   not proper Latin.<A href="#cite_note-SDop-0">[1]</A><A href="#cite_note-Lgen-1">[2]</A> A close English   translation of the words <em>lorem <font color="#0000FF">ipsum</font></em> might be "pain itself"   (<strong>dolorem</strong> = pain, grief, misery, suffering;<font color="#0000FF"><strong>ipsum</strong></font>= itself).</p>


i have tried all sorts but i can't find any solution. any advice? thanks






 
Hi,

Probably want to make an array from anothertable.
Then loop through array and use REPLACE to wrap the matched text with html formatting
something like: (this is completely untested!)
<code>
for x=0 to ubound(anothertable,2)
x_keyword = anothertable(1,x)
x_color = anothertable(2,x)
x_output = Replace(contentsColumn,x_keyword,"<font color="" & x_color & "">" & x_keyword & "</font>"))
next
</code>

as far as converting the color names to hex codes - you dont need to
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top