This is the community forum. For a developer response use the Client Area.
Follow us on Facebook, Twitter and YouTube!

Wanna use slug for my articles and get their comments
#1

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 :

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'];
}
and when setting $cmtx_parameters:
PHP Code:
<?php 
if($Slug)
{
   $cmtx_parameters = 'Slug';
}
else if(
$TempId)  
{
   $cmtx_parameters = 'Id';
}
Reply
#2

Hi,

You can just go to 'Manage -> Pages', edit the page, and update the 'Identifier' field.

Have you completed the interview?
Reply
#3

I would have to update it through php code when slug is modified there. So do you mean just updating 'identifier' column of 'pages' table? What about 'url' column (of the same table)? Thanks in advance
Reply
#4

The way that I suggested was using the Commentics admin panel. If you want it to update automatically whenever you change the slug in your article software, then you would need to add some code in your article software which connects to the Commentics database and updates both the 'identifier' and the 'url' column in the 'pages' table whenever you change the slug.

Have you completed the interview?
Reply


Possibly Related Threads…
Thread / Author Replies Views Last Post
Last Post by Tim
06-Jan-2021, 08:56 PM
Last Post by Tim
18-Oct-2019, 11:45 AM
Last Post by Gevill
23-Jul-2019, 01:17 AM
Last Post by Steven
16-Feb-2018, 09:15 AM
Last Post by Steven
09-Jan-2015, 10:01 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)