FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » FUDapi - Wiki example
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
FUDapi - Wiki example [message #162680] Thu, 01 July 2010 06:20 Go to next message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
There is an example in the FUDapi that looks like this:
<?php
 include_once 'GLOBALS.php';
 include_once 'fudapi.inc.php';
 $topics = _fud_msg_multi(1, "SELECT root_msg_id FROM ".$GLOBALS['DBHOST_TBL_PREFIX']."thread WHERE forum_id={ARG} ORDER BY id DESC LIMIT 10");
 arsort($topics);
 foreach($topics as $topic) {
 	echo "POSTER: ". $topic->login ."\n";
 	echo "SUBJECT: ". $topic->subject ."\n";
 	echo "BODY: ". $topic->body ."\n\n";
 }
 ?>


However, when it returns only 1 result, it will break because of this:
	} else {
		if (count($result) == 1) {
			return array_pop($result);
		} else {
			return $result;
		}
	}
}

What is served as an array with 2 or more results, becomes a string, or something - When you print_r it, it doesnt show the usual array keys like key => value, it just lists values.

I get an MYSQL error when mine only could only return 1 result, so I commented out that part, mostly.


Re: FUDapi - Wiki example [message #162682 is a reply to message #162680] Thu, 01 July 2010 06:53 Go to previous messageGo to next message
naudefj is currently offline  naudefj   
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
This is not a bug. The example can possibly be expanded to deal with single vales as well as arrays.

You will note that one of the examples already caters for this scenario:
if (is_array($t)) {...

You are welcome to document this behaviour or expand the example on the wiki.
Re: FUDapi - Wiki example [message #162684 is a reply to message #162682] Thu, 01 July 2010 07:03 Go to previous messageGo to next message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
I am not a good enough coder to contribute there I think, i'll stick to replying to questions that i can answer to on the forum!

Your lovely software just broke 10 million page views on my site by the way! I love this little forum <3


Re: FUDapi - Wiki example [message #162687 is a reply to message #162684] Thu, 01 July 2010 07:59 Go to previous messageGo to next message
naudefj is currently offline  naudefj   
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Kwoteer:
Your lovely software just broke 10 million page views on my site by the way! I love this little forum <3


Quite impressive! Over what period was it measured? My largest form is doing between 7 and 8 million page views per month.
Re: FUDapi - Wiki example [message #162689 is a reply to message #162687] Thu, 01 July 2010 08:53 Go to previous messageGo to next message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
It's over a period of two years, I only have around 700-800 uniques per week, it all depends on if we are playing a popular game or not, then the random visitors surge quite heavily.
100-200 posts per day, nothing fancy, but it's always nice when people use your work!

We had a severe HDD crash and lost hundred thousand posts or so a few years back, also lost our entire joomla site etc, that is when i decided to tweak FUDforum to do all the job for us.

I upgraded to 2.7.7 by hand, one fix at a time, have done a few since then also, but some of the fixes are so major I just can't be bothered hehe.

I guess it wouldnt take more than a few days to upgrade and then apply all our tweaks, but its so annoying with databases and columns and tables and a billion IF statements in the templates hehe.


Since I created a mobile theme that automatically gets enabled, cellphone visitor usability has increased enormously, but now i have done the whole path_info thing so I have to update that theme again hehe.


Re: FUDapi - Wiki example [message #162692 is a reply to message #162689] Sat, 03 July 2010 08:10 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Ernesto wrote:
Since I created a mobile theme that automatically gets enabled, cellphone visitor usability has increased enormously, but now i have done the whole path_info thing so I have to update that theme again hehe.


I'm quite interested in your mobile theme! If you are done with it, can you please share it with us as well?
Re: FUDapi - Wiki example [message #162693 is a reply to message #162689] Sat, 03 July 2010 08:14 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Ernesto wrote:
Since I created a mobile theme that automatically gets enabled, cellphone visitor usability has increased enormously, but now i have done the whole path_info thing so I have to update that theme again hehe.


I'm quite interested in your mobile theme! If you are done with it, can you please share it with us as well?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: File attachments stops working
Next Topic: forum datadump stopped working
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 21 18:53:33 GMT 2024

Total time taken to generate the page: 0.02756 seconds