How to Display a Close Button in the Footer Modal for Custom Files whose SkipHeaderFooter Value is True – Masino Sinaga
While waiting for the release of PHPMaker 2026 in the next few days, we will discuss a simple but powerful trick to display the Close button in the Footer section of the Bootstrap Modal Dialog which contains a Custom File whose Header and Footer are skipped in PHPMaker 2025.
As we all know, PHPMaker provides convenience for Web Developers who want to display web page content in a Modal Dialog window, simply by setting several properties of a HyperLink.
For those of you who don’t know what it is HyperLinkthis is a link on a web page that allows users to open a specific page. The syntax starts from the opening tag <a ... > and ends with a closing tag </a>.
So that you don’t get confused, let’s implement it in the project demo2025 provided by PHPMaker 2025.
First step, please open the project file with the PHPMaker 2025 application, then click Custom File named news.phpand add code to display this HyperLink from the section Content:
<a href="javascript:void(0);" data-caption='My Data' data-ew-action='modal' data-action='view' data-ajax='false' data-url='mydata' data-btn='null' data-bs-original-title='My Data'>Open My Data</a>
This code means that we will open a page with a URL mydata which is displayed in the Bootstrap Modal Dialog window, via a link with text Open My Data.
Second step, please create a new Custom File, with the following information:
- File Name: mydata.php
- Caption: My Data
- Include common files: (make sure it is active, or check it)
- Path: (leave it, aka left blank)
- In the Content section, enter the following code:
<?php
echo "<h3>Custom File with Include common files option</h3>";
$sql = "SELECT `Model` FROM `models`"; // define your SQL
$stmt = ExecuteQuery($sql); // execute the query
$value = ""; // initial value
if ($stmt->rowCount() > 0) { // check condition: if record count is greater than 0
while ($row = $stmt->fetchAssociative()) { // loop
$value .= $row["Model"] . "<br>"; // in case the result returns more than one record, display it and separated by line break
} // end loop
echo "Here is the Models list: <br>" . $value; // display the result
} else { // if there are no result
echo "No record found."; // display the message
} // end of check condition
?>
Fourth step, regenerate all script files as usual using PHPMaker 2025, then from the web application displayed in the browser, open the page Newsthen click the link Open My Data on that page. Next, you will see the Models data list displayed in the Modal Dialog window, and in the Footer section of the Modal Dialog window, you can see there is a button Close there.
Up to this point everything went smoothly and as expected. We can display the contents of a Custom File page via the Modal Dialog window.
One time, we wanted to skip the Header and Footer when displaying the named Custom File page mydata.php earlier. For that, there are two ways to do it.
The first way is simply to put a tick in the column No header/footer from the Custom File, via the Generate window in PHPMaker 2025.
The second way, simply add the following PHP code to the event server Page_Load from Custom Files mydata.php earlier:
global $SkipHeaderFooter;
$SkipHeaderFooter = true;
So, if we do this, then when the contents of the mydata page are displayed in the Modal Dialog window, we will not see the Close button in the Footer section of the Modal Dialog. Then the solution is how to display the Close button in the Footer section of the Modal Dialog window?
It’s very easy, brothers and sisters… we just need to add this little PHP code to the bottom of the mydata.php Custom Content File:
<?= (IsModal()) ? '<template class="ew-modal-buttons">' : '<div class="row ew-buttons">' ?><!-- buttons .row -->
<?= (IsModal()) ?
'<div class="ew-modal-buttons">
<button type="button" class="btn btn-default ew-btn" data-bs-dismiss="modal">Close</button>
</div>' : '' ?>
<?= (IsModal()) ? "</template>" : "</div>" ?><!-- /buttons .row -->
So, the complete content of the mydata.php Custom File above looks like this:
<?php
echo "<h3>Custom File with Include common files option</h3>";
$sql = "SELECT `Model` FROM `models`"; // define your SQL
$stmt = ExecuteQuery($sql); // execute the query
$value = ""; // initial value
if ($stmt->rowCount() > 0) { // check condition: if record count is greater than 0
while ($row = $stmt->fetchAssociative()) { // loop
$value .= $row["Model"] . "<br>"; // in case the result returns more than one record, display it and separated by line break
} // end loop
echo "Here is the Models list: <br>" . $value; // display the result
} else { // if there are no result
echo "No record found."; // display the message
} // end of check condition
?>
<?= (IsModal()) ? '<template class="ew-modal-buttons">' : '<div class="row ew-buttons">' ?><!-- buttons .row -->
<?= (IsModal()) ?
'<div class="ew-modal-buttons">
<button type="button" class="btn btn-default ew-btn" data-bs-dismiss="modal">Close</button>
</div>' : '' ?>
<?= (IsModal()) ? "</template>" : "</div>" ?><!-- /buttons .row -->
Finally, regenerate all script files as usual, then try opening the My Data page again from the News page, then now you will see the Close button in the Footer section of the Modal Dialog window.
How easy is that, right? And how neat the application framework used by PHPMaker is.
Berita Terkini
Berita Terbaru
Daftar Terbaru
News
Berita Terbaru
Flash News
RuangJP
Pemilu
Berita Terkini
Prediksi Bola
Togel Deposit Pulsa
Technology
Otomotif
Berita Terbaru
Daftar Judi Slot Online Terpercaya
Slot yang lagi gacor
Teknologi
Berita terkini
Berita Pemilu
Berita Teknologi
Hiburan
master Slote
Berita Terkini
Pendidikan
Resep
Jasa Backlink
One Piece Terbaru