Quick Tempcode Question

Post

Posted
Rating:
#3318 (In Topic #618)
Joe
Avatar
Standard member
Joe is in the usergroup ‘Honoured member’
I'm trying to add some content to the footer of GLOBAL_HTML_WRAP.tpl that I only want to be visible if the user is currently viewing a specified page. Is there some sort of tempcode string I can enclose the content in and only display it if the user is viewing said page?

So for example. {+START,IF,{$CURRENT_PAGE} == zone:page} SOME CONTENT HERE {+END}
Online now: No Back to the top

Post

Posted
Rating:
#3319
Joe
Avatar
Standard member
Joe is in the usergroup ‘Honoured member’
Let me elaborate a little, sorry:

I've implemented a site-tutorial system using Javascript. So when the user visits a certain page, the JS function is called and overlays pop up on the screen showing the user what each area of the site does. Problem is, I'm calling this function via the Comcode page I want it to show on, and due to limitations I cannot show overlays beneath the location of where I'm calling the script (currently in a Comcode page). I want to be able to add overlays in the footer to explain to users how to use the features located in these areas.

I can't call the JS function in GLOBAL_HTML_WRAP.tpl because then it will show on every page in every zone - I just want to display this Javascript functionality when a user visits a single page.
Online now: No Back to the top

Post

Posted
Rating:
Item has a rating of 5 (Liked by Chris Graham)
#3320
Avatar
Standard member
Jason Verhagen is in the usergroup ‘Community saint’
Try something like this:

{+START,IF,{$EQ,{$PAGE},comcode_page_name}} SOME CONTENT HERE {+END}

If you need to also restrict it by zone, then something like this:

{+START,IF,{$AND,{$EQ,{$ZONE},zone_name},{$EQ,{$PAGE},comcode_page_name}}} SOME CONTENT HERE {+END}

Just replace zone_name and comcode_page_name with the name of the zone and page you want to match. 

Note: This was not tested. I think I got the syntax right and all the symbols, brackets, and commas placed correctly. 

Tip: If you aren't sure about what to use for zone_name or comcode_page_name, just put the {$ZONE} and {$PAGE} tempcode symbols somewhere in your comcode page or footer temporarily so you can see what the zone and page names are.

Regards,
Jason


My ocPortal Sites: Holleywood Studio / Tech Fusion Online
My Composr Sites: NEWBotics Labs
Online now: No Back to the top

Post

Posted
Rating:
Item has a rating of 5 (Liked by Jason Verhagen)
#3321
Joe
Avatar
Standard member
Joe is in the usergroup ‘Honoured member’
Jason, you're a genius Sir!

It works wonderfully, thanks!  :thumbs:
Online now: No Back to the top
1 guest and 0 members have just viewed this.

Statistics

Users online:

deepu_ms, ManojSree, Vaiva, Philip, gabriel58, MVLipwig, mytracker, babu, Salman

Forum statistics:
  • 1,071 topics, 5,166 posts, 6,018 members
  • Our newest member is graffitienz
Birthdays:
Back to Top