Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To Include Page ID Number Into a PHP Command
#1
I use a custom comment script written in PHP. The script works by manually adding a number ID number into the code on each page I use the code. I decided to use the code below the content in the template.php file. However, I need to add a unique and never changing ID number dynamically. The best way I can think to do this would be to use the Page ID number, assuming that exists. Can someone show me how to do that. Here's the code:

Code:
<?
require('comments/inc_comment.php');
getComments("**PAGE ID NUMBER GOES HERE**");
submitComments("**PAGE ID NUMBER GOES HERE**", $_SERVER['PHP_SELF']);
?>
Reply
#2
garry Wrote:I use a custom comment script written in PHP. The script works by manually adding a number ID number into the code on each page I use the code. I decided to use the code below the content in the template.php file. However, I need to add a unique and never changing ID number dynamically. The best way I can think to do this would be to use the Page ID number, assuming that exists. Can someone show me how to do that. Here's the code:

Code:
<?
require('comments/inc_comment.php');
getComments("**PAGE ID NUMBER GOES HERE**");
submitComments("**PAGE ID NUMBER GOES HERE**", $_SERVER['PHP_SELF']);
?>

The only ID available is the page slug: return_page_slug()
(Unless you change it when editing the page, it is constant)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#3
That's perfect! Thank you. In order for this to work, I will need to convert return_page_slug() into a string of numbers, perhaps binary code? From there, how do I add those values into the code?

My guess is that it would look something like this:

Code:
<?
require('comments/inc_comment.php');

convert return_page_slug() into binary_code_results;

binary_code_results = $commentID;

getComments("$commentID");
submitComments("$commentID", $_SERVER['PHP_SELF']);
?>
Reply




Users browsing this thread: 1 Guest(s)