x00
Don't PM about development, I'm not currently taking on clients MVP
public function DiscussionsController_Render_Before(&$Sender){
if (strtolower($Sender->RequestMethod) != 'index') return;
foreach (CategoryModel::Categories() As $Category) {
if ($Category['Name'] == 'Blog'){
$ID = $Category['CategoryID'];
break;
}
}
if(!$ID) return;
$Discussions = $Sender->Data('Discussions');
foreach($Discussions As &$Discussion){
if($Discussion['CategoryID']==$ID){
$Discussion = null;
}
}
$Discussions = array_filter($Discussions);
$Sender->SetData('Discussions',$Discussions);
} Don't PM about development, I'm not currently taking on clients.
grep is your friend.
x00
Don't PM about development, I'm not currently taking on clients MVP
public function DiscussionsController_Render_Before(&$Sender){
if (strtolower($Sender->RequestMethod) != 'index') return;
$Discussions = $Sender->Data('Discussions');
$DiscussionsFiltered =array();
foreach($Discussions As $Discussion ){
if($Discussion->Category!=='Blog'){
$DiscussionsFiltered[]=$Discussion;
}
}
$DiscussionsFiltered = new Gdn_DataSet($DiscussionsFiltered);
$Sender->DiscussionData =$DiscussionsFiltered;
$Sender->Data('Discussions',$DiscussionsFiltered);
} Don't PM about development, I'm not currently taking on clients.
grep is your friend.
Answers
- Spam
- Abuse
0 · Insightful Awesome LOL ·cheers
Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·Not sure how that could be done, but I'm assuming when the query is made to mysql, to display all discussions, it must be specified to omit the specific category, with some kind of 'if' clause.
- Spam
- Abuse
0 · Insightful Awesome LOL ·If the mysql query needs to be altered to omit a specific category, it's not that easy to resolve. I'll give it some thought, sahotataran.
What to do if I get a Bonk Error?
Vanilla Wiki : Join and help edit our Wiki! | View all Vanilla issues on GitHub | Report a new Vanilla issue on GitHub
Deploying a new Forum and adding a Theme | Give thanks to the Vanilla Developers!
- Spam
- Abuse
0 · Insightful Awesome LOL ·Thanks guys
Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·sahotataran can you give me 2 examples please? Let's do an example with PHP scripts.
Your category on NillaBlog is "Forum Scripts". The forums are "Vanilla", "PhpBB" and "SMF". Tell what you need in which situation :-)
What to do if I get a Bonk Error?
Vanilla Wiki : Join and help edit our Wiki! | View all Vanilla issues on GitHub | Report a new Vanilla issue on GitHub
Deploying a new Forum and adding a Theme | Give thanks to the Vanilla Developers!
- Spam
- Abuse
0 · Insightful Awesome LOL ·say -> i have 4 categories named NEWS, ARTICLES, FEATURED, OTHER
using NillaBlog i have Displayed ARTICLES category page as BLOG and its url categories/articles - i am using as home page.
u know how on discussions page /DISCUSSIONS - all the discussions are listed - which are from NEWS, ARTICLES, FEATURED, OTHER
but i dont want to display ARTICLES in this list of DISCUSSIONS
so i wanted to know if that is possible
Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·Experiment with this SQL a bit, it's not the most perfect SQL I've written.
You can hardcode the category ID of the Articles category. You can replace the "NOT IN" with something else.
What to do if I get a Bonk Error?
Vanilla Wiki : Join and help edit our Wiki! | View all Vanilla issues on GitHub | Report a new Vanilla issue on GitHub
Deploying a new Forum and adding a Theme | Give thanks to the Vanilla Developers!
- Spam
- Abuse
0 · Insightful Awesome LOL ·Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·get the category id before the discussions query is built. Then add the where clause to the query builder (no join). Then this will return the results you want.
Don't PM about development, I'm not currently taking on clients.
grep is your friend.
- Spam
- Abuse
0 · Insightful Awesome LOL ·Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·DiscussionController_Index_Beforestore the category Id in a class variable then with
DiscussionModel_BeforeGet_Handleradd the where
$Sender->SQL->Where('d.CategoryID <>', $this->BlogCategoryID);This would produce better results. This all stimulates on
if(strtolower($Sender->RequestMethod) != 'index') return;if (!isset($this->BlogCategoryID)) return;respectively
Don't PM about development, I'm not currently taking on clients.
grep is your friend.
- Spam
- Abuse
0 · Insightful Awesome LOL ·i did something like this on my home page but its not loading DISCUSSIONS VIEW and gives error as can you please help me with it????
Thanks in advance
Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·Don't PM about development, I'm not currently taking on clients.
grep is your friend.
- Spam
- Abuse
0 · Insightful Awesome LOL ·i check if the URL is my home page and if its home page then
line wise explanation
1.new discussion model
2. whereas option which we pass to Get method in DiscussionModel (i am displaying all discussions except a particular category categoryID)
3. get result from Get function in DiscussionModel which returns me recently posted 10 discussions which are not from particular CATEGORY and save its result in variable $discussions
4. create a new controller for discussionsController
5. i pass its DiscussionsData as result from my above DiscussionModel resultset
6. then i try to load view 'discussions'
7. render it - but the above error
Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·Thanks x00
Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·Please consider contributing this as a feature to the NillaBlog project. I suspect others may want this functionality as well.
If you don't know how to pull the code and submit a patch, try to come up with a working example plugin for your forum where you have it working and submit the working code as part of a ticket. I'll see if I can work it into the settings of the project so that others may benefit.
My addons: NillaBlog | Vanoogle
- Spam
- Abuse
0 · Insightful Awesome LOL ·Thanks
Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·e.g generally we set the number of discussions we can show on category page through Dashboard->Forum->Advanced
but suppose if it choose 50 there and if we try to display 50 posts in NillaBlog Category then the page is going to get very very long.
so is there anyway we can restrict the BLOG category page discussions count to only 10 or 15?????
Thanks
Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·My addons: NillaBlog | Vanoogle
- Spam
- Abuse
0 · Insightful Awesome LOL ·i have a hack to display images if a user attaches an image with the post. shall i pm to u?
Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·Likely there is better way to do this.
Don't PM about development, I'm not currently taking on clients.
grep is your friend.
- Spam
- Abuse
0 · Insightful Awesome LOL ·DisscussionModel_BeforeGet_HandlerYou should be able to set
$Sender->SQL->Limit($Limit, $Offset);over-riding the default.also wheres
You can use
if(strtolower($Sender->RequestMethod) != 'index') return;before that.Have a look a class.discussionmodel.php Get you see the BeforeGet event, you even have wheres event args
Don't PM about development, I'm not currently taking on clients.
grep is your friend.
- Spam
- Abuse
0 · Insightful Awesome LOL ·i restricted my home page to display only 10 latest posts which are not from my BLOG category using the hook in themes as below:
public function DiscussionsController_Render_Before($Sender) {$this->_AddButton($Sender, 'NewDiscussionModule');
$pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; }
if ($pageURL == 'MY HOME PAGE URL') {
$Offset = 0;
$Limit = 10;
$Whereas = array("CategoryID <>" => 'MY BLOG CATEGORY ID' );
$DiscussionModel = new DiscussionModel();
$Sender->DiscussionData = $DiscussionModel->Get($Offset, $Limit, $Whereas);
$CountDiscussions = count($DiscussionModel->Get($Offset, $Limit, $Whereas));
$Sender->Data('Discussions', $Sender->DiscussionData);
$Sender->SetData('CountDiscussions', $CountDiscussions);
/* ======= this was the code given by x00 =========
list($Page, $Limit) = OffsetLimit(10, 0);
$Discussions = $Sender->Data('Discussions');
$DiscussionsFiltered =array();
foreach($Discussions As $Discussion ){
if($Discussion->Category!=='articles'){
$DiscussionsFiltered[]=$Discussion;
}
}
$DiscussionsLeft = count($DiscussionsFiltered);
//$DiscussionsFiltered = new Gdn_DataSet($DiscussionsFiltered);
$Sender->DiscussionData =$DiscussionsFiltered;
$Sender->Data('Discussions',$DiscussionsFiltered);
===============================*/
}
}
Theme Charcha for great desktop and mobile experience! - drop me a message :)
- Spam
- Abuse
0 · Insightful Awesome LOL ·