1
tigums
Getting a user's resolution at registration
  • 2004/6/6 22:14

  • tigums

  • Just popping in

  • Posts: 8

  • Since: 2004/5/30


At this time I have my registration setup such that they can enter their resolution manually and it will input that into my altered xoops_users table.

However, I would like to automate the process of getting thier resolution at registration. Javascript provides screen.width and screen.height, I don't know if there is a way to pass those javascript variables into the pphp code though.

I followed this guide to hack the registration,http://claude.felix.chez.tiscali.fr/tuto/hack_form_inscr_bil.htm, and that set everything up for people to be able to enter their resolution.



In class/xoopsform/themeform.php the form is 'rendered',so I added
<script language="Javascript">document.write('<input type='hidden' name='resolution' id='resolution' value="'+screen.width+'x'+screen.height'" />');</script>


before the </form> in there. I thought that would work.. but it didn't.

Does anyone have any insight on doing something like this?



2
tigums
Re: How to edit registration?
  • 2004/6/5 22:29

  • tigums

  • Just popping in

  • Posts: 8

  • Since: 2004/5/30


html/include/registerform.php
html/register.php

Not 100% on what you want done, but if you want to make sure their is input in the name input field, a few lines of javascript can do taht.



3
tigums
How to get a user name from a user id
  • 2004/6/1 5:57

  • tigums

  • Just popping in

  • Posts: 8

  • Since: 2004/5/30


Early when searching for another answer, I came across a topic about this, but now for the life of me I can't find that thread again.

It was something like

xoops::getUserfromId()


any help is appreciated



4
tigums
Re: using smarty to display multidimensional array
  • 2004/6/1 4:23

  • tigums

  • Just popping in

  • Posts: 8

  • Since: 2004/5/30


Ah, figured it out

Did a search and found this link
https://xoops.org/modules/newbb/viewtopic.php?topic_id=19614&forum=17#forumpost84369


so my code needed to be
<{section name=j loop=$charinfo}>
    
        .<{
$charinfo[j].first}> <br><br>

      
<{ /
section }>



It's pretty much exactly howhttp://smarty.php.net/manual/en/language.function.section.php (which is the resource I used to make mine section function) defines the section function, yet I, for some reason, didn't figure out what was going on. I still kinda don't, but it works.



5
tigums
[answered] using smarty to display multidimensional array
  • 2004/6/1 4:11

  • tigums

  • Just popping in

  • Posts: 8

  • Since: 2004/5/30


I have an array defined, and with smarty debugging on it properly shows in the popup the content of the array.

The structure of the array is

charinfo.[0-#].[first, last, home]

So when I call

$charinfo.0.first

it returns the first name of the first array inside the charinfo array.


Now to display this array, I need to travel through each [0-#] array.

<{section name=customer loop=$counter}>
    .<{
$smarty.section.customer.index}>
<{/
section}>


This does, for example if $counter = 2, display
Quote:

.0
.1


So now I have a way to cycle through the arrays 0-# (or more specifically 0-($counter-1))

but how do I add that index variable into an array call?

things I have tried, and failed with:

.<{$charinfo.($smarty.section.customer.index).first}> 
.<{
$charinfo.<{$smarty.section.customer.index}>.first}> 
.<{
$charinfo.{$smarty.section.customer.index}.first}> 
.<{
$charinfo.".$smarty.section.customer.index.".first}>
.<{
$charinfo."$smarty.section.customer.index".first}>
.<{
$charinfo.$smarty.section.customer.index.first}> **


** This one, unlike the others, didn't "nuke" the page. The paged looks normal, but still doesn't return any values



the Smarty Debug window displays nothing about the section loop, or any of the calls inside the loop, so I can't find a use for it in this situation.


Note- the leading .'s are placeholders



6
tigums
Re: Problem getting info from sql database
  • 2004/5/31 21:14

  • tigums

  • Just popping in

  • Posts: 8

  • Since: 2004/5/30


Firstly, appreciate your help and the quick reply

Quote:

you should make it a habit referencing users by userid in relational tables - usernames can change, userids do not


Ah, didn't know that. Good to know.

Quote:

Secondly, you should not put quotes around field names in the query. Basically you are asking for rows where the string 'owner' equals the string 'bob' - which will never happen.


Ah, you're right, that was it. Always the small things that get me


Quote:

... failed queries in red. I'm saying this because it is not apparent to me, whether you know this or if you were looking for debug errors on the actual page.


Yea I was staring at the page... ha!





Also, another question, everytime I edit a page, be it the index.php or the sample_html.html or whatnot, do I have to update the module everytime thereafter editing? Or only certain files need it?



7
tigums
Problem getting info from sql database
  • 2004/5/31 20:56

  • tigums

  • Just popping in

  • Posts: 8

  • Since: 2004/5/30


I am making a module. Right now it's based off the sample module from jan304. It works fine. To the xoops_version, I added a SQL entry to create a database with columns of "cid" and "owner" and some other columns, but right now I dont care about them.

$modversion['sqlfile']['mysql'] = "sql/mysql.sql";

$modversion['tables'][0] = "charsheet_core";


I manually added entries to the table via phpadmin

which is something like:

cid =1
owner = bob



I've edited the index.php and the sample_html.html(the template) to reflect what I am trying todo

my index changes is:

$username = !empty($xoopsUser) ? $xoopsUser->getVar('uname') : $xoopsConfig['anonymous'];
$userid = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
//$sq = ".$xoopsDB->prefix("charsheet_core").";
$sq "sql2";
$result $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("charsheet_core")." WHERE 'owner' = '$username' ORDER BY 'cid' ASC");

while ( 
$myrow $xoopsDB->fetchArray($result) )
    {
        
$cid=$myrow["cid"];
   
    }
    
$xoopsTpl->assign('uname'$username);
$xoopsTpl->assign('theid'$userid);
$xoopsTpl->assign('charid'$cid);
$xoopsTpl->assign('sqtest'$sq);


and my sample_html chages are:

Greetings <{$uname}> and <{$theid}>

<
br>hi1
<br><{$sqtest}><br>
<{
$charid}>

<
br><br>

hi3


Note: These are just the changes I added to the otherwise perfectly working



When I am logged in as the user 'bob',the output of the module is:

Quote:

Greetings bob and 1
hi1
sql2


hi3


So I know that I did the getting the username part right, getting the userid part right. Then assigning those values to be used in the template.

However the database part is I fudged on, I should be getting a "1" for the cid, since that row is owned by bob.

The module is updated, and I am running debugging with mysql/blocks set to on with no errors being reported.

What am I doing wrong here?





8
tigums
"I think I broke it..."
  • 2004/5/31 2:08

  • tigums

  • Just popping in

  • Posts: 8

  • Since: 2004/5/30


Got XOOPS about two days ago, been fiddling around with it. Was using the newest e107, but it was slower than I remember.


So I'm trying to make a new module, and am doing the kickstart guide (http://wiki.xoops.org/wakka.php?wakka=ModuleHowTo)

I edit the name from greeter, to my soon to be module, to charsheet. Go to try to install it, and my modules page doesnt show. hrm. I go back and make greeter verbatim, c&p style. neither show. weird. So I come here, download the dictionary module to see if that shows up, nothing. I tried the random quote module, nothing. Then I notice the modules page isn't right. It kinda cuts off at the bottom.

I figure my first incarnation of a module is messing everything up. I delete the folder from the modules directory, and now I can see all the other modules. And some error

Above the noninstalled modules table is:

Module File for Not Found!Module File for Not Found!Module File for Not Found!Module File for Not Found!Module File for Not Found!

and between the install and info button in an otherwise blank row is another Module File for Not Found!

So I assumed my module file for... wasn't found.


Then I realize, that the greeter module isn't listed. So I delete that, and now no error. The two downloaded modules are there waiting to be installed.




All of this brings two questions:


Shouldn't an error have shown when I first tried to install my own botched module? Instead, XOOPS sends a chopped off modules listing. Did I do something that dastardly that XOOPS couldn't fathom that was even a possibility?


Secondly, the kickstart guide to module development doesn't work, as so far as it indicates it should. Is it old that the newest version of XOOPS no longer works with it? Or did I somehow manage to fudge the process of copy and paste when creating it?


Apprecite your time.







TopTop



Login

Who's Online

214 user(s) are online (141 user(s) are browsing Support Forums)


Members: 0


Guests: 214


more...

Donat-O-Meter

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

Latest GitHub Commits