skip to Main Content

I have multiple HTML file.
I want to display this file content in modal box base on condition.
I do not want to use iframe and javascript or jquery.
So It is possible from php side only?

Example:

<div class="modal  fade bd-example-modal-lg shopify-onload-popup" id="defaultPopup-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered  modal-lg" role="document">
        <div class="modal-content">
            <?php
            if ($variable == 1) {
                ?>
                <!-- Loade file1.html -->
                <?php
            } else {
                ?>
                <!-- Loade file2.html -->
                <?php
            }
            ?>
        </div>
    </div>
</div>

2

Answers


  1. Why an html template? Include a php page instead of html with include

    <?php if ($variable == 1) {
               include ('includes/content-one.php');
            } else {
               include ('includes/content-two.php');
            }
            ?>
    
    Login or Signup to reply.
  2. you can use PHP include function like this

      <?php
           if ($variable == 1) {
               include "file1.php";
           } else {
               include "file2.php";
           }
       ?>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search