HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Hiding a side panel on certain pages

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#105064 (In Topic #20490)
Avatar

Well-settled

Greetings,

I'm needing to prevent displaying my Site Zone right side panel from all except its start page. Please can anyone spell out for me the correct general Tempcode syntax for a page-specific directive, as I can't deduce this from the Tempcode Programming tutorial's listed symbols descriptions. 

Specifically I'm unclear how to stipulate the identity of a page in such a directive. For example, if I wanted to prevent displaying the panel on a page whose URL were http://mydomain/site/pg/site/pg/catalogues/category/index.php?catalogue_name=reflib , what would be the appropriate directive to insert? (Obviously, it would begin {+START,IF,{$NOT{  - but what would the remainder of the directive be?)

Thanks for reading - please can you help?

Back to the top
 
Posted
Rating:
#105065
Avatar

Community saint

If you only want the right side panel to display on the main start page, you could put this as the very first line in the right side panel:

{+START,IF,{$EQ,{$PAGE},start}}

and be sure to put {+END} at the very end of the panel.

That should allow the panel to display on the start page and prevent the panel from displaying on all other pages. If the panel disappears from all pages, then start isn't the correct page reference in the tempcode listed above. If start isn't the correct page reference, you can add {$PAGE} to the very top of the panel. Then save it and go to the page you want the panel displayed on to see what the correct page reference is. 
Back to the top
 
Posted
Rating:
#105067
Avatar

Well-settled

Hi Jason!

Excellent! - that not only solves my particular need, but also the syntax question that was preventing me from solving it. First, I'd  forgotten that the need to state "=" in Tempcode is met by $EQ, and secondly, had been trying to achieve the equating by declaring the page address in the incorrect context ie,. {$PAGE,start}. Your own provided directive actually makes explicit a basic principle of the logic governing Tempcode syntax that I hadn't yet quite grasped, and which I'm sure will increase my skill when needing to create other directives in future. Very many thanks for your help!

Your tip about using {$PAGE} is really useful too. I wonder, though, if you happen to know if it's possible to point a page-specific directive to a deeper level than that of a module entry-point (e.g. catalogues, downloads), as, say in my post's example - and if so, what the syntax would be for that? On the basis of my unsuccessful attempt using match-key syntax thus - {+START,IF,{$NEQ,{$PAGE},catalogues:ref_lib}} ...{+END} , it evidently doesn't use that! Currently this isn't a question of practical importance, btw, but merely one of interest as regards trying to improve my grasp of Tempcode generally. (I'd some day really love to write a supplementary tutorial to Chris' devoted to providing lots of actual working examples. Tempcode is such a fabulous tool to have available, but the leanness of the accompanying documentation leaves much of it in the realm of geek-speak for now.)

Many thanks again, Jason, and kind regards,

Richard.

Back to the top
 
Posted
Item has a rating of 5 (Liked by RichT)  
Rating:
#105086
Avatar

Community saint

I don't have anything specifically tested for this, but I think you could use {$MATCH_KEY_MATCH} instead of {$PAGE} if you want to do page-specific deeper level page matching. This link might help with the match-key syntax: http://ocportal.com/docs9/tut_menus.htm?keep_refreshed_once=1#title__10

Something like:

  {+START,IF,{$NOT,{$MATCH_KEY_MATCH,site:catalogues:ref_lib}}} ...{+END}

That would display the content within {+START}...{+END} if the current URL doesn't match site:catalogues:ref_lib ocPortal page (assuming site:catalogues:ref_lib is a correct and valid match-key page definition).
Back to the top
 
Posted
Rating:
#105305
Avatar

Well-settled

Hi Jason,

Thanks so much for your last post - and I really do apologize for my long delay in replying!

Yes, indeed - using MATCH_KEY_MATCH does the job. The match key you suggested, turns out not to be valid, and I've had to settle for site:catalogues:type=entry - which isn't ideal, as I was hoping to confine the match to just the one catalogue (reflib) rather than the whole lot. But I can't find any way to do that (appending id=x to specify a category would seem promising, but doesn't deliver.) Fact is, I really don't know what the limits are on how finely-grained match-keys can be pointed, especially as regards the catalogues module. I'll keep trying - but if you have any insights you'd be willing to share on that question, I'd be really delighted!

Many thanks again, and kind regards,

Richard
Back to the top
 
Posted
Rating:
#105356
Avatar

Community saint

You've run into the same problem I had when testing this out. Either the match key doesn't do certain matches or the syntax is incorrect. When I have time, I'll poke around in the code to see what it's doing.

In the previous code I provided, I had ref_lib. In your first post I see the URL refers to reflib. Instead of the previous code with ref_lib, did you also try it with reflib:

{+START,IF,{$NOT,{$MATCH_KEY_MATCH,site:catalogues:reflib}}} …{+END}

I thought I tested it and it worked with my links catalogue using site:catalogues:links as the match key. But trying to do a match key for specific categories within the catalogue is where I had problems.
Back to the top
 
Posted
Rating:
#105419
Avatar

Well-settled

Hi Jason,

Belated thanks for that, and especially for testing your suggestion. Since you report its syntax's success in the case of "links", I'm surprised the same (and alternatives like contacts or reflib) isn't working for me, but no worry, really. Displaying the right panel on any of my catalogue entry pages isn't necessary anyway, so I'm content with applying site:catalogues:type=entry as the match and suppressing its display everywhere.

Thanks too for pointing out the "ref_lib" vs "reflib" mistake - purely a typo on my part when composing my post, and not the cause of my impasse, I'm relieved to tell you!

Truly appreciative of all your help, Jason,

Kind regards,

Richard
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: