11-Aug-2010, 01:47 PM
There have been a few questions as to arbitrary IDs. I decided to make an add-on for this very purpose. You can find a packaged version here: http://www.commentics.org/add-ons.php#arbitrary_id
PHP Code:
<?php
/************************************************** ARBITRARY ID **************************************************/
$current_page_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$current_page_url = sanitize($current_page_url,1,1,1);
$existing_pages = mysql_fetch_assoc(mysql_query("SELECT * FROM `".$mysql_table_prefix."pages` WHERE url = '$current_page_url'"));
$existing_custom_id = mysql_fetch_assoc(mysql_query("SELECT * FROM `".$mysql_table_prefix."pages` WHERE custom_id = '$current_page_url'"));
$arbitrary_id_reference = '';//Your value/variable here
if($existing_pages['url']==null && $existing_custom_id['custom_id']==null) {
mysql_query("INSERT INTO `".$mysql_table_prefix."pages` (reference, url, is_form_enabled, dated, custom_id) VALUES ('$arbitrary_id_reference', '$current_page_url', 1, NOW(), '$current_page_url')");
}
/******************************************************************************************************************/
All this does is check the database for any page which has a custom id or url of the current page, and adds a new page if there isn't one. The downside is that you'll need to either set the reference manually yourself later, or modify $arbitrary_id_reference to hold a variable value which will set the reference automatically, such as
PHP Code:
<?php
$arbitrary_id_reference = $_GET['page_title'];