24-Aug-2015, 08:51 AM
Hi! I have a web page that is loaded with a query string containing an id or an slug like
... myPage.php?Id=345
or
... myPage.php?Slug=this-is-a-sample-slug
I'm trying to enable my page to display an article's comments by getting it's id or slug. The problem occurs when I edit the slug of an article; Comments are not displayed then (I think because the primary slug is registered as an identifier in commentics tables ). How can I solve this? Here is that part of the code in myPage.php :
and when setting $cmtx_parameters:... myPage.php?Id=345
or
... myPage.php?Slug=this-is-a-sample-slug
I'm trying to enable my page to display an article's comments by getting it's id or slug. The problem occurs when I edit the slug of an article; Comments are not displayed then (I think because the primary slug is registered as an identifier in commentics tables ). How can I solve this? Here is that part of the code in myPage.php :
PHP Code:
<?php
$TempId = $Slug = NULL;
// get given id or slug
if( isset($_GET['Slug']) )
{
$Slug = $_GET['Slug'];
}
else if( isset($_GET['Id']) )
{
$TempId = $_GET['Id'];
}
PHP Code:
<?php
if($Slug)
{
$cmtx_parameters = 'Slug';
}
else if($TempId)
{
$cmtx_parameters = 'Id';
}