[TYPO3-dev] Getting id of the page

Tapio Markula tapio.markula at dnainternet.net
Fri Aug 25 11:22:59 CEST 2006


Martin Kutschker kirjoitti:
> Tapio Markula schrieb:
>> Hi
>>
>> I would need for function 'docStyle()' for class.ux_template.php
>>
>> the id of the page, which has been opened.
>> I tried to get it from $_GET parameter
>>
>>
>>         if(isset($_GET['id']))
>>             $id = $_GET['id'];
>>         else    {
> 
> if (preg_match('/(?:^|&)id=([0-9]+)/',$_GET['returnUrl'],$match)) {
>   $id = $match[1];
> }
doesn't work (I tried also '$id = $match[0];' and after each test  using
'print $id;' )

anyway

$id = strrchr($_GET['returnUrl'],'id=');
$id = substr($id,3);
if(strpos($id,'&table')) {
	$idPos = strpos($id,'&table');
	$id = substr($id,0,$idPos);
	}
works in BE.

Doesn't work in FE editing because only editing the page properties, 
there is direct information of the uid of the page in the $_GET parameter

Array
(
     [edit] => Array
         (
             [pages] => Array
                 (
                     [696] => edit
                 )
...


Of cource the information can get indirectly.
Array
(
     [edit] => Array
         (
             [tt_content] => Array
                 (
                     [249] => edit
                 )

         )
)

That means step by step digging information (what is the value of edit 
and then what is value of table and then to which page the content 
belongs to)- might be too complicated

Endeed I'm not convinced the idea to add page tree level CSS to the 
backend (that was a proposal).

>> Would there be some build-in class method to get the id of the page?
> 
> Not that I am aware of.
> 
> Masi
ok




More information about the TYPO3-dev mailing list