View Full Version : CMS conditional ?
Adam H
10-16-2010, 10:52 AM
Hi, Im trying to only display a peace of code at the bottom of the navbar template on the cms , but i want it to only display on the CMS homepage , not the internal cms pages.
Ive tried THIS SCRIPT conditional but that shows across the entire CMS and not the individual page.
Ive also tried the page title conditional but that doesnt seem to work either .
Any ideas ?
Lynne
10-16-2010, 02:37 PM
If I recall, you can use the variable $_GET['r'] to write that sort of conditional.
Adam H
10-16-2010, 02:46 PM
Ok , How would that be written as an example ?
Lynne
10-16-2010, 03:01 PM
<vb:if condition="$_GET['r'] == '1-Index'">hello3</vb:if>
Adam H
10-16-2010, 03:15 PM
<vb:if condition="$_GET['r'] == '1-Index'">hello3</vb:if>
:( , i was sooooo hoping that was going to work , Unfortunatly it didnt . Any other idea's ?
I double checked that my cms was still set on 1-index and it is so i cant see why it wouldnt work
Lynne
10-16-2010, 06:06 PM
Well, if yours is set to 1-index, then you need to use that instead of 1-Index. It's a string - you need to be exact.
And if you continue to have problems, you need to post *exactly* waht you have done - what template, exactly where in the template, and a link to your page, etc.
Adam H
10-16-2010, 07:19 PM
Sorry i meant it was exactly like the one you had put in, ive just tried it on a fresh vbulletin install too and it doesnt work on that either ?
Lynne
10-16-2010, 09:39 PM
And I just got done telling you you can't use exactly what I wrote and why. I also gave you advice and what to tell us if you want more help.
That code works just fine on my 4.0.7 site although my home page is not called "index" thus I changed that part.
Adam H
10-16-2010, 09:43 PM
And I just got done telling you you can't use exactly what I wrote and why. I also gave you advice and what to tell us if you want more help.
Sorry didnt see that , Ive installed a new version of vbulletin on a test domain quickly to see if it works on a fresh install , Ive then just tried the code you gave me in the Navbar template just above this line :
<vb:if condition="$show['notices'] AND THIS_SCRIPT != 'register'">
.
Lynne
10-16-2010, 09:49 PM
You *cannot* use the code I gave you exactly as I wrote it. You need to change the string to be the string needed for your site. Like on my test site, I had to use "1-the-front-page" because that is what my homepage is called.
Adam H
10-16-2010, 09:56 PM
You *cannot* use the code I gave you exactly as I wrote it. You need to change the string to be the string needed for your site. Like on my test site, I had to use "1-the-front-page" because that is what my homepage is called.
But i thought that as default mine is 1-Index ?
If i look in the VB options - content management - default page - which is 1-Index
Lynne
10-16-2010, 10:45 PM
That is not where it gets $_GET['r'] (see the url when you click to go to that section). It has to do with the section name. When you edit your section, it will say what the real value is.
Adam H
10-16-2010, 10:55 PM
Yes , its the same , i put everything basic like that on the test board so that i could test it was right .
So the home page is for example :
1-home
The default CMS name in the option is also 1-home
The code im using is :
<vb:if condition="$_GET['r'] == '1-home'">hello3</vb:if>
Its in the navbar template. I cant see why its not working . Ive cleared all cache and disabled content caching to see if it was a cache issue but its not .
So is that exact code working on your test board ?
Lynne
10-17-2010, 12:23 AM
How about a link to see this?
And no, that isn't the exact code I use. I have a different name for my home page.
Try this instead:
<vb:if condition="THIS_SCRIPT == 'vbcms' AND ($_GET['r'] == '1-home' OR !$_GET['r'])">hello3</vb:if>
Adam H
10-17-2010, 12:35 AM
How about a link to see this?
And no, that isn't the exact code I use. I have a different name for my home page.
Try this instead:
<vb:if condition="THIS_SCRIPT == 'vbcms' AND ($_GET['r'] == '1-home' OR !$_GET['r'])">hello3</vb:if>
Lynne, You are truly amazing :D , Yet again I owe you a beer :)..............or wine .
Thanks alot that one worked perfectly .
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.