Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. How to bold text in a forum
      I have designed a forum for my site http://www.tecito.com
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default 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

  7. #6

    Default 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

  8. #7

    Default 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

  9. #8

    Default 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

  10. #9

    Default Re: search text bold

    hi

    super! thank for all your help

    kamesh
    Kamesh192 Guest

  11. #10

    Default Re: search text bold

    hi

    super! thanks for all your help

    kamesh
    Kamesh192 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139