Loading...
 
Development

Development


Newbie needs help!

posts: 5

Hi People,

i am quite a newbi with tiki, php and whatsoever.

I started to make some absence page with some options (for my girlfriend who is a teacher). to learn something i started with the "hello world" page of tikidev and tried things out from there. Now i get stuck.

i am stuck on this part.

Image
Copy to clipboard
include_once('lib/contribution/contributionlib.php'); $contributions = $contributionlib->list_contributions(); $smarty->assign('contributions', $contributions['data'];)


i use other names but even tried this one with both the same errors.
i get the following error message.

Fatal error: Call to a member function on a non-object in c:\program files\easyphp1......

The error is in the "$contributions = $contributionlib...." line

The problem as i can see it is that the $contributionlib is not defined. I looked up for the contributions part and noticed that it is in tikiwiki 1.10 as i am using an older version. Now is my question where is that variable defined so it can call the fucntion?

i use tikiwiki 1.9.3.1

I hope someone can help me out.

posts: 23 United Kingdom

Hi there, I would say a place to start looking is in 'lib/contribution/contributionlib.php', which is being included here. The presumption is that it then creates "$contributionlib", or at least may be expected to.

posts: 5

i wish that was true..
see the example for yourself.

http://dev.tikiwiki.org/Hello+World#_To_execute_some_queries_in_the_php

I can't find anything about making $contributionlib. Or it is in the contributions itself already. But as i am using 1.9.3.1 the contributions is not included in this one and with the {debug} option i dont see it as well.

It seems that the example is only working for 1.10 (havent tested it myself), but still i like to know where that $contributionlib is coming from. As i see it or read it is is referring in some way to the lib file where it calls the function.

posts: 5

Ok found out what was wrong. I looked in the xref-head of this page and look there in the contribution files.

i noticed there a few more important lines.
There is one line in front of the function in contributionlib

Image
Copy to clipboard
class ContributionLib extends TikiLib {


and at the end of it a bit more.

Image
Copy to clipboard
global $dbTiki; $contributionlib = new ContributionLib($dbTiki);


Also the globalis mentioned in the contribuitons.php in the root.

I have no clue what it all exactly does but it seems to work now.

Thanks for the help anyway.