Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Build a Basic PHP Website (2018) Enhancing a Form Wrapping It Up

I just wanna know how complex links are formed and how to link them page to page like WIKIPEDIA

I just wanna know how complex links are formed and how to link them page to page like WIKIPEDIA I'm really really impressed with the information website wikipedia and i really exited php behind this can you please let me know how it's done

Shreyas Sreenivasa
Shreyas Sreenivasa
7,804 Points

What do you mean by complex links? Could you give an example?

5 Answers

Shreyas Sreenivasa
Shreyas Sreenivasa
7,804 Points

Suppose the variable x contains your paragraph. You have a database name titles which stores the titles all the different pages on Wikipedia. You would write a loop to loop through all the words in x and write an if statement to check if there's a matching word in the titles database. If it does then check if the title includes more words, if it does then check whether it's before or after the matching word and check if those words exist in your paragraph as well. If it does then you could add a hyperlink with the link of the title (which you would be getting from the database) to those keywords and update x. Once it's done, take a preview of the parts hyperlinked and check if you wanted it to be hyperlinked and upload it to wherever you want (i suppose a database).

No not complex links how wikipedia managed to create links or urls from page to page in millions

Shreyas Sreenivasa
Shreyas Sreenivasa
7,804 Points

Organisation of data could be a simple answer, whenever they add information or update information they probably have a script which checks for keywords which exist in their database, and a human or probably even a script itself will check if the keyword needs to be linked or not. Machine Learning can get really advanced and complicated these days!

Thanks shreyas, i'm really close to clarity ,just put machine Learning aside and work with php and mysql how that keyword checkup/hinting will be done.

Thanks shreyas, ☆☆☆☆☆

Ref: Organisation of data could be a simple answer, whenever they add information or update information they probably have a script which checks for keywords which exist in their database, and a human or probably even a script itself will check if the keyword needs to be linked or not Q: how php links the url to the particular word that found in the database when user enter(type) it , is there any special functions available in phpto do so