Datawalke / Coordino

Self-hosted Knowledge Software your question & answer system written on top of the CakePHP Framework
http://coordino.com
MIT License
714 stars 173 forks source link

Tags tab displays nothing #11

Open ghost opened 13 years ago

ghost commented 13 years ago

When clicking on the "Tags" tab (/tags/sample) nothing is being displayed.

gotoitguy commented 13 years ago

If it's just a blank white page, check your webserver error log. If it's displaying a 404, your .htaccess file is incorrect.

Verify the 3 .htaccess files exist as shown below:

Have you attempted any modifications to the code? If so, make sure everything is correct.

ghost commented 13 years ago

Yes, those files are in the latest branch.

Here is what I am seeing in my error logs

2011-08-15 09:38:56 Warning: Warning (2): array_reverse() [function.array-reverse]: The argument should be an array in [/web/content/app/models/tag.php, line 89]

gotoitguy commented 13 years ago

What version of php are you running? Seems to run fine on PHP 5.3.6

ghost commented 13 years ago

5.2.13

ghost commented 13 years ago

bump

ghost commented 13 years ago

I have a tag with 2 posts associated with it, these are the errors i am seeing in debug more.

Notice (8): Undefined variable: questions [APP/models/tag.php, line 92] Warning (2): array_reverse() [function.array-reverse]: The argument should be an array [APP/models/tag.php, line 92] Warning (2): Invalid argument supplied for foreach() [APP/views/tags/find_tag.ctp, line 2]

ghost commented 13 years ago

I have determined that this function is the problem:

line 51 of Tag model

$results = $this->find( 'all', array( 'contain' => array( 'Post' => array( 'User' => array( 'fields' => array('User.public_key', 'User.username') ), 'Answer' => array( 'fields' => array('Answer.id') ), 'conditions' => array('Post.flags <' => $flag_check['Setting']['value']), 'fields' => array('Post.title', 'Post.url_title', 'Post.public_key', 'Post.views', 'Post.timestamp'), 'limit' => $page . ',' . 10 ) ), 'conditions' => array('Tag.tag' => $tag), 'fields' => array('Tag.tag') ) );

The statement 'fields' => array('Tag.tag') is giving me the problem. I can get results when I remove the line, but I don't get author or answer data back.

Am I the only one not getting results on the Tag page?

Here is a link to my development site: http://www.classicquestions.com/tags/antique-jewelry

mahas commented 12 years ago

Hey nasium tell me how did you change the text in the widget: "ClassicQuestions.com is a collaboratively edited question and answer site built for antique enthusiasts. It's easy to use, with no registration required!" Thank you

bones418 commented 12 years ago

This model is trying to use cake's "containable" behavior, but it never indicates that it's going to do so. Add the following line near the top of the tag model (app\models\tag.php) and everything should start working correctly:

var $actsAs = array('Containable');

nasium - This will also fix your problem where all of the questions on your tag page are currently showing "0 answers" instead of the real number of answers. Well, actually there's another issue as the tag model doesn't exclude answers that have been flagged too many times. To fix that you would need to look for

'Answer' => array( 'fields' => array('Answer.id') ),

and change it to

'Answer' => array( 'fields' => array('Answer.id'), 'conditions' => array('Answer.flags <' => $flag_check['Setting']['value']) ),

cruisemaniac commented 12 years ago

Hi @bones418, thanks for this information. Is there not a pull request for this to merge it into the codebase? I forked the repo earlier today and spent quite a bit of time trying to hunt down the little nuisance!

Datawalke commented 12 years ago

@cruisemaniac & @bones418 if either of you end up resolving this issues please make sure to place a pull request and I will review it promptly. Thank you for your help!

cruisemaniac commented 12 years ago

@Datawalke it was @bones418 's solution that I emulated in my setup. im sure @bones418 can setup the pull request...

bones418 commented 12 years ago

@Datawalke & @cruisemaniac Glad my advice helped. I've never contributed to a GitHub project before so this was very new to me, but I believe I've setup the pull request.

M111 commented 10 years ago

Hi! I've try your Engine on our test servers, and i can't make any post some kind of error appears "INVALID ReCPATCHA" can you resolve it or tell where it is can appears?