Learn to HELP YOURSELF
by
02 Sep 2004
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= LEARN to HELP YOURSELF =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= I decided to write this after observing the types of questions asked in the General Modification Discussion and PHP/MySQL/JS/HTML forums. If people would know a few simple things, i'm sure the number of questions would be reduced by at least 40-50%. First of all, they need to know that asking on a forum is NOT an efficient way of getting an aswer, and by no means a fast one. It could be days before a member will give you the right solution to your problem. Secondly, you waste BOTH YOUR TIME, and the TIME OF OTHER MEMBERS. With that in mind, the best way to find an answer is to search for it yourself... Golden Rule 1: Use Forum Search - i know this has been said over and over, but i just felt the need to repeat it Golden Rule 2: Use Google 1. EditPlus2 - It's a program. What special about it is the "Find in Files" feature. It will search for a string in multiple files. Use google to find it. I'll give an example of using this later. 2. When you need to find a certain template, keep in mind there's a vBulletin option which will add the names of templates in HTML comments in the HTML source of the page. Turn it on, refresh your vBulletin page, right click on the page > View Source, and then you can just read the name of your template. Also, don't forget there is a search in templates function within vBulletin. 3. If something is wrong in your code, DEBUG, and then post for help. Let's take an example for this. Let's say you have an if statement, which sets a variable to true/false, and based on this you want to allow a user access to a page or not - and it's just not working... PHP Code:
if($something == 'x')
4. If something isn't working, and you just can't figure out why, try using alternate methods of getting the same effect. 5. If you need help with a certain php function, don't ask on the forums. I recommend downloading the php manual in Windows Help Format (chm) from php.net. It's very useful as a function reference. If you don't want to download it - again, use google. 6 If you want to find a function that does something, use the manual. Let's say you want to find a function that converts a string to uppercase. You open the manual, click the Search tab, and search for uppercase. There'll be a few items on the list, but the 4th one is what you're looking for: strtoupper. 7. Similarly, if you need to know what a vBulletin function does, first thing to do is to look at it's name, which will in most cases give a pretty big hint on what the function is supposed to do. Look if there are any comments on that function in the code, and finally, try looking the code and figuring out what it's supposed to do. 8. If you want to find a vbulletin function, EditPlus is your friend. Use Find in Files, and you'll have your function. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= PRACTICAL EXAMPLE OF USING THE ABOVE TIPS =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= What we want As an example of using the above tips, i'll use this thread: How do I: Have Links From a Specific Domain Open in Same Window What we're trying to do is have links (in posts) from certain domains open in the same window. By default, vbulletin opens a new window for all links. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= How We do it First, let's open EditPlus, Search > Find In Files. We'll want to search in our forum folder, for files of type *.*, and the string we'll search for is [url since we know that is the bbcode tag used to generate html links. There's be some results, but you can quickly see which are the important ones. In includes/functions_bbcodeparse.php there'll be some regular expressions to match the [url tag, and some very useful comments ( // [URL] ). Now you know you've found what you were searching for. Go to that page. PHP Code:
// [URL]
Use the find in files function again, to see where that function is... Well, what do you know? It's also in the functions_bbcodeparse file. You won't need to examine the entire function to find what's essential, since it's easy to spot: PHP Code:
// standard URL hyperlink
PHP Code:
if(stristr($rightlink,"domain.com"))
So what if we want to do the above for more domains? Here's a demonstration of point 4, alternate methods of doing the same thing... PHP Code:
if(stristr($rightlink,"domain.com"))
PHP Code:
$domains = array(
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= That's it! It's a lot easier than it seems, believe me. Then again, i'm not that good at explaining things. I hope this helps some of you. Rake. |