Jump to content
TNG Community

How do I make a mod conditional?


Michael Schmidt

Recommended Posts

Michael Schmidt

Hi,

so far I´ve learned to do it so far:

%parameter:$marriagelmhide:true%
%desc:Hide Marriage LastModified? <br /><i style="color: blue;">true</i>/false: Defaults to (true)%

 

%target:getperson.php%
%location:%
$persontext .= showEvent( array( "text"=>$text['lastmodified'], "fact"=>$row['changedate'] ) );
%end:%
%replace:%
//Person -hide Last Modified 
($marriagelmhide == 'true' ? $persontext .= showEvent( array( "text"=>$text['lastmodified'], "fact"=>$row['changedate'] ) ) );
%end:%

 

Can I do sth. like "replace ONLY if $marriagelmhide, or do I have to do an if-switch within the code?

...besides, is there a better solution than to crudely "replace" the $persontext. "Replace" might come back to haunt me, so I don´t like it :-)

Bye

Michael

Link to comment
Share on other sites

It may take some study and practice, but if you're on TNG12+,  conditional Mod Mgr tags were introduced which may help achieve what you want.  I have not needed them thus far.  In this article of the TNG Wiki, Mod_Manager_Enhancements_TNG_v12,  check the section on Conditional Processing Tags.

 

Link to comment
Share on other sites

On 3/6/2020 at 6:03 AM, Michael Schmidt said:

Can I do sth. like "replace ONLY if $marriagelmhide, or do I have to do an if-switch within the code?

The Mod Manager conditional tags like %textexists: for example,  apply to installing the mod against the code so that a mod might install on 2 different versions of a module when the code changed from one TNG version to the next.  The Mod Manager conditionals are not designed to provide two different execution paths in the code.  If you need conditional processing in the code you will need to provide the code to accomplish that.

I have used the Mod Manager conditionals to provide different install instructions as a way to resolve conflicts between two mods.  Not sure the Mod Manager conditionals will provide what you are looking for.

 

Link to comment
Share on other sites

Michael Schmidt

@tngrlkrz: thank you, I had somehow missed that page until now!

@Ken Roy..but you are right - these conditionals are not the conditionals I seek...

But I´ll manage with %parameter:$personlmhide:true% and $personlmhide = true;
if ($personlmhide != true ? ...

Sooner or later I´ll post a mod to the wiki.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...