Global Keywords used as condiftions


(Keith Brown) #1

hi Folks


I have a nested asset to which I have applied a paint layout. If you use the global keyword in the paint layout (ie %globals_asset_metadata_myfield%) it prints out fine.



If you the go to the conditional keywords screen and setup:



Logical Keyword 0 'globals_asset_' and 'metadata_myfield' (to make the full keyword above) it never evaluates to true.



Any ideas?



K


(Ashish Karelia) #2

[quote]
hi Folks



I have a nested asset to which I have applied a paint layout. If you use the global keyword in the paint layout (ie %globals_asset_metadata_myfield%) it prints out fine.



If you the go to the conditional keywords screen and setup:



Logical Keyword 0 ‘globals_asset_’ and ‘metadata_myfield’ (to make the full keyword above) it never evaluates to true.



Any ideas?



K

[/quote]



Hi,

Whats the version of Matrix you are using? It could be Bug #5520 Paint Layout conditional keywords doesnt work as expected with “Condition Keyword Regexp”.



If it isn’t the above bug I can have a further look.





Ash


(Keith Brown) #3

[quote]
Hi,

Whats the version of Matrix you are using? It could be Bug #5520 Paint Layout conditional keywords doesnt work as expected with “Condition Keyword Regexp”.



If it isn’t the above bug I can have a further look.





Ash

[/quote]



4.6.0 - I’ll apply some upgrades in the next few days and post back if it still doesn’t work



Cheers



K


(Keith Brown) #4

[quote]


If it isn't the above bug I can have a further look.



Ash

[/quote]



Upgraded to 4.8.0 and the same behaviour is apparent.



K


(Ashish Karelia) #5

[quote]
Upgraded to 4.8.0 and the same behaviour is apparent.



K

[/quote]



Hmm interesting.

I just tried myself setting up a nested asset (nesting a "standard page #111") with "Using an arbitrary Paint Layout". This paint layout has the condition as mentioned by you and this seems to be evaluating correctly based on the Metadata value for "standard page #111".



Is you set up different to what I mentioned above?



Ash


(Keith Brown) #6

[quote]
Hmm interesting.

I just tried myself setting up a nested asset (nesting a "standard page #111") with "Using an arbitrary Paint Layout". This paint layout has the condition as mentioned by you and this seems to be evaluating correctly based on the Metadata value for "standard page #111".



Is you set up different to what I mentioned above?



Ash

[/quote]



…don't think so. I've tried it again with a reduced set (screen grabs and code below)



The nested asset in design:







The Conditional Keyword Setup:







The code on standard page format (did you just use 'default' by any chance? only thing I can think of…)


    %begin_hasResearchInterests%
    	 %globals_asset_metadata_research_interests%
    %else_hasResearchInterests%
    NOPE
    %end_hasResearchInterests%
    
    

%globals_asset_metadata_research_interests%



Results in:

[img]http://www.sps.ed.ac.uk/develop/Capture2.PNG[/img]

Completely stumped. :-S

K

(Ashish Karelia) #7

[quote]
Completely stumped. :-S



K

[/quote]



Okie I gave it another go. Set up exactly like whats yours. But still based on the metadata value the condition is being evaluated correctly. And I am using customised bodycopy for standard page on Paint Layout and not the default one.

Only thing I can think of we might be doing different is the Metadata field type. I am using the Select type.



Ash


(Palitsyn) #8

Can you try this:


%begin_globals_asset_metadata_research_interests%

%globals_asset_metadata_research_interests%

%else_globals_asset_metadata_research_interests%

NOPE

%end_globals_asset_metadata_research_interests%


(Keith Brown) #9

[quote]
Can you try this:



%begin_globals_asset_metadata_research_interests%

%globals_asset_metadata_research_interests%

%else_globals_asset_metadata_research_interests%

NOPE

%end_globals_asset_metadata_research_interests%

[/quote]



yip that works - but eh? so the keyword name (and the keywords generated from the name that appear corectly in the drop down) are ignored? I assume this is a bug so if I go ahead with this will it change post bugfix?



K


(Keith Brown) #10

…and and thanks anton - manners escaped me for a moment… :-S


K


(Palitsyn) #11

[quote]
…and and thanks anton - manners escaped me for a moment… :-S



K

[/quote]



I wouldn't say this is a bug. It's been around for at least 3 years :slight_smile: Always use this method to check if a field is empty or not.


(Keith Brown) #12

[quote]
I wouldn't say this is a bug. It's been around for at least 3 years :slight_smile: Always use this method to check if a field is empty or not.

[/quote]



…good to know. I guess while being able to use the field_name is a nice bonus - The bug is surely that using the condition name doesn't work? And that the "keyword replacements [that] will be available on the Edit Contents screen of the Bodycopy" (as per docs) don't work… who knows - its gone midnight here and my eyes have had enough of screens for today . thanks again



K


(Gjboyd7) #13

Is it possible to do conditionals within paint layouts on global keywords?  It always evaluates to false, for example:

 

<link rel="canonical" href="
%begin_canonical_exists%
  %globals_asset_metadata_Global.Canonical_asset_url%/%globals_asset_web_path%
%else_canonical_exists%
  %globals_asset_url%
%end_canonical_exists%">
 
Global.Canonical is a related asset field within the schema.
 
Very difficult to achieve simple conditionals makes things impossible!