# How to get current page ID?

**URL:** <https://www.ruby-forum.com/t/how-to-get-current-page-id/110305>\
**Category:** Radiant CMS\
**Created:** [July 25, 2007, 2:31am UTC](https://www.ruby-forum.com/t/how-to-get-current-page-id/110305 "2007-07-25T02:31:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![denoxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@denoxis](https://www.ruby-forum.com/u/denoxis)\
**Post date:** [July 25, 2007, 2:31am UTC](https://www.ruby-forum.com/t/how-to-get-current-page-id/110305/1 "2007-07-25T02:31:29Z")

</div>

Hi,

I need to put the current page ID somewhere in my radiant layout. There  
is no such documented tag. Is there any trick to do that other than  
defining a new tag?

I appreciate your help.

Deniz

---

<div class="post-metadata">

**Author:** ![denoxis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@denoxis](https://www.ruby-forum.com/u/denoxis)\
**Post date:** [July 26, 2007, 12:46am UTC](https://www.ruby-forum.com/t/how-to-get-current-page-id/110305/2 "2007-07-26T00:46:09Z")

</div>

I suppose that you refer to the ID of the page in the database. In this  
case, AFAIK there is no direct way.

For this case and many more i think that it would be great to have  
something like a \<r:erb\> or \<r:ruby\> standard tag that allows arbitrary  
Ruby  
code to be executed in a to be defined runtime context. In your case  
this  
would allow to do something like:

\<r:ruby\>  
tag.locals.page.id.to\_s  
\</r:ruby\>

```
The idea, as you comment, is to avoid defining a new tag

```

(correspondingly a new extension) for some “simple but non radiant  
standard  
behavior”.

```
Definitively, such a tag would be great.

/AITOR
```
