A
A
Alexey Korolev2021-11-10 01:24:21
DLE
Alexey Korolev, 2021-11-10 01:24:21

How to sum rating of comments and articles in userinfo.tpl?

I want to display the total rating of posts and comments in DLE on the userinfo page.

Both comments and posts use the Only likes rating type.

Posts are displayed through {rate} and comments through {commentsrate}

I decided to display through js, but the code does not work. Why? How to correctly draw the total rating?

<p id="demo"></p>

<script>
var x = {rate} + {commentsrate};
document.getElementById("demo").innerHTML = x;
</script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TheAndrey7, 2021-11-10
@TheAndrey7

I decided to output via js, but the code does not work. Why? How to correctly draw the total rating?

See errors in the browser console F12. Most likely, in addition to the value, as is often the case, tags contain html - see the page code in the browser.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question