- Postagens: 11
- Obrigados Recebidos: 0
- Fórum
- /
- Suporte Joomla
- /
- Componentes
- /
- Joomla 1.5
- /
- Jcomments - Inserir numero de comentários na frontpage
Jcomments - Inserir numero de comentários na frontpage
- meop
-
Autor do Tópico
- Offline
- JCB! Estagiário
-
Menos
Mais
15 anos 8 meses atrás #24498
por meop
meop created the topic: Jcomments - Inserir numero de comentários na frontpage
Olá,
Desejo colocar a quantidade de comentários em algumas áreas da frontpage. Estou aprendendo a pouco tempo então não tenho muito conhecimento. Em uma pesquisa acho que encontrei no proprio suporte do Jcomments mas não consigo fazer funcionar.
Segue:
How to display the comments quantity
If you would like to display somewhere the quantity of comments for any object (for example, to display the quantity on an object's intro page), you must include the main JComments file and call static method JComments::getCommentsCount through the function include/require. This method uses two parameters: object's ID and component name.
$comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
if (file_exists($comments)) {
require_once($comments);
$count = JComments::getCommentsCount($id, 'com_mycomp');
echo $count ? ('Comments('. $count . ')') : 'Add comment';
}
where $id — is the commented object ID and com_mycomp — component name. This code displays the 'Comments (5)' if you have 5 comments of given object and 'Add comments' if there are no comments.
Ele terá que funcionar numa 3rd Party chamada GK_news GK1.
Onde eu coloco esse código? Na helper do modulo? E Essa id? quando eu insiro a id tenho um erro na tela. Estou inserindo errado?
Obs: quando eu acho q configurei tudo certo, nada acontece
Desejo colocar a quantidade de comentários em algumas áreas da frontpage. Estou aprendendo a pouco tempo então não tenho muito conhecimento. Em uma pesquisa acho que encontrei no proprio suporte do Jcomments mas não consigo fazer funcionar.
Segue:
How to display the comments quantity
If you would like to display somewhere the quantity of comments for any object (for example, to display the quantity on an object's intro page), you must include the main JComments file and call static method JComments::getCommentsCount through the function include/require. This method uses two parameters: object's ID and component name.
$comments = $mosConfig_absolute_path . '/components/com_jcomments/jcomments.php';
if (file_exists($comments)) {
require_once($comments);
$count = JComments::getCommentsCount($id, 'com_mycomp');
echo $count ? ('Comments('. $count . ')') : 'Add comment';
}
where $id — is the commented object ID and com_mycomp — component name. This code displays the 'Comments (5)' if you have 5 comments of given object and 'Add comments' if there are no comments.
Ele terá que funcionar numa 3rd Party chamada GK_news GK1.
Onde eu coloco esse código? Na helper do modulo? E Essa id? quando eu insiro a id tenho um erro na tela. Estou inserindo errado?
Obs: quando eu acho q configurei tudo certo, nada acontece
Please Entrar ou Registrar to join the conversation.
- meop
-
Autor do Tópico
- Offline
- JCB! Estagiário
-
Menos
Mais
- Postagens: 11
- Obrigados Recebidos: 0
- brunodyjorge
-
- Offline
- JCB! Geek
-
15 anos 6 meses atrás #28496
por brunodyjorge
Que jeitinho? Posta aí pra galera.
brunodyjorge replied the topic: Re: Jcomments - Inserir numero de comentários na frontpage
meop escreveu: Não consegui solucionar mas dei um jeitinho que acabou servindo pro que eu queria.
Que jeitinho? Posta aí pra galera.
Please Entrar ou Registrar to join the conversation.
- meop
-
Autor do Tópico
- Offline
- JCB! Estagiário
-
Menos
Mais
- Postagens: 11
- Obrigados Recebidos: 0
- horatio
-
- Offline
- JCB! Colaborador
-
Menos
Mais
- Postagens: 35
- Obrigados Recebidos: 0