Ask a Question related to Macromedia ColdFusion, Design and Development.
-
Kamesh192 #1
search text bold
Hi
I have a search query on my site and i wanted to know if theres a way of making the text searched for appear in bold in the results page??
any help would be useful
thanks
kamesh
Kamesh192 Guest
-
Auto Bold text
I am setting up a verticle nav bar using text only with seven items in the list. I was wondering if it is possible to have the seven navigation... -
All text is Bold pls help
This page http://blowthetrumpet.org/MorningBriefing.htm is showing all my text bold eventhough the draft just has the news titles bold. Please help... -
Text in pdf looks bold or doubled. Why?
Hello out there. I work with Adobe Acrobat 6, Quark 6.3 and Illustrator 10. When I save files as pdfs in Illustrator with fonts outlined, some text... -
How to bold text in a forum
I have designed a forum for my site http://www.tecito.com -
text member text bold hilight
I am creating a dynamic search which shows the search results as hyperlinks to different parts of the movie. After selecting a result the user needs... -
Stressed_Simon #2
Re: search text bold
I assume that the field searched for is posted to the page from a form. So you
will have a variable something like this!
FORM.Search
You obviously use this in your SQL query to search the database. Then you
output the results to the page?
Well all you need to do then is put this somewhere.
<strrong><cfoutput>#FORM.Search#</cfoutput></strong>
Stressed_Simon Guest
-
Kamesh192 #3
Re: search text bold
Hi
thanks simon,
i undersatand what u mean, the search funtion basically searches through our
database and brings up projects which the user search for. however on the
results page there is a description which appears too, now if the word search
for by the user appears in the descriptio then i want it bold?
the site is [url]www.pixelwork.com.index.cfm[/url] - the search feature is at the bottom
left hand side of the page
hope i ve explained myself well??
thanks
kamesh
Kamesh192 Guest
-
Stressed_Simon #4
Re: search text bold
Here you go!
<cfset FORM.Search = "the">
<cfset FORM.Result = "This is the way to achieve the desired effect!">
<cfoutput>
<cfloop list="#FORM.Result#" index="ThisWord" delimiters=" ">
<cfif ListFindNoCase(FORM.Search, ThisWord, " ")>
<strong>#ThisWord#</strong>
<cfelse>
#ThisWord#
</cfif>
</cfloop>
</cfoutput>
Stressed_Simon Guest
-
Kamesh192 #5
Re: search text bold
Hi
i ve changed the code (see below), ive change form.search to form.criteria as
that is what my box is called on the search page. now the word "the" comes up
in bold, however i want the word entered by the user to appear in bold. so
technically what ever the user enters in form.criteria i want that to appear in
bold.
<cfset FORM.criteria = "the">
<cfset FORM.Result = "This is the way to achieve the desired effect!">
<cfoutput>
<cfloop list="#FORM.Result#" index="ThisWord" delimiters=" ">
<cfif ListFindNoCase(FORM.criteria, ThisWord, " ")>
<strong>#ThisWord#</strong>
<cfelse>
#ThisWord#
</cfif>
</cfloop>
</cfoutput>
Kamesh192 Guest
-
Stressed_Simon #6
Re: search text bold
OK, that was just to demonstrate the technique. To get it to work with the
return results, lets assume that your query is called qShowResults and the
field in your database is called Description. You have already said that the
search term is called Criteria.
Here is the code.
<cfoutput query="qShowResults">
<cfloop list="#Description#" index="ThisWord" delimiters=" ">
<cfif ListFindNoCase(FORM.Criteria, ThisWord, " ")>
<strong>#ThisWord#</strong>
<cfelse>
#ThisWord#
</cfif>
</cfloop>
</cfoutput>
Stressed_Simon Guest
-
Kamesh192 #7
Re: search text bold
hi
great! it works!
thanks for your help simon, there was one more question im trying to put in a
break (<br>) after description, so there is some space between records. but i
get error when i put the <br> after description. the error says "Invalid CFML
construct found on line 206 at column 35.
ColdFusion was looking at the following text: " , "
below is the code im using
<cfoutput query="search">
<a
href="workDetail.cfm?projectID=#search.projectID#& catID=#search.catID#">#Project
Name#</a><br>
<cfloop list="#(search.Description,<br>100)#..." index="ThisWord" delimiters="
">
<cfif ListFindNoCase(FORM.Criteria, ThisWord, " ")>
<strong>#ThisWord#</strong>
<cfelse>
#ThisWord#
</cfif>
</cfloop>
</cfoutput>
thanks agin for your help
kamesh
Kamesh192 Guest
-
Stressed_Simon #8
Re: search text bold
OK that wont work, you have to put the break tag after the loop has finished as
that is when the loop has finishaed and thus the whole record has been returned!
<cfoutput query="search">
<a
href="workDetail.cfm?projectID=#search.projectID#& catID=#search.catID#">#Project
Name#</a><br>
<cfloop list="#search.Description#..." index="ThisWord" delimiters=" ">
<cfif ListFindNoCase(FORM.Criteria, ThisWord, " ")>
<strong>#ThisWord#</strong>
<cfelse>
#ThisWord#
</cfif>
</cfloop><br />
</cfoutput>
Stressed_Simon Guest
-
-



Reply With Quote

