custom front page forum display

soaringeagle
@soaringeagle
11 years ago
3,304 posts
this tip took me 2 days to figure out, paul and micheal gave me some clues but for the most part i had to figure it out for myself

im using the beta site designer for ning skin so some of this will be easier once thats added
however, you can also edit the index template instead


now that i finaly got the front page the way i want it i wont be switching back to the ningja skin and will continue to work in site designer from here on
(although i do experience wonky behavior still but i think alot of that will clear up when i finish my upload and can reboot)

ok for this tip what i did was take the item_list.tpl file found in the jrforum module and modified and extended it


as the file was written it listed the title of the post (link to post)
when it was created and by who

i took it a few steps further

1st, in sitebuilder, or in your template you need to create the list

<div class="forumlistindexpage">{jrCore_list module="jrForum" order_by="forum_updated desc" search="forum_profile_id = 13331" pagebreak="5" pager="true" template="my_forum_list.tpl"}</div>

i wrapped it in a div for easy styling tweaks
this code lists the forum topics ..only in the main forum profile (the search) orders it by last updated lists 5 per page with a pager (you can see the entire history from most recently updated to the last updated years ago) and you see im using a custom template my_forum_list
so 1st step is to copy the forum item_list template into your new template (wich goes in your skin folder)

now what i wanted was the created date by user (link to profile ) updated on date by user linked to profile in category linked to category
then an excerpt of the text
and followed by a read more linked to the post

the template code is
{jrCore_module_url module="jrForum" assign="murl"}
<div class="item mCustomScrollbar">
    {foreach from=$_items item="item"}
    <div style="overflow:hidden;margin-bottom:12px">
        <div style="float:left;padding-right:12px;">
            {jrCore_module_function function="jrImage_display" module="jrUser" type="user_image" item_id=$item._user_id size="xsmall" alt=$item.user_name class="action_item_user_img iloutline"}
        </div>
        <div>
            {if $item.forum_pinned == 'on'}
                <h2><a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}/{$item.forum_title_url}">{$item.forum_title}</a></h2>
            {else}
                <h2><a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}/{$item.forum_title_url}">{$item.forum_title}</a></h2>
            {/if}
            <br><span class="normal"><small>{$item._created|jrCore_format_time}, by <a href="{$jamroom_url}/{$item.profile_url}">{$item.user_name}</a> last updated at {$item.forum_updated|jrCore_format_time}, by <a href="{$jamroom_url}/{$item.forum_updated_profile_url}">{$item.forum_updated_user_name}</a> in category <a href="{$jamroom_url}/{$item.profile_url}/{$murl}{$item.forum_cat_url}">{$item.forum_cat}</a> </small></span><br><div class="forummainpagelisttext">{$item.forum_text|truncate:700}<br><div class="forumreadmore"> <a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}/{$item.forum_title_url}">read more</a> Replies {$item.forum_post_count}</div> </div>
        </div>
    </div>
    {/foreach}
</div>

luckily most of the building blocks were already there in the item_list

next step was to add
{debug}
to my new template that only had the item_list code and get an output of all the things you can work with in that template
all the things you needed were in the $item section so searching $item will give you every possible variable to work with
like forum_text forum_cat forum_cat_url forum_updated_profile etc

then all you had to do was put the peices together
and remember that when you want the data associated with that particular item
like the forum text associated with the same item as the title or the profile that created or updated it you have to prefix it with $item

the results www.greentechnologyforums.com (if you read this after i go live wich at this rate now that i'm figuring out code faster might be soon if ive gone live already and that links not working www.dreadlockssite.com )

the only thing i had to do after was add a lil formatting css


oh i just added areply count too
and the only thing i have not figured out yet is how to get the pager to be just like the 1 on the blogs

i think i need to include it in the template but not sure how

oh ps i had to make a custom template for the blogs as well so i could order by newest

and i added a random blogs list in place of the blog archives that way the page is always updated every load wich search engines will love




--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities

updated by @soaringeagle: 01/31/15 11:06:06PM

Tags