some code help plz

soaringeagle
@soaringeagle
11 years ago
3,304 posts
1st off ill mention that im in the beta ning to jr group as well as the beta site builder for the ningja skin

but heres the couple things im attempting to accomplish but having some trouble

1 ningja uses a single profile as the main forums since ning wasn't as profile centric, so on my front page i want a forum post list, of the most recently active posts, all from profile id 13331 wich is where the main site forums are, but additionaly, if possible i want a title (and profile pic) like you get with the standard listing, but also below it a short excerpt from the post... say anwhere from 250-1000 charachters (and maybe with a read more link after)

2 additionally i want a "shops page" that has a featured shops list at the top, kinda like an ad, if possible id want aslider simular to the elastic skins front page member slider but that includes a randomized list of featured shops , with thier names like elastic has...and optionaly if possible a short shop description.. so far i have set up a random list of 5 featured shops but would be nice if it refressed every x number of sec, or was a slider type thing.

3 on the shops page (i have no access to data store data since my sites not live and is on a temporary test domain so cant do test sales, to gather the data store ids) but what i want...if its possible is a list of most recently added items(of all types from all shops), most recently purchased items (if possible) most recently viewed (if possible) highest rated and a purely random list of items for sale just to provide multiple avenues of exposure to all shops items.

1 other note for the forums list ive tried multiple ways of ordering by latest activity only to have very random results and even have stuff from 5 years ago come up 1st...and oddly enough..last both ends of the list were items not updated in 5 years
(i do have a suspicion it might be due to the fact its just freshly imported data but not updated since import, but im not sure)


--
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/24/15 08:36:56PM
brian
@brian
11 years ago
10,149 posts
I'm just heading out here so can't answer this right now, but it really helps to have 1 post for each question instead of 4 questions in 1 post - trying to answer them all here with the back and forth that usually comes with it means this thread will be way too long for any one else to follow.

If you can make sure that you always do 1 question = 1 post, then really helps us keep things organized here. Not so much for us, but for anyone else coming along over the next months to years that is going to have the same question.

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
soaringeagle
@soaringeagle
11 years ago
3,304 posts
undersood but just thought since they were all related questions
but perhaps the title coulda been better


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
michael
@michael
11 years ago
7,805 posts
soaringeagle:
1 ningja uses a single profile as the main forums since ning wasn't as profile centric, so on my front page i want a forum post list, of the most recently active posts, all from profile id 13331 wich is where the main site forums are, but additionaly, if possible i want a title (and profile pic) like you get with the standard listing, but also below it a short excerpt from the post... say anwhere from 250-1000 charachters (and maybe with a read more link after)

The profile pic is inside:
/skins/(your skin)/profile_header.tpl

You can put a {debug} into that template to see what you have to work with.



truncate is the name of the function to use to cut a long post off after 1000 characters.

You can see examples of it in the smarty documentation:

"Truncate | Smarty"
http://www.smarty.net/docsv2/en/language.modifier.truncate
soaringeagle
@soaringeagle
11 years ago
3,304 posts
i figured it was something like that
but i guess what i dont understandishow to get the title then the content truncated below it ive managed to do 1 or the other i guess it would be like a foreach
title
and content
using the 2 codes together


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
soaringeagle
@soaringeagle
11 years ago
3,304 posts
wait can you use 2 templates in 1 statement? like im nit sure what the syntax would be but if i wanted jrForum_item_index and jrForum_item_detail


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
michael
@michael
11 years ago
7,805 posts
soaringeagle:...what I don't understand is how to get the title then the content truncated below.....

The title will be on one variable while the content is on another. To find out what variables there are, use {debug}.

Once you know that there are {$item.xxxxxx_title} and {$item.xxxxxx_body} then you can use truncate.

You use it like this:
{$item.xxxxxx_title|truncate:60}
{$item.xxxxxx_body|truncate:1000}
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ok so if im understanding corectly the code would look something like
{jrCore_list module="jrForums" $item.forum_title $item.forum_body|truncate:1000 order_by="forum_updated" search1="forum_profile_id 13331"}
but i think the variables need to be inside ()'s?
if thats even close to right im impressed with how much ive learned in only a couple weeks (the variables are guesses havent done debug yet) im just trying to wrap my head around the systax of the list
i guess it cant hurt to add a trunncate on title too but have a feeling it would rarely be needed

well on imported blogs it might cause ning if u didnt specify a title it used the 1st ..probably 500-1000 charachters of the body as the title...messy

but when i 1st joined ning it used the entire page content in the meta description so instead of the recomended 160 char limit some were 40,000 words
it took me a year of begging to get them to fix that


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
paul
@paul
11 years ago
4,335 posts
{jrCore_list module="jrForums" order_by="forum_updated" search1="_profile_id = 13331" template="my_forum_template.tpl"}

The forum_title and body parameters (with the truncate) need to go in the template (formatted by your html and css etc, as with other templates). Also note the '=' in the search parameter.


--
Paul Asher - JR Developer and System Import Specialist
soaringeagle
@soaringeagle
11 years ago
3,304 posts
right srry was writing it late at night and yes that makes sense thnx


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
soaringeagle
@soaringeagle
11 years ago
3,304 posts
ok assumming your list codes correct (changing the template name to my_forum_list.tpl) and this is the code in my template

<div class="forumlist"><a href="{$jamroom_url}/{forum_profile_url}/{forum_title_url}">{forum_title}</a></div><br><div class="myforumlistinfosection">last updated {forum_updated} by <a href="{$jamroom_url}/{forum_updated_profile_url}">{forum_updated_user_name}</a></div>
<br><div class="myforumlistpostcontent">{forum_text|truncate:1000}</div>
but i also tried
<div class="forumlist"><a href="{$jamroom_url}/{$forum_profile_url}/{$forum_title_url}">{$forum_title}</a></div><br><div class="myforumlistinfosection">last updated {$forum_updated} by <a href="{$jamroom_url}/{$forum_updated_profile_url}">{$forum_updated_user_name}</a></div>
<br><div class="myforumlistpostcontent">{$forum_text|truncate:1000}</div>

id also tried
<a href="{$jamroom_url}{$_post_uri}">{$_post_3}</a>
just as a rest

in the widget i have
<div class="forumlistindexpage">{jrCore_list module="jrForums" order_by="forum_updated" search1="_profile_id = 13331" template="my_forum_list.tpl"}</div>


ok wait 1 step closer but not there yet my mistake was assumming you didnt make typos too lol

its jrForum not forums
and needed the desc in order by
but
im not there yet either version of the above code only prints last updated by


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
michael
@michael
11 years ago
7,805 posts
These are the steps to follow when adding a new listing call.

{jrCore_list module="jrForum"}

Try it and see what comes out. If you get output but too much info, continue on to the next step: add search="" ....
{jrCore_list module="jrForums" order_by="forum_updated" search1="_profile_id = 13331"}

Ok, I have all the info I want coming out with that call, but not structured in a way that I like it, so add in my template.
{jrCore_list module="jrForums" order_by="forum_updated" search1="_profile_id = 13331" template="my_forum_template.tpl"}
AND copy /modules/jrForum/templates/item_list.tpl to /skins/YOUR-SKIN/my_forum_template.tpl

Then in
/skins/YOUR-SKIN/my_forum_template.tpl

Add in {debug}

"{debug}"
https://www.jamroom.net/the-jamroom-network/documentation/development/1477/debug

That will tell you want you have available.

You can then start customizing it from there.

Do it in steps rather than trying to jump all the way to the last step then trying to figure out whats wrong.
updated by @michael: 12/17/14 07:57:02PM
michael
@michael
11 years ago
7,805 posts
What is it your after? "How do I get a list of the latest forum posts?"
soaringeagle
@soaringeagle
11 years ago
3,304 posts
i got that far the last part im trying to get is to bring in the part of the modules item_detail templsate that starts at the forum_text class

in otherwords the text of the post then truncate that
also want to modify the item list to have posted by linked to profile last updated date/time by profile linked in category linked
then the excerpt below it

simular to www.dreadlockssite.com/main forum display

im close once i figured outto cipy that iitem_list in its just i cant make heads or tails out of what part of the item_detail i need to use for just the text block and i assume it has to go before the closing for

but i got a freind looking at it for me and she should be able to get it


--
soaringeagle
head dreadhead at dreadlocks site
glider pilot student and member/volunteer coordinator with freedoms wings international soaring for people with disabilities
soaringeagle
@soaringeagle
11 years ago
3,304 posts
michael:
What is it your after? "How do I get a list of the latest forum posts?"

thats windows magnifyer lol i use a 47 in plasma tv as a monitor b=ut across the room some text is still lil small so use that sometimes


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

Tags