Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment Slug #654

Closed
afoster1955 opened this issue Dec 9, 2023 · 21 comments
Closed

Comment Slug #654

afoster1955 opened this issue Dec 9, 2023 · 21 comments

Comments

@afoster1955
Copy link

I've been able to set up a comment form (not disqus or fb) that is working except that I can't figure out what the page-id is for the posted articles. I have it set up where the url looks like this https://www.myhtmlysite.com/post/name-of-article

Can anyone five me some ideas on how to find the page id so that each article will have its own comments? I am attaching a screenshot of the comment form that will be used.

Thanks.
commentform

@bttrx
Copy link
Contributor

bttrx commented Dec 9, 2023

Don't have a solution for you, but did you develop the comment form yourself?
Is source code available somewhere?

@afoster1955
Copy link
Author

No, I did not develop it on my own and the source code is located here.
https://github.com/CGrassin/interact_php
Let me know if you can figure it out.

@danpros
Copy link
Owner

danpros commented Dec 9, 2023

Currently htmly only use the post filename path as the ID, you can access it using $p->file so use it as the key. Please note the filename path will changed if we edit the slug, tag, category, and date. Solutions for this in popular posts:

        if ($oldfile != $newfile) {
            if (file_exists($viewsFile)) {
                $views = json_decode(file_get_contents($viewsFile), true);
                $arr = replace_key($views, $oldfile, $newfile);
                file_put_contents($viewsFile, json_encode($arr, JSON_UNESCAPED_UNICODE));                
            }
        } 

@afoster1955
Copy link
Author

Using $p->file is not working unless I misunderstand your response. Just to make sure, the comments code should be placed in the post.html.php file of each theme, correct? Since I am using the blog theme, I am entering the comments code in the post,html.php file of the blog theme.

As for the other code you provided, it is unfortunately over my head.

@danpros
Copy link
Owner

danpros commented Dec 10, 2023

From the project readme.

    \Interact_PHP\Interact_PHP("<some-id-such-as-article-title>"); 

@afoster1955
Copy link
Author

I have the code set up as follows:

\Interact_PHP\Interact_PHP("<$p->file>");

But that does not work. I am also trying to confirm that the code above should be placed in the post.html.php file.

@danpros
Copy link
Owner

danpros commented Dec 10, 2023

Yes it should placed in post.html.php. Try check the PHP error log to find the problems

@afoster1955
Copy link
Author

Thanks...there are no errors in the log but at least I know I have placed the code in the right place. I will keep trying to see if I can get it to work.

@afoster1955
Copy link
Author

After upgrading to version 2.8.7 of HTMLy and using $p->file as the file id, the comments system seems to be working. I will re-post if something happens where it is not working, but for the moment, all is well.

@danpros
Copy link
Owner

danpros commented Dec 12, 2023

It will be better using the $p->url with /post/ type slug because as long as the slug never changed it always has the same format.

@afoster1955
Copy link
Author

Well, I take it all back...it is now not working with $p->file nor /post/$p->url and the comments that were posted yesterday are no longer visible. I have run out of ideas on how to make a comment system to work with HTMLy if it is not Disqus or Facebook.

@afoster1955
Copy link
Author

afoster1955 commented Dec 14, 2023

I think I finally found the comment system that will work with HTMLy. It is called Hashover and I'm using version 1.02 of the application, but I just noticed that there is a version 2.0 (developer) version that I will try. It is easy to set up and worked right out of the box.

@bttrx
Copy link
Contributor

bttrx commented Dec 23, 2023

Currently htmly only use the post filename path as the ID, you can access it using $p->file so use it as the key. Please note the filename path will changed if we edit the slug, tag, category, and date. Solutions for this in popular posts:

        if ($oldfile != $newfile) {
            if (file_exists($viewsFile)) {
                $views = json_decode(file_get_contents($viewsFile), true);
                $arr = replace_key($views, $oldfile, $newfile);
                file_put_contents($viewsFile, json_encode($arr, JSON_UNESCAPED_UNICODE));                
            }
        } 

What to do with that information if already using the latest HTMLy version?

@afoster1955 Please fix your links to https://github.com/CGrassin/interact_php and https://www.barkdull.org/software/hashover. Clicking

@vdbhb59
Copy link
Contributor

vdbhb59 commented May 19, 2024

So, anything on this? I wish for HTMLy as commenting option in itself, and not via a 3rd party.

@afoster1955
Copy link
Author

Finally...I have been able to get a third party comment system to work with HTMLy. It is called Commentics and with the help of its developer, I have been able to get it to work on my HTMLy blog.

Once you have installed Commentics, post the following in the post.html.php file beginning on line 62 (in my file). Since I am using Commentics in two different blogs, this one is set up as an iFrame. You will have to see the Commentics documentation to see what I am talking about. Here is the code you need to enter.

<script src="https://fredswebspot.com/commentics/embed.js"></script>
            <script>
            var commentics_config = {
                'identifier': '<?php echo $p->url; ?>',
                'reference' : '<?php echo $p->title;?>'
            };
            </script>
            <div id="commentics"></div>

Good luck and let me know if you have any questions.

@danpros
Copy link
Owner

danpros commented May 29, 2024

@afoster1955 for PHP integration read #747

Already added it to the docs: Commentics PHP Integration

@afoster1955
Copy link
Author

Excellent

@danpros danpros closed this as completed May 29, 2024
@bttrx
Copy link
Contributor

bttrx commented Jun 1, 2024

@danpros

My 2 cents: Commentics requires a MySQL database, while HTMLy uses flat files. That doesn't fit for me.

HTMLy should include a flat-file based comment system. Even a simple one (e. g., no threading) would be better than nothing. From my point of view, comments are like blog posts, but from visitors.

My feature wish list:

  • Markdown formatting, because it's already included in HTMLy core
  • CAPTCHA support, e. g., math, graphical, or more simple: http://svardos.org/?p=forum&action=newthread#formularz
  • moderation, i.e., new comments will only be shown after admin approval
  • RSS comments feed to allow users to be notified about replies to their comment
  • (optional) email subscription

@bttrx
Copy link
Contributor

bttrx commented Jun 1, 2024

@afoster1955 for PHP integration read #747

Already added it to the docs: Commentics PHP Integration

How about hosting the docs at GitHub, so others could contribute to via PRs?
Or enabling the wiki component here and move existing content to?

@vdbhb59
Copy link
Contributor

vdbhb59 commented Jun 1, 2024

@bttrx exactly what I tried explaining earlier as well. Plus, I too wish to contribute to the wiki of the fav and only blog engine I use. :)

@danpros danpros reopened this Jun 1, 2024
@danpros
Copy link
Owner

danpros commented Jun 2, 2024

@bttrx OK noted. No ETA but I will look into it. At the moment we can look at third party solutions and integrate them into htmly.

Regarding the docs I already upload it to Github: https://github.com/danpros/htmly-docs

@danpros danpros closed this as completed Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants