Author Topic: Obtaining the page ID  (Read 719 times)

Offline svsanchez

  • Posts: 466
Obtaining the page ID
« on: June 16, 2017, 12:06:53 AM »
Hello, I hope I can explain clearly what I need:

I was invited by a company called Spot.im to use their comments widget on my site instead of Disqus. The widget needs to identify each different page via a variable, so I thought I would use the Page ID from WebsiteBaker (the one we can see on the backend). However, I didn't find any information on how to call it.

For example:

For the page title I use PAGE_TITLE
For the page description I use PAGE_DESCRIPTION

I tried using PAGE_ID for the page ID but it didn't work :(

Offline Ruud

  • Posts: 3647
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Obtaining the page ID
« Reply #1 on: June 16, 2017, 09:58:38 AM »
If you do this in your template index.php it will always work like this.
Code: [Select]
<?php echo PAGE_ID?>
<?php echo PAGE_TITLE?>
<?php echo PAGE_DESCRIPTION?>
So you should do something like:
Code: [Select]
....
data-spot-id="<?php echo PAGE_ID?>"
....

Note: these details are for the WB pages. News/Bakery/OneforAll pages are all on the same page_id and will have the same title and description.

 

postern-length