Widget customization Arrays

Hi, I am trying to put on my ste an array that can display 5 different genres of members. I have the f1 on the database as the field where the 5 genres are inserted. I am really a beginer and I don’t know much, already tried to search several sites for help but so far nobody could explain me how to do an array to display what i want basically i want 5 different users that belong to 5 different genres, i tried already several combinations including

<!--widget="members(array('mode'=>'rand','cmp_field'=>'f1','cmp_to'=>|1|,|2|,|3|,|4|,|5|total'=>5))"-->   
<!--widget="members(array('mode'=>'rand','cmp_field'=>'f1','cmp_to'=>'1','cmp_field'=>'f1','cmp_to'=>'2','cmp_field'=>'f1','cmp_to'=>'3','cmp_field'=>'f1','cmp_to'=>'4','cmp_field'=>'f1','cmp_to'=>'5','total'=>5))"-->   

but none seem to work…is there anyone who can teach me the right syntax to use on this case?
I would be very appreciated
Thank you
David

Not really clear on what you are asking of us. First, do you mean a Widget for Wordpress?

If you are asking about a Wordpress Widget (there are widget’s for other systems out there!), Then you should peek at these sites. They discribe how to create a Widget for Wordpress.

http://wp.tutsplus.com/tutorials/creative-coding/building-custom-wordpress-widgets/
The step#2 explains how to set up an array and send it to the newly created Widget…

http://codex.wordpress.org/Widgets_API Wordpress’ info on it. The first link is better, I think!

Hope that is what you were asking… If not explain further on what you need help with. Good luck…

Hi thank you for your reply

Its not for wordpress, it’s for the etano platform builder,and nobody seems to know how to do it in the support forum, though they are trying hard to help, hence why i am asking help in here

I am customizing the site and there are pre-made widgets with random members, but, the platform was mainly made for featuring men or women,and if just include those two members the array will work fine, or a random general members. but, my site will be more of a small social network and, i wanted to have an array that could display the 5 different genres of people that i have there

hope I was more objective…sorry if i wasn t earlier
Thanks
David

Also if it helps…on this page they do tell sort of how to build extra random arrays http://www.datemill.com/etano/wiki/doku.php?id=rand_items_widget but due to my little knowledge i am stuck on it. and their official support is no longer working…

David

Okay, so, using Etano, and selecting the ‘f1’ field in the DB, you are randomly selecting the “I am” field.
I will assume this means the “gender” field.

Now, reading quickly on their site, you use the three options to select the random fields.

The options are:
cmp_field ( Used to select from the field in the DB, such as the “I am” field in your example )
cmp_to ( Used to compare the cmp_field to values that are inside of the DB )
cmp ( Used for the DB side of the command to query the DB with )

So, in your example, it should be something like, syntax wise:

This is for instance so you can pick random members that are women or live in the USA or etc etc

What this means is that you can take a random member for ALL the members that are, let’s say women with code something similar to:

That line says SELECT all MEMBERS who are MALE, take a total of five…

In your example test lines, you check for “f1” which is the “I am” field in the DB. Since that field is just a GENDER field, it contains either “1” for male or “2” for female. You can not test it for “3” as that does not exist. Remember you are testing against the database. You must study your database layout to see what fields you may test against and what the possible results can be.

Also, in your example you mentioned “genres” not “genders” ! Big difference there! Male/Female/None??? That’s three, maybe, but, you wanted five? Not sure what the other two would be… LOL

Anyway, hope that helps. If not ask further questions…

Hi well, thank you for your answer, again my site will not be a dating site, i have the f1 field, and inside that have field i can add as much genders as i want, i add 5 - now, remember this will not be a dating site, imagine i wanted a music profile on each member so, i would have, a grunger, a punk, a rocker, a indie, a classical .So in my case i ve created five genders inside the f1 field, if its possible to show in their example two (male and female) i suppose it should be possible to show five, and hence my question, how to build the widget with the array for five genders instead of just two.

Thanks for your help
David

Well, I showed the code for that. Here it is again:
[php]

[/php]
This line will take randomly one entry from the members array up to a total of five.
(As far as I read on their sites posts.)

If you wanted to just pull a random member from “a grunger” and that value is #1, you would use:
[php]

[/php]
But, I am not totally sure as I do not have this system installed anywhere.
Here are the links I used to find this info for you: (Hope they help!)
http://forum.datemill.com/general/show-specific-members-2732.0.html
http://www.datemill.com/etano/wiki/doku.php?id=rand_items_widget

Thanks a lot for your time I really appreciate it, but that isn’t what I need…that pretty much points me to the first gender i have on the f1 field, so it will only show all the members that share that same let’s call gender. i need an array that shows the 1 image from gender 1, 1 image from gender2, 1 image from gender 3, 1 image from gender 4 and 1 image gender 5 they are all are grouped on the f1 field, my problem here is because i don’t know how to connect the elements to build that array, cause if its possible to show 2 different genders (male/female) im sure its possible 5 as well. I am very familiar with their support forum which is pretty much a community help cause the platform is open source and they re very helpful there but sadly the reason i came here for help is cause nobody seems to figure this out and the official support is gone now.

Thanks again for your time
David

Well, I would guess, without having the entire site code to dissect, that for each image you want to show, just create a separate widget for each with the altered number of the “gender” or “music-gender”. One widget per displayed image. In this manner, it would be more code for the five displays, but, it’s just the same line of code.

Not sure if that is what you are looking for. Either way, good luck…

So…in your opinion there is really no way to do a connection such as this one

<!--widget="members(array('mode'=>'rand','cmp_field'=>'f1','cmp_to'=>'1','cmp_field'=>'f1','cmp_to'=>'2','cmp_field'=>'f1','cmp_to'=>'3','cmp_field'=>'f1','cmp_to'=>'4','cmp_field'=>'f1','cmp_to'=>'5','total'=>5))"-->   

? Well I am a newbie so I went digging thru logic…but i already tried so many combinations and i had a look here http://www.w3schools.com/php/php_arrays.asp which is very useful but I am not quite sure of anything now. I honestly thank you for the time and effort that you did trying to help.

David

Well, first, remember you are not using standard (Beginner or Expert) PHP code. You are using a “canned” system that needs items added into using THEIR code, not standard arrays or any standard PHP.

You are welcome on the little help I have been giving you. But, think of this as a puzzle. First, you have installed or they installed for you full PHP system that has a lot more in it than you may need or may understand. So, you need to really try to understand on how “their” software interacts with what you want to change. Changing a “gender” DB table into a “music Genre” table is no big deal if you have control over all the parts of the first “gender” table. From what I read earlier, this “canned” system uses the “widget” to load a field on the screen. So, it looks simple on the surface. It appears that you can do it, but, not that way.

If you want to display several different members from the music-categories, let’s say you want five listed. You can just create five widget’s. Each one would be for ‘1’, ‘2’, ‘3’, etc. then, each widget would display a random entry from each of the five categories. That would work. Now, if you wanted to create ONE widget that selected randomly from several different category numbers, I am not sure. I can study the details of the docs for the canned system. Do you have a link to it to save me time of searching for the docs?

We can solve this! Or, perhaps someone reading our discussion can help. Do you know the doc’s link?

From what I understand the array im looking for is what its called a multidimensional one.

I am sending you a PM with more info

Well, multidimensional arrays are easy enough, BUT, you must conform to the exact format that the “canned” system is requesting. It is not so much as an “array” issue as it is a “Etano” issue. They REQUIRE you to set up your WIDGET command exactly as they want it, not as you would in just PHP array commands.

We need to look at their DOC’s to figure it out.

Well, I found this link and it explains what you need to do:
http://forum.datemill.com/general/display-newest-members-and-few-online-members-home-page-3225.0.html

First, you need to add in the random plug-in at:
http://code.google.com/p/etano/downloads/list

Then, this site explains how to set it up. It appears you can only use ONE widget for one selection.
Therefore, if you want to show random selections of males, you use that sample. Add a SECOND widget if you want to show random females, too. Now, if you are changing the entire site into some other type of site and not a dating site, you would just use the ONE widget to select randomly from the one field. So, you do not need any other code. You just load up your “f1” field with whatever you want and use the one line similar to the one for Males. It just will not contain males. You just need to add in the extra values.

So, in their samples, they show:

This would select a rand widget value from field “f1” if it is equal to “2”.
And, so, this:

would randomly select a member from field “f1”…
And, this:


will display 15 random males and 15 random females one after the other on the screen.

So, to post, let’s say 5 random music-categories which are numbered 1 to 5, you would have to list five in a row, something like this:





But, it might possibly show duplicates.

There is supposed to be a “multiple checkbox” option. But, this seems NOT to be posted ANYWHERE on the internet! I did locate many sites that mentioned creating your own Widget plugin or altering the “Random” widget to handle what you need.

This may not have helped. Therefore, let’s go back to the beginning… First, the Etano package you are using is a “canned” program designed completely for a dating site. Therefore, ALL of it’s plugin’s and sub codes and options are all designed around a dating service. It is not at all a general system of other websites. Therefore a different free system may be better for you. Just in case someone here know a better starting block for you. Why don’t you explain what you are trying to do…

the multi check box is located on the admin panel of the platform. basically does a connection directly to the database through an interface, and there on the admin panel you change and add fields and categ. etc. So on a typical “dating” site, let’s say a man would be f1 Field 1 - there you add the variables of that field, can be thin, slim, chub etc etc. and it’s inside that edit panel control you have multi boxes to check or to add to the Field 1 “Man” category. Oh well, I will keep on digging but you ve been of excellent help.If you can sometime try to install the platform on your server, cause, I really think it has a lot of potential and not for just dating sites, thats basically has a social network potential. And i already had did all that you suggested. I am very familiar with that forum and the help from there. Thanks Ernie. You were great.

David

Okay, tomorrow, when I have more time, I will download it and look further into the code for you.
I am sure it is just something simple we are missing.

Also, if you get the site up live, private message me how to log into it so I can look at what you are talking about. You can change the password after I peek at it some… More tomorrow when I can look at the actual code…

II PM sent, right now is directory protected but i can show it to u np

tks
david

Okay, I understand the privacy issue. For others reading this, we will post the results of how to get around this issue as soon as we can solve it. If anyone else has experience in this system, please mention it to us.

Your help is really great.

I would love to give u karma but i don t see how to do it…

Thanks
David

Well, you just click on the (+) in the karma area… But, usually, you do this once the issue is solved.
So, I suggest you wait on that. Only fair to others. But, thanks for the thought!

Sponsor our Newsletter | Privacy Policy | Terms of Service