View Full Version : Popup on cms homepage only
davidallsop
06-06-2011, 02:50 PM
Hi,
I wish to add a popup to only the cms index page and the forum home page.
Tried this by adding the code to forum home but obviously its included in most places so the popup then displays throughout.
Regards,
Try this:
<vb:if condition="THIS_SCRIPT == 'vbcms' OR THIS_SCRIPT == 'index'">
// popup code
</vb:if>
Brandon Sheley
06-06-2011, 02:57 PM
Have you tried using a condition or the CMS templates?
davidallsop
06-06-2011, 03:10 PM
That code doesn't work, that was upon adding to headinclude, it displays the popup on every forum page and doesn't display on the CMS.
Lynne
06-06-2011, 03:20 PM
Please post the *exact* code you have added along with a couple lines above and below the code so we can see what you did. We cannot help when we can't see your code and a link to the page/site.
davidallsop
06-06-2011, 03:25 PM
Ok, which template should this : -
<vb:if condition="THIS_SCRIPT == 'vbcms' OR THIS_SCRIPT == 'index'">
// popup code
</vb:if>
Be added to?
When I posted it it was a guess. Since then I tried it and it seems to work for the forums (I don't see why you'd get it on every forum - I only got it on the forum home page), but you might need another check in there to see it only on the CMS index page, which I don't know how to do offhand.
BTW I put it in headinclude after I read that's where you had it. I just used this:
<vb:if condition="THIS_SCRIPT == 'vbcms' OR THIS_SCRIPT == 'index'">
<script type="text/javascript">alert("Here");</script>
</vb:if>
Lynne
06-06-2011, 03:29 PM
You said you added it to the headinclude template. So, please post what you did and give us a link to see it.
davidallsop
06-06-2011, 03:52 PM
This has been placed above meta on headinclude, and yes it works just on the forum index, but not the cms home.
<vb:if condition="THIS_SCRIPT == 'vbcms' OR THIS_SCRIPT == 'index'">
<script type="text/javascript">alert("Here");</script>
</vb:if>
<meta http-equiv="Content-Type" content="text/html; charset={vb:stylevar charset}" />
<meta id="e_vb_meta_bburl" name="vb_meta_bburl" content="{vb:raw vboptions.bburl}" />
<base href="{vb:raw basepath}" /><!--[if IE]></base><![endif]-->
Unfortunately I can't post a link as I am running locally.
Lynne
06-06-2011, 04:06 PM
Is your CMS using a different style? If so, you need to make sure to add the code to the style being used on the CMS also.
davidallsop
06-06-2011, 04:14 PM
Yes it is, but the headinclude edited is for that style.
So it's not picking up that it's the CMS page.
Lynne
06-06-2011, 04:22 PM
Can we get a link to the site?
davidallsop
06-06-2011, 04:47 PM
Sorry as mentioned this is only on a dev server locally at the moment.
I'm pretty sure vbcms (e.g. content.php) doesn't include the code added to the header.
Is THIS_SCRIPT == 'vbcms' correct?
In the ACP under Settings -> Options -> General Settings there's "Add Template Name in HTML Comments", which will let you view the html source and see which templates are included. I have pretty much the default 4.1.3 install and the main page (content.php) includes the headinclude template. I suppose it's possible that yours doesn't for some reason. And like Lynne said, you can have a different one for each style so you could have edited a headinclude but not the right one.
In any case, content.php contains "define('THIS_SCRIPT', 'vbcms');", so the problem should be that your popup appears on every content.php page and not just the home page.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.