Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
508 views
in Plugins by
edited by

Maybe a bug or maybe I am doing something wrong?

Within function output_widget(...) I read the language string and save it with data in a loop:

foreach
$bestusers .= DATA . qa_lang_html('qa_best_users_per_month/points');

then I use:

       $themeobject->output('<div id="bestusers">');
        $themeobject->output( $bestusers );

This returns the entire $bestusers (including the language string), however, in the very beginning there is a question mark!

 

I can only see the question mark if I copy the HTML from my site, and paste it into a text editor - invisible char? weird!

<DIV CLASS="qa-widget-side qa-widget-side-high">
?                                <div id="bestusers">

 

## Could it be that qa_lang_html wants to output immediately? But how can I then store the language string within the loop?

 

PS: I use the same code for a custom page, there it works with $qa_content['custom'.++$c]=... without the question mark, strange.

Q2A version: 1.5.1

1 Answer

0 votes
by
selected by
 
Best answer
The question mark is probably a mark for an unknown character in your text editor, rather than a literal character that was on the page. So it seems some junk is getting into the string somewhere - you'll need to add more debugging lines to your code to find out exactly how and where.
by
hi gidgreen, I only realized the bug because the according div changed its position on the site (due to the inserted "junk") when using qa_lang_html().

I encoded the language.php file in UTF8, might this cause problems?

If you like I could send you the code (beta plugin best users)...
by
You should check it was saved in UTF-8 but without a byte-order mark - that's probably the problem.
by
best answer!

I changed the encoding from "UTF8" to "UTF8 without BOM", now it is fine.
...