Forum Activity for @ken-rich

Ken Rich
@ken-rich
12/06/14 05:53:24AM
926 posts

how do I choose a random quota_id from a set?


Using Jamroom

Hi Michael,

After looking at these a few times, your version actually makes sense to me a little. Like an algebra equation. The nomenclature is foreign to me, but I think I can understand the math.

Paul's version is a little more familiar looking with the if/then format I'm used to seeing in the templates. However, someone would have to step me through the math, because I am not "getting it" in that format.

In any case, am I correct in assuming these versions can be added right to the templates? So in the case of your code, would it look like this in practice for "Featured Artists? (index_artists.tpl).

{$options = ['7', '7','6']}
{$key = array_rand($options)}
{$wanted = $options[$key]}
{jrCore_list module="jrProfile" quota_id=$wanted}

{jrCore_list module="jrProfile" order_by="_profile_id random" limit="4" quota_id="$wanted" search1="profile_active = 1" template="index_artists_row.tpl"require_image="profile_image"}

Then for featured songs, I assume only the module specific information would change, so it would look like? (index_songs.tpl).

{$options = ['7', '7','6']}
{$key = array_rand($options)}
{$wanted = $options[$key]}
{jrCore_list module="jrAudio" quota_id=$wanted}

{jrCore_list module="jrAudio" order_by="audio_title random" quota_id="$wanted" limit="4" template="index_songs_row.tpl" require_image="audio_image"}

Do I have this straight now, or am I still lost?
updated by @ken-rich: 12/06/14 06:18:29AM
Ken Rich
@ken-rich
12/05/14 04:29:29AM
926 posts

how do I choose a random quota_id from a set?


Using Jamroom

Thanks Michael - rename this to anything you like.

I just went cross-eyed looking at your (and Paul's) solution (thanks also). I'll obviously have to study this stuff for awhile, before I understand it.

Why couldn't it be simple like quota_id="7,7,6" lol
updated by @ken-rich: 12/05/14 04:33:58AM
Ken Rich
@ken-rich
12/05/14 04:12:52AM
926 posts

Code Question 3


Using Jamroom

If you guys find it confusing, there's no hope for me. I'm a "Newfie" (Newfoundland - Canada).

All you have to do to confuse a Newfie, is put two shovels against a wall and tell him to take his pick...

Hmmm... I don't see a pickaxe...
Ken Rich
@ken-rich
12/04/14 08:28:16PM
926 posts

how do I choose a random quota_id from a set?


Using Jamroom

paul:
Caching - That's why its not changing. If you wait the cache time (300 seconds by default) it should change when refreshed.

If you really want these templates to refresh every time, try the following (though its not recommended on a busy site)

{jrCore_list module="jrProfile" order_by="profile_name random" no_cache=true . . .}

That this is cached on a 5 minute timer makes perfect sense to me, I figured there had to be some sort of timer on it.

Quote: {jrCore_list module="jrProfile" order_by="profile_name random" . . .}

I actually worked that part worked out for myself this morning, and tied my two paid artist levels to it. What I would like to figure out now, is how to "weight" one quota more than another.

I am currently using
Quote: quota_id="7,6"

However, I want random picks from quota 7 to occur twice as often as from quota 6. So how could I accomplish this? Would it be as simple as placing the preferred quota twice?
Quote: quota_id="7,7,6"

updated by @ken-rich: 12/04/14 08:32:29PM
Ken Rich
@ken-rich
12/04/14 07:33:05PM
926 posts

how do I choose a random quota_id from a set?


Using Jamroom

SteveX:
Please let me know how much of that you get - I'm trying to work out how to explain something similar to a bunch of librarians, so your feedback will be helpful to them, and to me.

OK - most of what you said I understood intuitively on some level, by watching it work and surmising, but not knowing the techno-speak for it, or the actual "mechanics" behind it.

The part that's really frying my brain is this:

Quote: The first param is an id - the target div into which the content will be loaded. ("#" denotes an id, "." would denote a class). You can find something like this in your html...

The reason it's frying my brain is I had thought ID and class were related to the CSS not Javascript (I tend to play with CSS experimentally). I thought they were pointing back to a set of CSS styling values that would control what that division looked like visually, and were not related to how it operated functionally.

So now I don't know if they are dual function (CSS and Javascript), since it seems I was completely mistaken in my previous (CSS only) assumption.

Are they more like names that serve as reference points to WHATEVER is coming into play (CSS, Javascript, PHP, smarty).

I need some type of simple definition and perhaps a colorful metaphor (smile) to describe the function of ID and class. Otherwise, I'm missing part of the jigsaw puzzle.
updated by @ken-rich: 12/04/14 07:50:16PM
Ken Rich
@ken-rich
12/04/14 06:38:16PM
926 posts

Code Question 3


Using Jamroom

brian:
Nothing in JR is loaded by Java (just an FYI) - Java != Javascript. Jamroom uses PHP and Javascript - no Java is involved... lol

Wow... That's news to me, I thought Java was short for Javascript... Shows how much I know...

JQuery seems like it might be useful, nice tip... I didn't know it was something to make Javascript easier...I thought it was a different language...
updated by @ken-rich: 12/05/14 04:13:43AM
Ken Rich
@ken-rich
12/04/14 04:55:49PM
926 posts

Code Question 3


Using Jamroom

douglas:
Instead of trying to explain how it all works, maybe you can let us know what your trying to do and we might be able to help with that a bit easier.

Well I'm not exactly trying to explain how it all works since I don't really know. I'm trying to relate my level of understanding thus far, check my hunches, and see if I can't get the same sort of thing working in Ningja.

douglas:The Ningja skins java file is already setup with the jrLoad function, but there aren't any templates being loaded via java. The jrLoad function is only being used for pagination in the Ningja skin.

So if I am understanding that part correctly, it's already there and doesn't need to be copied. However, it has to somehow be modified to load templates for this to work?
updated by @ken-rich: 12/05/14 04:14:12AM
Ken Rich
@ken-rich
12/04/14 04:42:15PM
926 posts

How Do I Modify Code - Featuring by Quota - Template Copying


Using Jamroom

SteveX:
You think?

Sometimes... But it hurts when I do... lol
Ken Rich
@ken-rich
12/04/14 01:47:54PM
926 posts

How Do I Modify Code - Featuring by Quota - Template Copying


Using Jamroom

You are right of course... Just playing with ya... lol
  66