11
banesto
AJAX
  • 2007/1/28 0:51

  • banesto

  • Just popping in

  • Posts: 61

  • Since: 2005/1/24


I've been working with XOOPS for more than 2 years now, i've done some work with drupal too and a little with wordpress.

I still like xoops, because i easily can make a module and it'll work without problems, unlike drupal which has hooks and you are limited in actions you want to succeed in.

Wordpress is generally aimed at blogging so it does the job perfectly, but when it comes to integrate something more serious than one php page, it's getting hard, so is making plugins which basically are intended to bring more possibilities to posts/comments/pages and cannot be considered as stand-alone modules.

BUT both drupal and wordpress use AJAX, which makes user experience so much better! it's almost like pleasure! XOOPS seems to me very old-fashioned, although i love it for development freedom and stability i can count on, unlike drupal.

I suggest implode AJAX tools heavily into core!

redirect messages -> ajax
comments -> ajax
pm -> ajax
ETC.
make it more up-to-date, WEB 2.0, dynamic

and add effects.
where's my red bull!



12
banesto
Re: Module Development tutorial (with classes)
  • 2007/1/13 1:18

  • banesto

  • Just popping in

  • Posts: 61

  • Since: 2005/1/24


how does this work? i mean how does foreach loop connects to the following operations? Variables $k and $v are not mentioned and yet somehow function can access variables like "$name", "$climit" etc..

foreach ($MembersType->cleanVars as $k => $v) {
            ${
$k} = $v;
        }

        if (
$MembersType->isNew()) {
            
$tid $this->db->genId('acc_member_type');
            
$sql sprintf("INSERT INTO %s (tid, name, climit, cname) VALUES (%u, %s, %u, %s)"$this->db->prefix('acc_member_type'), $tid$this->db->quoteString($name), $climit$this->db->quoteString($cname));}
where's my red bull!



13
banesto
Re: Module Development tutorial (with classes)
  • 2007/1/12 23:11

  • banesto

  • Just popping in

  • Posts: 61

  • Since: 2005/1/24


man, i solved this too..

i had to use already written function "get" like this:

$item $this->get($id);
$name $item->getVar('name');


and then getVar works like heaven!
where's my red bull!



14
banesto
Re: Module Development tutorial (with classes)
  • 2007/1/12 22:57

  • banesto

  • Just popping in

  • Posts: 61

  • Since: 2005/1/24


and another question..

i have a class:
class MembersType extends XoopsObject {
    function 
MembersType() {
        
$this->XoopsObject();
        
$this->initVar('tid'XOBJ_DTYPE_INTnullfalse);
        
$this->initVar('name'XOBJ_DTYPE_TXTBOXnulltrue100);
        
$this->initVar('climit'XOBJ_DTYPE_INTnullfalse);
        
$this->initVar('cname'XOBJ_DTYPE_TXTBOXnulltrue100);
    }
}


and in classhandler i want to use $this->getVar('name'); but that doesn't work, because $this directs to classhandler not class, so - how can i access needed variables using getVar ?
where's my red bull!



15
banesto
Re: Module Development tutorial (with classes)
  • 2007/1/12 21:52

  • banesto

  • Just popping in

  • Posts: 61

  • Since: 2005/1/24


ok, i figured it out myself

now, what's not clear is those & marks..

what is the difference:

$class_handler =& xoops_getmodulehandler('memberstype');
$class_handler xoops_getmodulehandler('memberstype');


and here

function &create($isNew true)
function 
create($isNew true)


and another question just for confirmation.. when defining a function and putting for example $id = false in the brackets like this

getAll($id = false)

means that this attribute is not necessary when calling?
where's my red bull!



16
banesto
Re: Module Development tutorial (with classes)
  • 2007/1/12 17:13

  • banesto

  • Just popping in

  • Posts: 61

  • Since: 2005/1/24


Thanks, that worked out!

How can i get actual results from "getObjects" function (it's in AccMembersTypeHandler class)?

function getObjects($criteria null$id_as_key false) {
        
$ret = array();
        
$limit $start 0;
        
$sql 'SELECT * FROM '.$this->db->prefix('acc_member_type');
        if (isset(
$criteria) && is_subclass_of($criteria'criteriaelement')) {
            
$sql .= ' '.$criteria->renderWhere();
            
$limit $criteria->getLimit();
            
$start $criteria->getStart();
        }
        
$result $this->db->query($sql$limit$start);
        if (!
$result) {
            return 
$ret;
        }
        while (
$myrow $this->db->fetchArray($result)) {
            
$MembersType = new MembersType();
            
$MembersType->assignVars($myrow);
            if (!
$id_as_key) {
                
$ret[] =& $MembersType;
            } else {
                
$ret[$myrow['tid']] =& $MembersType;
            }
            unset(
$MembersType);
        }
        return 
$ret;
    }


$class_handler =& xoops_getmodulehandler('memberstype');
$memberstype =& $class_handler->getObjects;

... what's next? i get $ret back, right? how can i get out results from that?
where's my red bull!



17
banesto
Re: Module Development tutorial (with classes)
  • 2007/1/12 16:53

  • banesto

  • Just popping in

  • Posts: 61

  • Since: 2005/1/24


ok, my data:

module name: acc
class file name: member_type.php
class name: MembersType
class handler name: MembersTypeHandler


class file is situated in class folder of course.

what should i change in the names and how can i call the class to start using it's functions?
where's my red bull!



18
banesto
Re: Module Development tutorial (with classes)
  • 2007/1/12 12:41

  • banesto

  • Just popping in

  • Posts: 61

  • Since: 2005/1/24


i wish i knew French
thanks, i'll look that through
where's my red bull!



19
banesto
Re: Module Development tutorial (with classes)
  • 2007/1/12 11:59

  • banesto

  • Just popping in

  • Posts: 61

  • Since: 2005/1/24


of course, i am aware of this method, but it's not so easy.. could you advise a simple module using classes for a start?

my XOOPS version is 2.0.16
where's my red bull!



20
banesto
Module Development tutorial (with classes)
  • 2007/1/12 11:25

  • banesto

  • Just popping in

  • Posts: 61

  • Since: 2005/1/24


Ok, there is a simple module development tutorial which i don't need because i can figure out myself how to do it, but what about more sophisticated module, which includes classes XoopsObjects, XoopsObjectHandlers? Is there a tutorial that can explain how to use all thouse rich XOOPS features and make a real smart module not just plain php code implementet in xoops???

And Yes, i've seen Dev Wiki. There are dev. standarts which i don't consider to be a tutorial, just some tips, which are too few. And there are no examples how to make a class, call it etc.
where's my red bull!




TopTop
« 1 (2) 3 4 5 6 »



Login

Who's Online

242 user(s) are online (154 user(s) are browsing Support Forums)


Members: 0


Guests: 242


more...

Donat-O-Meter

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

Latest GitHub Commits