idino Posted September 26, 2021 Share Posted September 26, 2021 Good morning, I created a section in a php page as shown in the image. The line marked with number 1 is generated by this code called today.php: <?php function myTab() { echo str_repeat(' ', 3); } function templateDay($start, $end) { $dayOfWeek = ['LUN', 'MAR', 'MER', 'GIO', 'VEN', 'SAB', 'DOM']; $toDay = date('N') - 1; for ($i = $start; $i < $end; $i++) { echo $dayOfWeek[$toDay] === $dayOfWeek[$i] ? "<a style='color:red'>" . 'OGGI' . '</a>' . myTab() : "" . $dayOfWeek[$i] . '</a>' . myTab(); } } templateDay(3, 7); templateDay(0, 3); ?> while line 2 gives this other: <div class="container section" id="afterHeader"> <div class="row"> <div class="tabs movies"> <a class="style1">1^ SETTIMANA</a> <p><?php require "./oggi.php";?></p> <ul> <li><a href="#thu">GIO</a></li> <li><a href="#fri">VEN</a></li> <li><a href="#sat">SAB</a></li> <li><a href="#sun">DOM</a></li> <li><a href="#mon">LUN</a></li> <li><a href="#tue">MAR</a></li> <li><a href="#wed">MER</a></li> </ul> I would need to replace row "2" with row "1" Who can help me? Thank you all Quote Link to comment https://forums.phpfreaks.com/topic/313813-integrate-some-code-into-another/ Share on other sites More sharing options...
ginerjm Posted September 26, 2021 Share Posted September 26, 2021 Have no idea what you want. Quote Link to comment https://forums.phpfreaks.com/topic/313813-integrate-some-code-into-another/#findComment-1590362 Share on other sites More sharing options...
jarvis Posted September 27, 2021 Share Posted September 27, 2021 It looks like row 1 is called within your code by this line: <p><?php require "./oggi.php";?></p> So just move that below the closing </ul> Like so: <div class="container section" id="afterHeader"> <div class="row"> <div class="tabs movies"> <a class="style1">1^ SETTIMANA</a> <ul> <li><a href="#thu">GIO</a></li> <li><a href="#fri">VEN</a></li> <li><a href="#sat">SAB</a></li> <li><a href="#sun">DOM</a></li> <li><a href="#mon">LUN</a></li> <li><a href="#tue">MAR</a></li> <li><a href="#wed">MER</a></li> </ul> <p><?php require "./oggi.php";?></p> That will then swap line 1 and 2 of your image over Quote Link to comment https://forums.phpfreaks.com/topic/313813-integrate-some-code-into-another/#findComment-1590375 Share on other sites More sharing options...
idino Posted September 27, 2021 Author Share Posted September 27, 2021 I try to explain myself better. http://www.progettolumiere.it/home.php This is example page I want to edit. I have to replace the line where the days of the week appear, with the code "oggi.php" The days of the week have a link that displays the schedule for that day (see example) I don't know how to make the page work the same way, replacing the code. Quote Link to comment https://forums.phpfreaks.com/topic/313813-integrate-some-code-into-another/#findComment-1590391 Share on other sites More sharing options...
Solution ginerjm Posted September 27, 2021 Solution Share Posted September 27, 2021 Show us what you mean. A lot of us do not click on random links.... Quote Link to comment https://forums.phpfreaks.com/topic/313813-integrate-some-code-into-another/#findComment-1590393 Share on other sites More sharing options...
ginerjm Posted September 27, 2021 Share Posted September 27, 2021 How did I provide the solution please? I'm sure you meant to give someone else the credit. I didn't even understand what you want to do! Quote Link to comment https://forums.phpfreaks.com/topic/313813-integrate-some-code-into-another/#findComment-1590402 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.