Is there any method in Contao, to display or obtain the ID of the current page?
(Not the IDs of the elements on a page, but the ID of the page itself).
Thank you!
Is there any method in Contao, to display or obtain the ID of the current page?
(Not the IDs of the elements on a page, but the ID of the page itself).
Thank you!
I guess it is
[code=php:1ogcq3te]<span class="syntaxdefault">
</span><span class="syntaxkeyword">global*</span><span class="syntaxdefault">$objPage</span><span class="syntaxkeyword">;
</span><span class="syntaxdefault">$objPage</span><span class="syntaxkeyword">-></span><span class="syntaxdefault">id</span><span class="syntaxkeyword">;
*</span><span class="syntaxdefault"></span>[/code:1ogcq3te]
Thanks very much, that worked nicely.
Is there something similar to get the current url too ?
I tried $objPage->url; but that doesn't seem to exist
Hi partisanentity,
The current URL you get via the Insert Tags :{{env:ath}}{{env::request}}Originally Posted by partisanentity
http://www.contao.org/insert-tags.html
Contao Community Moderator
→ Support options
take a look at the Environment objectOriginally Posted by partisanentity
Please note that you can't call method directly because they are "protected", however the Environment class allows you to call its methods as property.
Code:// inside a class that extends Controller // the import should not be needed // $this->import('Enviroment'); // this will call the url() method of the Environment class, see the url above echo $this->Environment->url;
Consulenza Contao CMS https://www.intco.it
Bookmarks