![]() |
Need some help in PHP I am coding a wp plugin and when I am trying to use a library it is saying that some other plugin has declared that library and so I cannot redeclare that thing..:( So i was jus wondering what needs to be done to overcome this problem....I can manage to play with this plugins but was just wondering how to approach this problem if I am gonna sell this plugin...I cannot ask my clients to uninstall some other plugin to get my plugin working so...:) Any help would be really appreciated |
Re: Need some help in PHP I had this exact same problem when I started developing my auto-blogging plugin Roboblogger . Here's how I solved it: Code: if (!class_exists('Smarty')) //Template Engine |
Re: Need some help in PHP Quote:
Or you can rely on the class/functins already loaded and if it's a very common thing then that would be probibly best but if it's not it holds the risk that it's modified by the other developer and will not do what you expect it to do. I always have the names of my classes and functions started with the name of my plugin to make sure it won't clash with others and to overcome issues like these HtH Edwin |
Re: Need some help in PHP Renaming it could turn out to be a pain in the butt if there's a huge number of classes and/or functions. This is because the functions could use each other internally. If you rename it an it breaks, I would just use the class_exists() or function_exists() method. |
| All times are GMT -6. The time now is 12:44 PM. |