31
sceilig
Displaying values from a Multiple select box (combobox)
  • 2006/5/10 21:18

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I added a multi selectbox in Extended Profiles for users and then wanted to display the selected values on the user's profile page. I dont have any problem looping through users and displaying all other data but because of the way XOOPS handles multiple select boxes in the database, I dont know what XOOPS class or function I should use to extract and display this data.

Say if I have a field called user_category and the values are:
-- committee member
-- board member
-- staff member

And a user can be part of all 3 categories.

Here is how XOOPS stores this data for this field:
a:2:
{i:0;s:1:"2";i:1;s:1:"1";}

I just dont understand the syntax being used here. Is there any documentation or is there a XOOPS function I can use to extract the info and display it as this for a user:
User Category: committee member, staff member



32
sceilig
Re: Search Members by State
  • 2006/5/9 22:41

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I have been hacking away at XM-Memberstats to show a list of users based on search criteria. I am also using Extended Profiles to manage users and the initial registration form. With Extended Profiles, you can add any number of custom fields, so you could add a dropdown, and then populate with all 50 states as options (all by using the Extended Profiles admin area - bit of a pain but it does work)
e.g.
1 - Alabama
2 - Arizona

Then you would have to hack XM-Memberstats to add a search form, with searching by state one of the criteria. This could be done with the xoopsformloader.php class - much like how other forms are built in xoops.

Then when you run your search, you would have to tweak the MySQL query to search the user_profiles tables for where state = '2' (for users in arizona).

Code would be something like this

Quote:

if ($_POST[state]) $querystate = $xoopsDB->prefix("user_profile").".state = '$_POST[state]."'";
else $querystate = 1;

$result = $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("users")." INNER JOIN ".$xoopsDB->prefix("user_profile")." ON ".$xoopsDB->prefix("users").".uid=".$xoopsDB->prefix("user_profile").".profileid WHERE ".$xoopsDB->prefix("users").".level>0 AND $querystate");


Then loop through the users and display them. to do all this you would have to be comfortable creating a XOOPS search form, building a MySQL query from the search criteria, and looping through the results and displaying them. If not, then I dont think you should tackle it.
The XOOPS documentation on getting up to speed in developing forms using XOOPS classes is minimal and you kindof have to see how other modules display their forms and then replicate the code snippets.



33
sceilig
Uploading and resizing images
  • 2006/4/22 23:02

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


In creating some modules and hacking others, I wanted to come up with a standard solution for allowing users to upload photos,have them resized along the way and then store the photos in a user's image folder (a subfolder of uploads that gets created when they try and upload a photo).

I see that there is the XoopsMediaUploader class to upload images, but it seems you specify the max width and max height of what an uploaded image should be, and not what the end result resized max width and height should be.

Essentially I am more concerned about the end result - that an image should be say 100px wide by 100px high - the user can upload whatever size image they want but it will be resized to fit those proportions before saving or displaying.

Am I wrong in thinking the XoopsMediaUploader cant do what I would like it to do. Perhaps there is anoher XOOPS resize function out there, or do I just have to create a custom bit of code myself - I figured a lot of other people would also run into this problem.

I also dont want to use the imagemanager or the imanager plugin with one of the html editors - just a simple file upload box on a form.



34
sceilig
Re: Adding text to a Xoops Form
  • 2006/4/20 5:35

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Well I figured out how to do it - all about specifying the delimiter parameter in
XoopsFormElementTray ($caption, $delimeter);

I had the delimeter set to "<br />" - changing the delimeter to be a space allowed me to combine multiple form elements on the same line, using the XoopsFormLabel() function to add text in bettwen elements.



35
sceilig
Adding text to a Xoops Form
  • 2006/4/20 2:55

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I am creating a XOOPS Form and building a XoopsFormElementTray() where I can add multiple radio buttons and text fields to appear in the one form column.

But I dont know how I can add text to appear directly AFTER a text field.
e.g. Recurs every TEXTFIELD days
(where TEXTFIELD is a XOOPS form text field and "days" appears on the SAME line as the textfield)

I thought I could use something like setDescription() but that doesnt seem to work. I think that function only adds a description underneath a left column form element label.

Is there another function for just adding text to a XOOPS form?



36
sceilig
Re: What's wrong with Wf-links module
  • 2006/4/2 8:44

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


This is php system function. If you are getting the undefined function error then you may be using an older version of php (pre PHP 4.0?)

Information on the ctype_digit() function
http://us2.php.net/ctype_digit



37
sceilig
Re: Multisite HACK for 2.2.3 Final
  • 2006/4/1 7:18

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Deepy, Thank you for your reply.
Could you give me some examples of Uri Pattern syntax that you used. Is that field looking for a regular expression? And what is the 0 checkbox for?

I agree - getting the multisite working in a simple fashion would be the best starting point. So now I have parked a second domainname to the installation of XOOPS on the first domain.
e.g. domainname2.com --> domainname1.com/xoops/

What sort of a uri pattern should I be using to accomplish this?

It would be great if other users submitted examples of how they have used the multisite module - the module is powerful but perhaps a lot of users like myself dont know how to fully tap it???



38
sceilig
Re: Multisite HACK for 2.2.3 Final
  • 2006/3/31 11:23

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I have been trying to get Multisite working but am having difficulty. Can someone tell me what I did wrong or left out?

1. Installed XOOPS 2.2.3 at this locationhttp://www.domain1.com/site1
2. Installed Multisite module
3. Updated mainfile.php to define XOOPS_RESCUE_URL instead of XOOPS_URL
3. Added a subsite
-- Name: Sub Site
-- Site Url:http://www.domain1.com/site2
-- Empty theme, template, cache and upload folder settings
-- Uri Pattern blank
-- dbprefix xoops2
-- Shared tables --> users, groups, sessions, news, downloads
4. Set up an alias for folder /site2 --> /site1 and restarted apache.

When I accesshttp://www.domain1.com/site2, XOOPS does come up but ALL the links reference site1.
ie clicking on login link goes tohttp://www.domain1.com/site1/user.php instead of
http://www.domain1.com/site2/user.php

I have read through all the forum posts to see if I am missing something. Perhaps the URI pattern needs to be set?



39
sceilig
smarty variables in custom blocks?
  • 2006/3/24 9:37

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I created a custom block with graphics showing up in the "options" part of the block. I want to add the smarty <{$xoops_url}> variable in the url for each image so that they are absolute, but the variable doesnt get interpreted when viewing the block on my live website.

What variable should I be using in a custom block to show the xoops_url for my website?

The reason Im trying to do this is to help me edit the custom block code in the backend using the FCKeditor, rather than edit the code in html with the default editor.



40
sceilig
Re: how to "install" WYSIWYG editor for custom blocks?
  • 2006/3/20 11:12

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I had success in getting the FCKeditor to show up for editing custom blocks, for version 2.2.3 at least. The code given by silver74 above must be for a previous version of Xoops?

I replaced roughly line 85 to line 93
Quote:

if ($instance->isNew()) {
$editelements = $instance->block->getOptions();
}
else {
$editelements = $instance->getOptions();
}
if ($editelements != false) {
$form->addElement(new XoopsFormLabel(_AM_OPTIONS, $editelements));
}


with this

Quote:

include_once XOOPS_ROOT_PATH."/class/xoopseditor/fckeditor/formfckeditor.php";
$content = $instance->getVar('options');
$options['caption'] = "Options";
$options['name'] ='options[0]';
$options['value'] = $content[0];
$options['rows'] = 8;
$options['cols'] = 60;
$options['width'] = '600px';
$options['height'] = '400px';
$t_area = new XoopsFormFckeditor($options,true);
$form->addElement(new XoopsFormLabel(_AM_OPTIONS, $t_area->render()));


The problem I have now though is how to include the XOOPS_URL for paths to images and links in my custom block. I tried using <{$xoops_url}> and <?=XOOPS_URL?> but neither of them get interpreted. Its as if the "Options" field for a custom block has to be just straight html. Any ideas?




TopTop
« 1 2 3 (4) 5 »



Login

Who's Online

248 user(s) are online (159 user(s) are browsing Support Forums)


Members: 0


Guests: 248


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits