- Zonehacks.com
- Forums
- PHP
- Creating a Glossary
Not logged in - Click here to login to your Account Welcome Guest!
|
Creating a Glossary
|
|
Author Info:
|
|
| mfoland Posted 11 months ago. Total XP: 335 |
OK. I am creating a glossary, which right now is rather easy.. www.naawc.org/glossary . However in products that we issue in our database, which will grab the text from the database, I want to be able to highlight certain words in the glossary if they are on the product, so people can click on that and view what the word means. Here is a perfect example that shows the highlighting in the product from my national weather service forecast office: http://forecast.weather.gov/product.php?site=NWS&issuedby=ILN&product=AFD&format=CI&version=1&glossary=1&highlight=off Obviously from there, I think in the link.. glossary=1 would mean that it is on. I may want to allow people to have the option to turn that highlighting like that on or off.. I haven't decided yet.. The glossary part is done, I just need to figure out how to get things to highlight in an issued product. I may have to create a sample discussion on my website with some abbriviations in the database, so you can see how to get it.. By the way, in my text products: <?=$text?> is what will echo all issued text for that product.
Thanks guys! |
| Specific Posted 11 months ago. Total XP: 4875 |
You would use preg_match or preg_replace to add font styles to keywords. |
| mfoland Posted 11 months ago. Total XP: 335 |
I haven't used that in any of my scripts.. would that be set up like an SQL statement or an if statement? |
| Jordan Posted 11 months ago. Total XP: 870 |
Its a function... lol, its not an if statement :P...
|
| mfoland Posted 10 months ago. Total XP: 335 |
LOL. One friend showed me, but when I do the $word to get it from the database, and yes even with having an SQL statement... it does not highlight the words that are suppose to that are in the database LOL. |
| Specific Posted 10 months ago. Total XP: 4875 |
I wish that I could get you to think logically, but that is probably asking too much. So before you scroll down, copy and paste, or whatever, please take the time to read what I've written. You know the task you want your program to complete, but do you know how to complate that task yourself? A program is only as good as the person who creates it. What I mean by this is that if you can't do it yourself, then your program is not going to be able to do it. Ask yourself questions, provide answers. For example, how do you highlight a specific word in HTML? The answer is to scan through the HTML until you find your specific word, and then surround it with a span tag decorating the text. If you made it this far, reply with "I've asked the question, I have the answer," I'll be surprised. Now that you know how to highlight a word in HTML, lets write a program to do it for you. Lucky for you there is a function that saves a lot of time when searching for words and replacing them. You can read more on it in the PHP manual. Hope you've learned something... |
| Specific Posted 10 months ago. Total XP: 4875 |
You'll probably need to copy this too. Add between the <head> tags in your html, or in your CSS file. <style> |
| mfoland Posted 10 months ago. Total XP: 335 |
Yes... the person who showed me was using str_replace. LOL. now what was the \1?
Wait.. when I did that.. the text from the database didn't show.. and the words should automatically get from the database.. I am also using a sql satement as well. Last modified by mfoland on October 26, 2009, 8:12 pm |
| Specific Posted 10 months ago. Total XP: 4875 |
lol |
| mfoland Posted 10 months ago. Total XP: 335 |
When I used the str_replace it echoed the text.. the only thing It would not do is highlight the words.. lol.. that was weird.. same with this, but it don't even highlight the word.. Maybe I might have to go play around in the database.. |
Not logged in - Click here to login to your Account
| Topic Title | Forum | Last post Info |
|---|---|---|
| DirectPlay | CPP | August 18, 2010, 7:58 pm by Specific |
| Reverse Challenges | Reverse Engineering | July 25, 2010, 7:55 pm by Specific |
| Encryption | General Development | May 6, 2010, 3:04 pm by sypher |
| Playstation Home Beta | Game Discussion | December 12, 2008, 11:36 am by polak |
| Reversing Challenge. Interested? | Reverse Engineering | October 20, 2008, 1:26 am by Jordan |

