[TYPO3-dev] Getting id of the page
Tapio Markula
tapio.markula at dnainternet.net
Mon Aug 28 10:11:28 CEST 2006
Dmitry Dulepov kirjoitti:
> Hi!
>
> JoH wrote:
>> No - overriding an array with the output of a function.
>> So you don't have to call t3lib_div::_GET() for each and every parameter
>> when you need it, but simply use $_GET['parametername'] with the small
>> difference that the value has been "parsed" by the t3lib function before.
>>
>> Saves you some milliseconds of performance when you have got lots of
>> different parameters.
>
> This way you violate TYPO3 coding guidelines. This practice is NOT
> encouraged by TYPO3 and if extension does this, it have no chance to
> pass code review and appear in green in EM.
>
What's wrong with this method.
Why I should for every instance of needing $_GET parameter use
directly t3lib_div::_GET() instead referring to it once
before each series of needed information from $_GET parameter
$_GET=t3lib_div::_GET();
if(isset($_GET['id'])) // BE: current page in several modules; FE:
always 'Web > List' + 'Page Properties', 'New page' and 'New content
element', if pop-up windows has not been used
$id = $_GET['id'];
elseif(isset($_GET['edit']['pages'])) // FE: 'Page properties' if
pop-up windows has been used
$id = key($_GET['edit']['pages']);
that is easier to read than
if(isset(t3lib_div::_GET('id'))
...
More information about the TYPO3-dev
mailing list