Jump to content

Record list with single column using if statements


This topic is 5000 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Filemaker PHP site assistant generates recordlist.php ...

<?php echo getSortRecordsLink('Name', 'Name')?>

<?php echo getSortRecordsLink('Website', 'Website')?>

<?php echo getSortRecordsLink('Email', 'Email')?>

I want a single column with the name linked to the website, but if no website exists, linked to the email, and if no email, just the name.

The old CDML code was-

[FMP-IF: field:Website.cn.http]

[FMP-FIELD: Name][FMP-ELSE][FMP-IF: field:Email.cn.@]

[FMP-FIELD: Name][FMP-ELSE][FMP-FIELD: Name][/FMP-IF][/FMP-IF]

Does anyone have suggestions or a sample php file that does something like this? I don't want to use calculations within Filemaker. Thanks for any help.

Link to comment
Share on other sites

This may be clunky, but it appears to work. Suggestions for improving it are welcome.

<?php 

             if  (nl2br( $record->getField('Instructor website', 0) )  != "" )

              {  

              echo "

href="" . nl2br( $record->getField('Instructor website', 0) ) . "">" . nl2br( $record->getField('Instructor', 0) ) . "" ;

            } 

             elseif  (nl2br( $record->getField('Instructor email', 0) )  == "" )

            {

              echo nl2br( $record->getField('Instructor', 0) ) ;

             } 

             else  {  

              echo "

href="mailto:" . nl2br( $record->getField('Instructor email', 0) ) . "">" . nl2br( $record->getField('Instructor', 0) ) . "" ;

            } ?>   

Link to comment
Share on other sites

This topic is 5000 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.