I want to merge two different html files into one,
html1.html
<html>
<head>
<link href="blah.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 id="logo">
<span class="test1">Test text</span>
</h1>
</body>
</html>
html2.html
<html>
<head>
<script src="blah.js"></script>
</head>
<body>
<h1 id="logo">
<span>Test text</span>
<div class="test2">teststetset</div>
</h1>
</body>
</html>
I want to take these two files and make a master file that would look like this:
<html>
<head>
<link href="blah.css" rel="stylesheet" type="text/css" />
<script src="blah.js"></script>
</head>
<body>
<span class="test1">Test text</span>
<div class="test2">teststetset</div>
</body>
</html>
I want to know is this possible using php or any library or using Linux command?
Related
I have html page like this:
<head>
<link rel="stylesheet" href="assets/css/global.css">
</head>
<body>
<script src="assets/js/script.js?1617644081"></script>
</body>
How can I replace it to be like this:
<head>
<link rel="stylesheet" href="https://example.com/assets/css/global.css">
</head>
<body>
<script src="https://example.com/assets/js/script.js?1617644081"></script>
</body>
Numbers after assets/js/script.js? change every refresh.
Simply, Using heredoc and str_replace :
<?php
$html = <<<HTML
<head>
<link rel="stylesheet" href="assets/css/global.css">
</head>
<body>
<script src="assets/js/script.js?1617644081"></script>
</body>
HTML;
$html = str_replace('assets/', 'https://example.com/assets/', $html);
echo $html;
/* Output:
<head>
<link rel="stylesheet" href="https://example.com/assets/css/global.css">
</head>
<body>
<script src="https://example.com/assets/js/script.js?1617644081"></script>
</body>
*/
?>
I have an HTML file with HTML code. How can I change from the HTML file to a PHP file?
The following is the HTML code:
<html>
<head>
<title>Instascan – Demo</title>
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/webrtc-adapter/3.3.3/adapter.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.10/vue.min.js"></script>
<script type="text/javascript" src="https://rawgit.com/schmich/instascan-builds/master/instascan.min.js"></script>
</head>
<body>
<div id="app">
<div class="sidebar">
<section class="scans">
<h2>Scans</h2>
<ul v-if="scans.length === 0">
<li class="empty">No scans yet</li>
</ul>
<transition-group name="scans" tag="ul">
<li v-for="scan in scans" :key="scan.date" :title="scan.content">{{ scan.content }}</li>
</transition-group>
</section>
</div>
<div class="preview-container">
<video id="preview"></video>
</div>
</div>
<script type="text/javascript" src="app.js"></script>
</body>
</html>
Change your HTML file extension. For example, index.html will be index.php.
Just change file extension .html to .php (index.html to index.php).
If you want to add any PHP code, you have to use the <?php and ?> tags.
In your case, just change the extension of your filename. Example: yourfilename.html to yourfilename.php.
I have a problem with including a php file
PagePrevie.php :
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" href="Style/css/bootstrap.min.css" />
<script src="Style/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="Style/css/Header-Picture.css">
<link rel="stylesheet" href="Style/css/Footer-with-logo.css">
<title></title>
</head>
<body class="container lg-warning">
<?php
include 'include/LogoUMBB.php';
include 'include/Header.php';
?>
<div class="container bg-success text-primary" style="width:500px;padding: 20px;">
</div>
<br />
<?php
include 'include/Footer.php';
?>
</body>
</html>
The problem is that this file is located in a directory that contains other web page with the same code
And here is the structure of files:
PHP told you your path is incorrect, add "../" so you get correct include path.
include '../include/LogoUMBB.php';
include '../include/Header.php';
include '../include/Footer.php';
I'm learning PHP / HTML / CSS. Today I want use Bootsrap.
I use a basic HTML5 template called index.php In this file I want include a footer like this:
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="ressources/bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="ressources/css/style.css">
<script type='text/javascript' src="ressources/script/jquery.js"></script>
<script type='text/javascript' src="ressources/bootstrap/js/bootstrap.js"></script>
<title>Index</title>
</head>
<body>
<div id="wrap">
<p>test</p>
</div>
<?php include('includes/footer.php'); ?>
</body>
</html>
But I dont see my footer in my page. I just put an "Hello World" in my footer.php
The file location of the image is correct and it displays on localhost however doesn't online, how would i be able to get this to work?
I have tried changing the images from png to jpg and using different images and changing the file locations and then updating that on the code however it still does not display the image
<!DOCTYPE HTML>
<html>
<head>
<title>KMS</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="UTF-8">
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript" src="http://s.sharethis.com/loader.js"></script>
</head>
<body id="wrapper">
<div id="header">
<!--Logo-->
<div id="Logo">
</div>
<!--Logo-->
<!--Menu Buttons-->
<?php include 'menu.php';?>
<!--Menu Buttons-->
</div>
<div id="hContent">
<!--Frames--====================================================================-->
<div id="hFrames">
<!--Information go below-->
<div id="infoCon1">
<img id="kms_img" src="Images/Kmsproductsinformation.jpg" style="width:850px;"/>
<b />
<b />
</div>
<!--Information end-->
</div>
</div>
</div>
<!--
footer
-->
</body>
</html>
Try <img id="kms_img" src="images/kmsproductsinformation.jpg" style="width:850px;"/> and ensure that your images directory and kmsproductsinformation.jpg file are in lowercase.
You've got something funny going on with your DIVS. You have what looks like two additional close DIV tags () towards the end of your file - I'd start by fixing those up.
Having said that it also shouldn't really matter if it's localhost or not, or whether it's jpg or png but PNG would be better if you're setting it to a non-100% width.
Try something basic without all the DIVS or your menu.php file and see if that works.
<!DOCTYPE HTML>
<html>
<head>
<title>KMS</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta charset="UTF-8">
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript" src="http://s.sharethis.com/loader.js"></script>
</head>
<body id="wrapper">
<img id="kms_img" src="Images/Kmsproductsinformation.jpg" />
</body>
</html>