vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Code to show a template on only the front page (https://vborg.vbsupport.ru/showthread.php?t=316517)

HM666 01-08-2015 10:46 PM

Code to show a template on only the front page
 
I need to know how to have a custom template only show on the front page of the CMS. I have installed a custom slider on my vB 4.2.2 CMS using the widget system. The widget that I'm using has a custom template powering it. I need to know how to show that slider only on the front page of my CMS. Right now obviously it shows on all the CMS pages. :(

Link: http://lenmkaiser.com/vb/vb4/content.php

bridge2heyday 01-08-2015 11:43 PM

You Can Try
Code:

<vb:if condition="$nodeid == 1"> </vb:if>
OR
Code:

<vb:if condition="(THIS_SCRIPT == 'vbcms'  AND !$_GET['r'])"></vb:if>

HM666 01-09-2015 12:01 AM

Quote:

Originally Posted by bridge2heyday (Post 2531382)
You Can Try
Code:

<vb:if condition="$nodeid == 1"> </vb:if>
OR
Code:

<vb:if condition="(THIS_SCRIPT == 'vbcms'  AND !$_GET['r'])"></vb:if>

Thanks! EDIT: The second code worked.

bridge2heyday 01-09-2015 12:06 AM

Quote:

Originally Posted by HM666 (Post 2531386)
Thanks! So on the first one if I changed the nodeid to whatever nodeid a particular page is i can have the widget show on just that page?

Yes , it should appear in this node only .. if you want to show in multiple nodes you can use
Code:

<vb:if condition="in_array($nodeid,array(1, 2, 3))">

HM666 01-09-2015 01:59 AM

I tried that and it did not show up. How do you find what the node id is? I thought it was the id of the link in the Navigation Manager but that did not work either. I tried it with nodeid of 1 and tried it with nodeid of 8 because the Navigation Menu had the id of the tab as 8.

HM666 02-02-2015 11:59 PM

Anyone know why this first code does not work on a particular page?

Code:

<vb:if condition="$nodeid == 1"> </vb:if>
I have tried several different ID numbers to replace the 1 but nothing works and it is not showing on the page. Where do I find the nodeid of a page? Is it the number that shows in the friendly URL? Or is it the tab number? I've tried both in that space and neither work in that code above.

John Lester 02-03-2015 07:45 AM

Try this for the CMS home page:

Code:

{vb:raw $vbulletin->parentnode}


The page at the end of the post says the node id is the number after the 'r='
Code:

content.php?r=116-my-phpcontent.php/116-my-php
http://www.estetica-design-forum.com...Bulliten-4-CMS

HM666 02-05-2015 11:28 PM

Quote:

Originally Posted by John Lester (Post 2535856)
Try this for the CMS home page:

Code:

{vb:raw $vbulletin->parentnode}


The page at the end of the post says the node id is the number after the 'r='
Code:

content.php?r=116-my-phpcontent.php/116-my-php
http://www.estetica-design-forum.com...Bulliten-4-CMS

Ok I do not want it to show on the home page though. I want it to show on the nodeid page 114 only and no where else, what code do I use for that? I've tried all the code above and variations of those and nothing has worked. I've made a slider widget and I want it to only show on one page. The code for the template of the widget is:

Code:

<vb:if condition="(THIS_SCRIPT == 'vbcms'  AND !$_GET['r'])"><div class="cms_slider">{vb:raw static_html}</div></vb:if>
That code will show it only on the front page, but I want to move it to show only on the nodeid page of 114. How do I do that?

John Lester 02-06-2015 06:25 PM

Have you tried?

Code:

<vb:if condition="(THIS_SCRIPT == 'vbcms'  AND !$_GET['r=114'])"><div class="cms_slider">{vb:raw static_html}</div></vb:if>

HM666 02-07-2015 06:11 AM

Quote:

Originally Posted by John Lester (Post 2536473)
Have you tried?

Code:

<vb:if condition="(THIS_SCRIPT == 'vbcms'  AND !$_GET['r=114'])"><div class="cms_slider">{vb:raw static_html}</div></vb:if>

Yes and that shows it on the correct page but it also shows it on the home page (front page) as well though. I'd rather take it off the front page.

John Lester 02-07-2015 06:50 AM

Ok I'm not great with code, so these ideas will need some polish :D

Have you tried using double ='s ... r==114? What about another AND clause that blocks it from parentnode?

If an AND clause won't work, perhaps a vbelse? E.G. <vb :else>if r=parentnode don't display </ vb:else>

I haven't actually looked at vBulletin code in awhile, I'm struggling with my "advanced" programming class and visual basic :o

HM666 02-07-2015 08:05 PM

Tried the double = signs that did not work either. As for the other I do not know how to do that. I'm not a PHP programmer I code HTML & CSS and that is the extent of it. So I do not know a lot about the PHP codes. I know some but not enough to be able to create code from scratch.

kh99 02-07-2015 08:35 PM

I don't know if that code is the right way to do it or not, but I think you'd want this:
Code:

<vb:if condition="(THIS_SCRIPT == 'vbcms')  AND ($_GET['r'] != 114)"><div class="cms_slider">{vb:raw static_html}</div></vb:if>

HM666 02-07-2015 08:45 PM

Quote:

Originally Posted by kh99 (Post 2536601)
I don't know if that code is the right way to do it or not, but I think you'd want this:
Code:

<vb:if condition="(THIS_SCRIPT == 'vbcms')  AND ($_GET['r'] != 114)"><div class="cms_slider">{vb:raw static_html}</div></vb:if>

That only shows on the front page. I want it to only show on the 114 page. :(

kh99 02-07-2015 08:46 PM

OK, try changing it to $_GET['r'] == 114 . But like I said, I don't know if that's the way to do it, I'm just trying to fix the posted code, because I don't think $_GET['r==114'] was right.

John Lester 02-08-2015 01:03 AM

If that doesn't work then a shot in the dark here might :D

before the AND in the previous code from kh99 ...
Code:

AND ($_GET['r'] != parentnode)
So full code would be:
Code:

<vb:if condition="(THIS_SCRIPT == 'vbcms') AND ($_GET['r'] != parentnode)  AND ($_GET['r'] != 114)"><div class="cms_slider">{vb:raw static_html}</div></vb:if>

HM666 02-08-2015 07:59 AM

Thanks but that only shows on the front page too. :( on both of those. :(

Dead Eddie 02-08-2015 10:44 AM

Code:

<vb:if condition="$_GET['r']==114"></vb:if>

John Lester 02-08-2015 05:43 PM

Quote:

Originally Posted by Dead Eddie (Post 2536630)
Code:

<vb:if condition="$_GET['r']==114"></vb:if>

Yea I can see that working since it's not referring to "this script".

HM666 02-09-2015 12:57 AM

Quote:

Originally Posted by Dead Eddie (Post 2536630)
Code:

<vb:if condition="$_GET['r']==114"></vb:if>

YAY! All hail Dead Eddie! Thanks that worked :)

Dead Eddie 02-09-2015 01:30 AM

Glad it worked for you.


All times are GMT. The time now is 10:19 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01157 seconds
  • Memory Usage 1,767KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (20)bbcode_code_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (21)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete