First of all, Patiek, this is a great utility and you saved me a ton of time in having to develop something to accomplish this. Thanks!
The forums are being used as content management for the web site, as they have the login and posting capability already built in, and your work was a perfect match for that.
I have made some modifications to EP-Dev News to allow the display of only certain topic types. Right now if the user sets the post to an "Announcement", it will show up on the web site - this will be changed to "Web Site" as an additional topic type so it will be more concise and will allow the forums to function as normal.
The modifications included: a parameter to the functions as well as a checkbox to the generate code page, and of course the additional AND in the SQL WHERE clause.
The only issue I have come up with is under a no rows found condition, the script is being killed and this causes the rest of the page processing to stop.
So when I want to display news, but there isn't a qualifying post, the page is stopped right after the message "No posts found in selected forum category.", and the rest of the web page display is abandoned.
To fix this, I modified the fetch_Posts() rows check to echo the message and return FALSE instead of going to the stop() function:
The return $post_count at the end of the function is then also needed so there will be a return value.Code:// error if no posts if (!$this->DB->rows()) { // no row condition is not an error //$this->ERROR->stop("no_posts_found"); echo "No posts found in selected forum"; return FALSE; } ... return $post_count;
The call in news() is checked for a return and will simply return its own FALSE if needed:
And the initial call in display_News() will simply return if it comes back false:Code:if ( !$this->FORUM[$forums[$i]]->fetch_Posts($number, $ids[$i],...) ) { return FALSE; } ... return count($ALL_POSTS);
Hope this is of some use to either you or anyone else encountering this.Code:// grab / process news if ( !$this->news($number, $ids,...) ) { return; }


Reply With Quote
