I'd like to show some text on specific (arrays of) articles (content id). What would the template conditional be for that?
Announcement
Collapse
No announcement yet.
Conditional for specific article
Collapse
X
-
You'd have to see if the nodeid is exposed where you want to use it. Since you can't use conditionals within content itself, you'd need to make the change to the template. If you want to do it in a Widget, you'd most likely need additional PHP coding.
so the conditional would be something like:
<vb:if condition="$nodeid ==XX">do stuff</vb:if>
Not sure what the specific variable array is though. You'd have to see what variables are exposed where you want to use the conditional at.Translations provided by Google.
Wayne Luke
The Rabid Badger - a vBulletin Cloud demonstration site.
vBulletin 5 API
-
Originally posted by Wayne Luke View PostYou'd have to see if the nodeid is exposed where you want to use it. Since you can't use conditionals within content itself, you'd need to make the change to the template. If you want to do it in a Widget, you'd most likely need additional PHP coding.
so the conditional would be something like:
<vb:if condition="$nodeid ==XX">do stuff</vb:if>
Not sure what the specific variable array is though. You'd have to see what variables are exposed where you want to use the conditional at.
The conditional does not seem work in the navbar template, though, or vbcms_page.Last edited by malmazan; Tue 3 Jan '12, 3:12am.Vote for these issues:
Comment
-
Originally posted by malmazan View PostSpecifically i want to use it in the navbar. I use some CMS sections in the navbar and i want to make it obvious visually if the user is in one of those sections like it would happen with forums, blogs or general CMS. And I guess one would find other uses too, like loading special css styles for specific pages.
The conditional does not seem work in the navbar template, though, or vbcms_page.Translations provided by Google.
Wayne Luke
The Rabid Badger - a vBulletin Cloud demonstration site.
vBulletin 5 API
Comment
-
Originally posted by Wayne Luke View PostYou'll probably need a plugin. Should look at the plugin that draws the navbar elements in the CMS already.
Yeah, I said it wouldn't work without digging through the code to find the exact variable specific to the location you want to use it in.
<vb:if condition="$vbulletin->nodeid == XX">
does work (at least for navbar and vbcms_page)Vote for these issues:
Comment
-
Originally posted by malmazan View Post<vb:if condition="$vbulletin->nodeid == XX">
does work (at least for navbar and vbcms_page)
Originally posted by malmazan View PostSpecifically i want to use it in the navbar. I use some CMS sections in the navbar and i want to make it obvious visually if the user is in one of those sections like it would happen with forums, blogs or general CMS. And I guess one would find other uses too, like loading special css styles for specific pages.
The conditional does not seem work in the navbar template, though, or vbcms_page.
Comment
-
Maybe you already have this figured out, but adding AND !in_array($vbulletin->nodeid, array(XX, XX, XX)) to the condition in the plugin called Navbar: Insert CMS Navbar Entry did the trick for me so the home tab isn't selected at the same time as the other new tabs I created.
Comment
-
Originally posted by Travis-Mc View PostIf you're using a CMS section in the main Nav bar, then I think you'll need to use either the $vbulletin->nodeid == XX or $vbulletin->parentnode == XX in your condition to make the navbar "selected"
I have commented out the Home tab myself.
My verbose conditional for section 3 and articles in section 3:
Code:<vb:if condition="$vbulletin->parentnode == 3 OR $vbulletin->nodeid == 3">
Vote for these issues:
Comment
-
Parentnode aplies to articles within a section, plus sub-sections of that section themselves. However, it does not apply to articles in sub-sections on that section.
Here i combined an array of sections (actually, a section -#2- a four sub-sections) with a popup menu so that articles in the sub-sections mark the tab as selected:
Code:<li class="popupmenu<vb:if condition="in_array($vbulletin->parentnode, array(2,4,5,6,7)) OR $vbulletin->nodeid == 2"> selected</vb:if>
Vote for these issues:
Comment
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Comment