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.


How to remove some information for only one page

Login / Search

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

Community saint

Currently, my "Recent galleries images" block looks like this:


As you can see, I'd like to eliminate the data in the box, but just from this main_multi_content block and not on the catalog listing page. Both are using the CATALOGUE_image_galleries_cc_embed.tpl. How would I remove these from just the front page of the site?

Thanks for any help.

Bob
Back to the top
 
Posted
Rating:
#76807
Avatar

Community saint

Well, I thought I had figured this out based on another post I found. Here is my code:

Code

{+START,IF,NOT,{$MATCH_KEY,:start}}
.....
{+END}

This removes the data I want from the front page but it also removes the data from the catalog listing page because both are using the same TPL (CATALOGUE_image_galleries_CC_ENTRY_EMBED.tpl). How can I remove this information from the "Start" page but leave it on the catalog listing page?

Thanks for any help.

Bob
Back to the top
 
Posted
Rating:
#76808
Avatar

MATCH_KEY_MATCH not MATCH_KEY


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#76809
Avatar

Community saint

Thanks for the tip, Chris, but it still does not work - the details are missing on the category listing page. Here is the current code:

Code

{+START,IF,NOT,{$MATCH_KEY_MATCH,:start}}
         {FIELDNAME_4}:&nbsp;{FIELD_4}<br />
         {FIELDNAME_5}:&nbsp;{FIELD_5}
{+END}

Did I just botch it somehow?

Thanks for any help.

Bob
Back to the top
 
Posted
Rating:
#76810
Avatar

{+START,IF,{$NOT,...}...{+END}


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#76812
Avatar

Community saint

Chris-

I tried the above - this is what I have in the code:

Code

{+START,IF,{$NOT,$MATCH_KEY_MATCH,:start}}
      {FIELDNAME_4}:&nbsp;{FIELD_4}<br />
      {FIELDNAME_5}:&nbsp;{FIELD_5}
{+END}

but now the data is shown again on the start page:


Do I need to provide a zone or something to make this work? I've read the match_key tutorial information but I just can't seem to make this work.

Thanks again for your help.

Bob
Back to the top
 
Posted
Rating:
#76814
Avatar

Community saint

Have you checked what value $MATCH_KEY_MATCH actually holds?

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#76816
Avatar

Community saint

temp1024 said

Have you checked what value $MATCH_KEY_MATCH actually holds?

How would I do that?

I basically started by copying what I found in this post:
View topic: page conditional content - ocPortal

Since that was stating how to restrict the display to just the start page, I needed to negate that. I stumbled through and Chris gave me clues but, apparently, clues only work for me when they bang me on the head.

So how do I check the value of $MATCH_KEY_MATCH?

Thanks for your help.

Bob
Back to the top
 
Posted
Rating:
#76817
Avatar

Community saint

BobS said

So how do I check the value of $MATCH_KEY_MATCH?
Anything starting with $ in templates is just a variable and can be echoed to the screen simply by reference it outside any conditional code. So in this case just place $MATCH_KEY_MATCH (or any other variable for that matter) before "{+START…" or after "…{+END} ".

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#76824
Avatar

Community saint

So, I tried that with the following result:


This is the code:

Code

{+START,IF,{$NOT,$MATCH_KEY_MATCH,:start}}
   {FIELDNAME_4}:&nbsp;{FIELD_4}<br />
   {FIELDNAME_5}:&nbsp;{FIELD_5}
{+END}
$MATCH_KEY_MATCH

So, what am I doing wrong?

Bob
Back to the top
 
Posted
Rating:
#76825
Avatar

Community saint

Woooops, my mistake. I assumed that this code snipped you posted:

Code

{+START,IF,{$NOT,$MATCH_KEY_MATCH,:start}}
      {FIELDNAME_4}:&nbsp;{FIELD_4}<br />
      {FIELDNAME_5}:&nbsp;{FIELD_5}
{+END}
was structurally correct and therefore I miss-read it which in-turn helped me miss-remember what variables looked like. I Your code should be like this:

Code

{+START,IF,{$NOT,{$MATCH_KEY_MATCH,:start}}}
      {FIELDNAME_4}:&nbsp;{FIELD_4}<br />
      {FIELDNAME_5}:&nbsp;{FIELD_5}
{+END}

Note the extra {} around $MATCH_KEY_MATCH,:start .

I know I've debugged variables in the past but they must have been in {bla} format.

Looks like my brain not work quite right at the moment.


Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#76830
Avatar

Good, that's it. Thanks temp1024. I probably should have thought though the code carefully at first, but then again, now the syntax has had a bit more opportunity for discussion.

So in full it works like…

Code

:start

This is just what you see, a bit of text.

Code

{$MATCH_KEY_MATCH,:start}

Now the text is being passed to a symbol. This symbol happens to return '_true' or '_false'.

Code

{$NOT,{$MATCH_KEY_MATCH,:start}}

'_true' becomes '_false' and '_false' becomes '_true'.

i.e. we've flipped things over to check the opposite.

Code

{+START,IF,{$NOT,$MATCH_KEY_MATCH,:start}}
...
{+END}

The 'IF' directive is looking for a '_true' before it will output its contents.

Tempcode can look complex, but essentially it is just chains of nested symbols that can be passed into a directive, or output directly.

If you literally put {$NOT,{$MATCH_KEY_MATCH,:start}} into the code without the directive you would see it literally outputting the '_true' or '_false' text.

Tempcode is essentially quite a sophisticated text filtering system. Symbols get text values or perform computations on them, and you nest them to make like a pipeline of checks, and then you can control text output flow with directives.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#76839
Avatar

Community saint

Chris Graham said

I probably should have thought though the code carefully at first, but then again, now the syntax has had a bit more opportunity for discussion.
What threw me, and I suspect you also, was that {$MATCH_KEY_MATCH,:start} was fine earlier, but then mysteriously became $MATCH_KEY_MATCH,:start and was not noticed.
Tempcode can look complex, but essentially it is just chains of nested symbols that can be passed into a directive, or output directly.
I actually find it quite difficult to read because it can get nested very deeply and we don't have a context sensitive editor that can watch our brace count for us or allow for easy formatting/alignment.

And it also doesn't help when there is no {$else} branch (not so subtle HINT Chris!)

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#76846
Avatar

Community saint

Thanks, temp. That worked perfectly.

One question: why did the value of $MATCH_KEY_MATCH not display. Did it need to be enclosed in braces?

Bob
Back to the top
 
Posted
Rating:
#76847
Avatar

Community saint

temp and Chris-

your discussion

my head


But I bookmarked this post because I think that  there maybe a shot that this will help me understand how this works.

Thanks to both of you for the help.

Bob
Back to the top
 
Posted
Rating:
#76857
Avatar

Community saint

BobS said

One question: why did the value of $MATCH_KEY_MATCH not display. Did it need to be enclosed in braces?
Because, contrary to my earlier silly claim, they are symbols as Chris pointed out (but you can think of them as functions).

Symbols need braces because they take 0 or more parameters, and the braces keep them together and more importantly to the code it helps identify a potential symbols vs just a value like $23.45 .

In the case of $MATCH_KEY_MATCH, the correct structure is {$MATCH_KEY_MATCH,arg}. If you were to use {$MATCH_KEY_MATCH} then the result/behaviour would be entirely up to the underlying code as to whether it returns say an error message or just an unexpected result (because it has insufficient information).

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#76866
Avatar

Community saint

temp-

Thanks for the explanation and your (and Chris's) patience. That actually all made sense to me so hopefully it will stick in the future. I've bookmarked the thread so I can refer back to it if only I remember.

Bob
Back to the top
 
Posted
Rating:
#76871
Avatar

I actually find it quite difficult to read because it can get nested very deeply and we don't have a context sensitive editor that can watch our brace count for us or allow for easy formatting/alignment.

My suggestion to you: Add to Tracker

And it also doesn't help when there is no {$else} branch (not so subtle HINT Chris!)

Ditto ;).


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: