how can replace some of words when I added post from
my friends ..
I want to design a small plugin ..
it is work is: when the user write a post for example :
<< WordPress >> widgets are the dynamic objects which eases the customization of the content on << sidebars >> and widgetized << footers >>. << Widgets >> allows drag-n-drop interface in the Dashboard << admin panel >>, for easy << management >>.
directly the plugins search about the words which between <<..>> then search in the db for wordpress if there a title like this word. if it exist replace it by the url of page .. if it not exist create a new page with some 'text .. ect' then replace the word by the url of page.
for e开发者_开发问答xample : when I wrote these: << wordpress >> widgets are the dynamic << objects >> . the plugins search about 'wordpress' in the title pages if it existe set the url: wordpress. then the plugins search about ' objects' in the title pages if it not exist the first step: create a page: object then fill it some text the final step . replace the word << objects >> , by the url of the post of object ,
I want to know how to do it. Give me example I will try to develompe it .
Thank you very much ..
You could use preg_replace to find the "<>" pattern and replace it.
WordPress provides a Class: wpdb to interact with the database.
You could query the db for the title, create a link to the page, and replace the text pattern with the link.
I don't know about creating a page dinamically with a plugin though...
精彩评论