111
Mamba
Re: Error: Call to undefined method stdClass::getVar() in file /class/tree.php line 66
  • 2023/11/8 23:01

  • Mamba

  • Moderator

  • Posts: 11378

  • Since: 2004/4/23


The error you're encountering is due to the fact that the XoopsObjectTree class is expecting the objects in your tree structure to be XoopsObjects hat have a getVar() method, but in your case, you have an array of stdClass objects which do not have this method.

So you should use XoopsObject in your code.

The other way to fix this issue, you can create a custom class that extends the stdClass and implements the getVar() method to act as a bridge between your data and the XoopsObjectTree. Here's an example of how you can do this:

class CustomObject extends stdClass {
    public function 
getVar($var$format 's') {
        
// Implement the getVar method as needed for your data
        // You can fetch the value of the property based on the $var parameter
        // and apply any formatting if required.
        // For example:
        
switch ($var) {
            case 
'cid':
                return 
$this->cid;
            case 
'pid':
                return 
$this->pid;
            
// Add more cases as needed for other properties
            
default:
                return 
null// Return null for unknown properties
        
}
    }
}

// Create an array of CustomObject instances
$customObjects = array();

// Populate the $customObjects array with your data (stdClass objects)
// For example:
$stdObject = new stdClass();
$stdObject->cid 1;
$stdObject->pid 0;
// Add other properties as needed

$customObject = new CustomObject();
$customObject->cid $stdObject->cid;
$customObject->pid $stdObject->pid;
// Add other properties and implement getVar for CustomObject as needed

$customObjects[] = $customObject;

// Create the XoopsObjectTree using CustomObject instances
$tree = new XoopsObjectTree($customObjects'cid''pid'null);


If there are other missing elements, then you should add them to your CustomObject as well.

But if there are a lot of them, you would be better off by simply using XoopsObject.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs



112
cadch
Error: Call to undefined method stdClass::getVar() in file /class/tree.php line 66
  • 2023/11/8 15:42

  • cadch

  • Just popping in

  • Posts: 48

  • Since: 2007/12/17


My object
Array ( [0] => stdClass Object ( [cid] => [pid] => [name] => name [icon] => bi-folder-plus [weight] => 10 [update_date] => 1514736000 [cid_type] => _top [description] => description [picture] => 1.jpg [status_code] => [user_ip] => 127.0.0.1 [user_id] => ) )

my code
$tree = new XoopsObjectTree($object'cid''pid'null);

have Error: Call to undefined method stdClass::getVar() in file /class/tree.php line 66
How to fix it?



113
Mamba
Re: Smarty 3 and Smarty 4 coming soon to XOOPS
  • 2023/10/31 18:40

  • Mamba

  • Moderator

  • Posts: 11378

  • Since: 2004/4/23


Thanks for reporting - it should work now
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs



114
audizioni
Re: Smarty 3 and Smarty 4 coming soon to XOOPS
  • 2023/10/30 21:46

  • audizioni

  • Just popping in

  • Posts: 17

  • Since: 2009/1/11


I have been following xoops with interest for several years (but I'm not a developer). I report an error on the site xoops.org: Modules / Mosules @ GitHub
https://xoops.org/modules/wggithub/


A problem has occurred on our server!
Page is currently unavailable

We are working on a fix
Please come back soon ...

Error : SmartyCompilerException: Syntax error in template "db:db:wggithubbreadcrumbs.tpl" on line 2 "
Home
" - Unexpected """, expected one of: "}>"



115
zivXP
Re: oledrion
  • 2023/10/27 19:23

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1


Quote:

Mamba wrote:
OK, give it a try: https://github.com/mambax7/oledrion

It was quick & dirty, so there will be probably tons of bugs. When you encounter them, please report back


Thank you very much! The module is installed, the products are running and displayed on the screen. The rest is in the testing process.



116
Mamba
Re: oledrion
  • 2023/10/27 16:45

  • Mamba

  • Moderator

  • Posts: 11378

  • Since: 2004/4/23


OK, give it a try: https://github.com/mambax7/oledrion

It was quick & dirty, so there will be probably tons of bugs. When you encounter them, please report back
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs



117
zivXP
Re: oledrion
  • 2023/10/27 11:09

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1


Quote:

Mamba wrote:
If I find couple of hours this weekend, I'll try to look into it, but no promises...


O.K. I'm just confused.



118
Mamba
Re: oledrion
  • 2023/10/27 11:03

  • Mamba

  • Moderator

  • Posts: 11378

  • Since: 2004/4/23


Right now I'm totally busy working on XOOPS 2.5.11 RC-3 release

If I find couple of hours this weekend, I'll try to look into it, but no promises...
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs



119
zivXP
Re: oledrion
  • 2023/10/27 7:14

  • zivXP

  • Not too shy to talk

  • Posts: 113

  • Since: 2006/2/9 1


Quote:

Mamba wrote:
Quote:
Will the "oledrion" module be changed to work on xoops2.5.11

That's the plan, but it won't happen before October/November, at the earliest. Right now I'm busy with work, but I hope to find some time in the Fall, to update some modules, incl. Oledrion, for XOOPS 2.5.11. But don't expect any new features here.


Is it possible to somehow transfer the "oledrion" module to xoops2.5.11 without a queue? Maybe you can adjust the plan? Very necessary.



120
Mamba
Re: publisher
  • 2023/10/1 2:08

  • Mamba

  • Moderator

  • Posts: 11378

  • Since: 2004/4/23


If it worked in an older XOOPS version, then it's a good chance that it will work with the current version, with eventually small adjustments.

Please share the links you were looking at...
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs




TopTop
« 1 ... 9 10 11 (12) 13 14 15 ... 29425 »



Login

Who's Online

335 user(s) are online (79 user(s) are browsing Support Forums)


Members: 0


Guests: 335


more...

Donat-O-Meter

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

Latest GitHub Commits