View Full Version : vBCMS - Detect articles in section X
LOGECT
04-02-2012, 12:41 PM
Hello
I would like to use some different style/lang for my articles in section for example X than Y, so i need to separate them, the only way i find was the following code and the problem is that i have to writ the $_GET['r'] == x manually for every each article.
I believe that there should be a way to detect all articles in section X instant of writing the numbers manually.
Any help would be great.
Thank you
if (( $_GET['r'] == x OR $_GET['r'] == xx OR $_GET['r'] == xx) && (THIS_SCRIPT == 'vbcms'))
{
Do somthing
}
else
{
Do somthing
}
Dead Eddie
04-03-2012, 10:54 AM
$this->content->getSectionId();
$this->content->getParentId();
(array) $this->content->getParentIds();
Depending on your requirement, one of these, called from any of the vbcms_article_populate_* hooks, should get you what you're looking for.
LOGECT
04-03-2012, 08:42 PM
$this->content->getSectionId();
$this->content->getParentId();
(array) $this->content->getParentIds();
Depending on your requirement, one of these, called from any of the vbcms_article_populate_* hooks, should get you what you're looking for.
Thanks for your reply, it doesn't work for me, i'v also followed this thread at vb.com:
https://www.vbulletin.com/forum/showthread.php/348708-Get-CMS-section-in-plugin-code
Dead Eddie
04-03-2012, 08:47 PM
What specifically doesn't work? Can you post some sample code, along with which hook you're putting it in, what you expect to see, and what you're seeing?
LOGECT
04-03-2012, 08:55 PM
I have created a plugin with hook location vbcms_article_populate_end and this code:
global $sectionid;
$sectionid = $this->content->getParentId();
Then I have a plugin with hook location init_startup:
if ($sectionid == x)
{
...
}
else
{
...
}
I've also tried this (https://www.vbulletin.com/forum/showthread.php/348708-Get-CMS-section-in-plugin-code?p=1964219&viewfull=1#post1964219) with 2 plugins.
Dead Eddie
04-04-2012, 01:47 PM
Whoops! That's not going to work! init_startup is called a little to early. I'd wager $sectionid isn't available either.
I have an idea on how to do this...I'll take another quick look tonight.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.