Use short variable system
by
11 Mar 2008
There is a more detailed article of what happens here.Welcome! With 3.7.x there is now the ability to use short variables when passing through files. This allows you not to have an "ugly" name in the URL and allows everything to be easier read and created. Which means you don't have to memorize 100 possible larger variables to memory when using forms and redirect. Since I haven't coded a thing for vB since 3.0.0, I figure I show this to those who are trying to make their programs be more effective, as I am basically re-learning as I go. This article shows you how the system works! The Script PHP Code:
<?php
Summary Basically using the built in features in class_core.php inside your includes directory which gets initialized through your global.php file, has a "regiester" area where it takes my input of "t" from the URL (test.php?t=1) and makes $testid (which I would use through out the script) to get the input. Now the most important thing is specifying what type of value it will be. In this case, "t" will always be an integer (TYPE_INT). If I were to do (test.php?t=This is a test) it would not output at all. This is a nice security feature built into vB and doesn't allow people to directly "test" the system to find vulnerabilities in your vB installation and your product (add-on). However, if I specified TYPE_STR then it would work both ways because a number can be a string. Usually you would place this in a file that is always read by your product. Mine is in my "catch" all file loading after global.php is included. This makes it so all your pages uses the same data and you don't have to re-type this code anywhere else. I hope this helps you! Enjoy! |