solved Latest Comment on the home page

pch
@pch
9 years ago
328 posts
Hello,

I am trying to add the Latest Comment block to the home page (of the Elastic skin under the Newest Images Block) similar to the one of ProJam

I have used the following code:

{jrCore_list module="jrComment" order_by="_item_id desc" limit="12" template="item_list.tpl"}

but is not exactly what I was looking for.

Then I copied the code found in the side_comments.php of Projam to :

                {* Newest Comments Block *}
                {if jrCore_module_is_active('jrComment')}
                    <div style="margin-top:7px;">
                        <div class="title">
                            <h2>{jrCore_lang skin=$_conf.jrCore_active_skin id="48" default="Latest Comments"}</h2>
                            {jrCore_module_url module="jrComment" assign="comment_murl"}
                            <div class="title-more"><a href="{$jamroom_url}/{$comment_murl}">{jrCore_lang skin=$_conf.jrCore_active_skin id="22" default="all"}</a></div>
                        </div>
                        <div class="block_content">
                            <div class="item">

{if isset($_items)}
<div class="body_3 mb20">
    <div style="height:450px;overflow:auto;">
        {foreach from=$_items item="item"}
            <div class="block">
                <div style="display:table">
                    <div style="display:table-row;">
                        <div style="display:table-cell;width:1%;text-align:center;vertical-align:top;">
                            <a href="{$jamroom_url}/{$item.profile_url}">{jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="xxsmall" crop="auto" alt=$item.user_name class="action_item_user_img iloutline"}</a>
                        </div>
                        <div style="display:table-cell;text-align:left;vertical-align:top;padding-left:5px;">
                            <div class="normal">
                                <a href="{$item.comment_url}">Re:&nbsp;{$item.comment_item_title|truncate:20:"...":false}</a><br>
                                {$item._created|jrCore_date_format}<br>
                                <span class="highlight-txt"><i>{jrCore_lang skin=$_conf.jrCore_active_skin id="112" default="By"}:</i></span>&nbsp;<a href="{$jamroom_url}/{$item.profile_url}"><span class="capital">{$item.profile_name|truncate:20:"...":false}</span></a><br>
                                <br>
                                {$item.comment_text|truncate:200:"...":false|jrCore_strip_html}
                            </div>
                        </div>
                    </div>
                </div>
                <hr>
            </div>
        {/foreach}
    </div>
</div>
{/if}

</div>
                        </div>
                    </div>
                {/if}

but it doesn't work. Can someone help telling me what is wrong with this code?

Thanks in advance.
updated by @pch: 11/04/16 06:40:45AM
michael
@michael
9 years ago
7,816 posts
* What happens?
* What did you expect to happen?
douglas
@douglas
9 years ago
2,806 posts
Latest Comments for the Elastic front page.

            {* LATEST COMMENTS *}
            {if jrCore_module_is_active('jrComment')}
                <div class="block">
                    <div class="title">
                        <h2>Latest Comments</h2>
                    </div>
                    <div class="block_content">
                        <div class="item">
                            {capture name="comments_template" assign="comments_row"}
                                {literal}
                                    {if isset($_items)}
                                    <div style="height:450px;overflow:auto;">
                                        {foreach from=$_items item="item"}
                                        <div style="display:table">
                                            <div style="display:table-row;">
                                                <div style="display:table-cell;width:1%;text-align:center;vertical-align:top;">
                                                    <a href="{$jamroom_url}/{$item.profile_url}">{jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="xxsmall" crop="auto" alt=$item.user_name class="action_item_user_img iloutline"}</a>
                                                </div>
                                                <div style="display:table-cell;text-align:left;vertical-align:top;padding-left:5px;">
                                                    <div class="normal">
                                                        <a href="{$item.comment_url}">Re:&nbsp;{$item.comment_item_title|truncate:20:"...":false}</a><br>
                                                        {$item._created|jrCore_date_format}<br>
                                                        <span class="highlight-txt"><i>By:</i></span>&nbsp;<a href="{$jamroom_url}/{$item.profile_url}"><span class="capital">{$item.profile_name|truncate:20:"...":false}</span></a><br>
                                                        <br>
                                                        {$item.comment_text|truncate:200:"...":false|jrCore_strip_html}
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <hr>
                                        {/foreach}
                                    </div>
                                    {/if}
                                {/literal}
                            {/capture}
                            {jrCore_list module="jrComment" order_by="_created NUMERICAL_DESC" limit="10" template=$comments_row}
                        </div>
                    </div>
                </div>
            {/if}

Hope this helps!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
pch
@pch
9 years ago
328 posts
Hey Douglas,

No word, just brilliant and brilliant and again brilliant!!!!!!!!!! It works and it is exactly what I was looking for. You are the Best. What a great support!

Thanks a lot for helping.
pch
@pch
9 years ago
328 posts
michael:
Docs related to the code @douglas posted:
Docs: "HowTo: use {capture} to avoid using another file for {jrCore_list} calls"https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/1637/howto-use-capture-to-avoid-using-another-file-for-jrcore-list-calls
Docs: "{jrCore_list}"https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/89/jrcore-list
Docs: "Template Blocks"https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/3126/template-blocks
Docs: "Template $variable modifiers"https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/1535/template-variable-modifiers

Thanks.
pch
@pch
9 years ago
328 posts
Hi Douglas,

Once again thanks a lot for your great assistance. The Latest Comments block on the home page works (displays) fine for logged-in user only. If your are not logged-in, instead of displaying well, the following error is displayed:

CRI: Query Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY a.`_item_id` ASC LIMIT 1000' at line 3

Any idea? Thanks
douglas
@douglas
9 years ago
2,806 posts
Can you post a link to the page?

Thanks!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
pch
@pch
9 years ago
328 posts
Thanks for your reply Douglas. My site is going under reconstruction. I haven't started publishing it yet. I can PM the link to you. How to send private massage in this forum?

Thanks.

By the way I am running PHP 7.
douglas
@douglas
9 years ago
2,806 posts
Send us your site URL and admin login so we can check it out. Send it to support[at]jamroom[dot]net

I'm running php 7 on my dev server and I'm not seeing any issues.

Thanks!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
pch
@pch
9 years ago
328 posts
Great Douglas. I am sending it to you.

Thanks a lot for the support.
douglas
@douglas
9 years ago
2,806 posts
This is fixed on your site, had to turn on the "only active modules" in your Comments Global Config section. When the next update comes out, you can turn that feature off you want.


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
pch
@pch
9 years ago
328 posts
Hi Douglas,

When I say you are The Best, I know what I mean. Great support. Thanks for fix it for us.

So it was a bug, right? If so, hope it will be completely fixed in the next comment module release.

Thanks a lot for the support.

Tags