Jump to content

Look for words in variable orders and replace them with link


anarchoi

Recommended Posts

Okay well I'm modifing a php-nuke module to make my own "virtual library" script to make a database of revolutionary working class movement texts and theory.

each category has a ID Number (field name= cid) and a author name (field name= title)
Both rows are in the table "pages_categories"

On my article viewing page, i have a code with a connexion to my DB and a query to show the text in the article. So let's say my text is $text

Here's what i want to do:

add a code that will look in $text for any others author's name (title) and replace it with a link to the corresponding category (modules.php?name=Bibliotheque&pa=view_author&cid=CID_NUMBER_CORRESPONDING_WITH_TITLE_FROM_DB_HERE)
To find the CID we can just check all entried in "CID" and check for the one matching with "title"


BUT!!!!!

The author's name is in the format "SMITH, John". So the code must remove the character "  ,  " and look for ALL words found in the field "title" in ANY orders

exemple: If "SMITH, John Abraham" is found in "title" then look for "John Abraham Smith" and "Abraham John Smith" and "Smith Abraham John", etc.....

THANKS!!!!!!!!!!!!!!!!!!!!!!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.