GiovanniSalmeri/yellow-comment

How to use this?

Closed this issue · 19 comments

I really do not understand this:


The plugin adds a comments section on blog pages.

To add comments on other pages create a [comments] shortcut. The following optional argument is available:

opening = overrides commentsOpening setting (see below); only the values 0 and -1 work unless the metadata of the page contain the published setting.

Can you do 1:1 clean and clear documentation how to use this plugin?

Sure, but we can improve the documentation only if we understand what the problems are. Can you give us a hint which part/words isn't understandable and why? Are you using Yellow the first time? What do you try to achieve and what have you already done. Also you can improve it by yourself, we are happy to accept your pull request.

"we can improve the documentation only if we understand what the problems are" - no. Just make it clear with an example. I tried nearly everything. [comments 0] shows the form, but I can not use it with a HTML template, because there is no way to add arguments to statements like "0" ?

Also it does not work then.

"opening = overrides commentsOpening setting (see below);" This is also not clear.

So 0.8.2 - developer or how the name is. The PLUGIN folder is now the EXTENSION folder?
When I put it there it simple gets trashed.

no. Just make it clear with an example.

There's an example in the documentation already. So without a problem to solve we can't improve the documentation or at least the example.

I tried nearly everything. [comments 0] shows the form, but I can not use it with a HTML template, because there is no way to add arguments to statements like "0" ?

With getExtra you can't I think. Only when parsing for example from Markdown there are arguments. As an alternative you can set the commentsOpening value in the configuration file. But this will change the default value for all comments. If you need argument passing, file a feature request in the Yellow main project or change the code of the plugin that it parses the onParsePageExtra things dynamically.

So 0.8.2 - developer or how the name is. The PLUGIN folder is now the EXTENSION folder?
When I put it there it simple gets trashed.

I did not test the plugin against 0.8.2 yet. It's possible that it simply does not work since the Yellow-API was changed in the last release.

But I'll test it these days.

@GiovanniSalmeri are you already updating the API?

I will work on that this week-end, sorry for not being quicker. I hope to improve the documentation as well!

I will update the extension today. I tried also to clarify the documentation, I reworded it like this, I hope it will be easier to understand:

The extension adds automatically a comments section on blog pages.*

To add comments on other pages (that is, non blog pages) create a [comments] shortcut at the end of each page in which you want a comments section. In this case the following optional argument is available:

opening = number of days from publication after which comments are closed; this argument, if present, overrides commentsOpening setting (in other words: this value is used and commentsOpening is ignored). See below for details and for the meaning of the special values 0 and -1.

To add comments on every page of the site, add <?php echo $this->yellow->page->getExtra("comments") ?> in system/layouts/default.html, after the line <?php echo $this->yellow->page->getContent() ?>.

* Please remark that in the sample pages of the Blog extension comments are closed because of the publication date of the pages!


commentsOpening (default: 30) = number of days from publication after which comments are closed; if set to 0 comments are never closed, if set to -1 all comments are closed regardless of publication date (can be used as a maintenance mode while manually editing the comments file); only 0 and -1 are meaningful if the metadata of the page does not contain the published setting; this value can be overridden with an optional argument when using the shortcut [comments]

Thank you for the quick updates @GiovanniSalmeri.

@flagsoft does it work at your side?

@wunderfeyd It works but only if I enable auto posting in system.ini:

commentsAutoPublish = 1

Else with default (commentsAutoPublish = 0) it will not send any E-Mail for approval links, etc. but the comments will get added to the comments files I can see that on the FTP server. Then I can change "no" to "yes" manually and the comment will be displayed.

@GiovanniSalmeri
Thanks for the update!
commentsAutoPublish=1 works, 0 not, not getting any emails.... maybe because of service provider? How to debug?
It just outputs: Thanks for your feedback. But I do not get any emails. email is set correctly.

Issues:

  • After posting a new comment, it adds #form to the end of the url, reloading means you send the form again.
    Hint: Maybe this can be a solution? IF "#form" (maybe change it to formsent) is there in URL, do not send the form again. Maybe?

@flagsoft Thank you for the feedback!

As regards the first issue: could you check if the extension Contact works in your environment? The code for sending mail in Comments is very similar, so both should have the same problems. Anyway, we will know better where to search.

As regards the second issue: you're right, this is a problem. I will look into it as soon as possible and I will search for the simplest possible solution. But unfortunately the URL #fragment is interpreted by the browser and is never sent to the server...

No, it does not send any email.
Your comment could not be sent, please try again later.
In fact it get's mixed up with your comments plugin...

Question:
Is it possible to disable comments plugin or any plugin for a page? This would be interesting.
[comments disable]
or so.... or in general:
``[pulgin_name_XY disable]```

screen shot 2019-03-06 at 21 21 46

Thank you @flagsoft, I will look into it. As regards your question, I am afraid the internals of Yellow do not allow what you ask. Perhaps someone more expert could answer definitively.

@flagsoft

After posting a new comment, it adds #form to the end of the url, reloading means you send the form again.

Solved with commit c57dc13

I have used the PRG pattern. I have tried also a JS only solution, but it works only in Firefox and Chrome and derivatives (not in Safari. not in Edge, not in Epiphany/Web ecc.). I've left the JS code commented out, just in case.

@GiovanniSalmeri
Ok, seems to work now.
Minor Questions, you don't need to do anything:
a) JavaScript only: So you set a cookie? Why not using localStorage (JavaScript)?
b) Php, on server: Maybe this is anyway the better solution, do not depend on JS.

BTW: Is is possible to have a Extension disabled for one page?
For example, if someone do not want it on the HOME-Page and on the Contact page.
[comments DISABLED]
or so ?
(This is a more general questions, but... I'm new to this and I really like to see it fly.)

@flagsoft

So you set a cookie? Why not using localStorage (JavaScript)?

I need that value on server side, with JS localstorage (or sessionstorage) this would be impossible.

@flagsoft

BTW: Is is possible to have a Extension disabled for one page?

I cannot imagine a way to do it with a shortcut like [comments disabled], but for example it would be possible to add a setting like commntsExclude: not very beatiful, but easy to implement. I will think more about it.

@flagsoft
Added a setting Comments: no for disabling the Comments section in a specific page. Sorry for the not-so-quick answer!

@flagsoft Added a setting Comments: no for disabling the Comments section in a specific page. Sorry for the not-so-quick answer!

Hi @GiovanniSalmeri , Comments: no does not work, but Comments: No (uppercase N) did for me. Perhaps you can update the documentation at this point? Otherwise it's very confusing... Thanks for your great work!

@rgruen Thank you very much for the report! I have just done the opposite: I have changed the code, now "no" works (and "No" does not). This is in line with the other page settings in Yellow, which are all in lowercase.