How can I modify the following code so the year automatically would change each year?
</div>
</div>
</div></div>
<div class="footer">
<p>Copyright 2023 </p>
</div>
</body>
</html>
Meaning I won't need to manually change the Copyright 2023 next year to Copyright 2024.
Thanks a bunch in advance!
I don't know how to make the date modified automatically based on the year.
You need to try the date() function. And maybe your question will be solved.
<div class="footer">
<p>Copyright <?php echo date("Y"); ?> </p>
</div>
Replace this code and the date() function will dynamically get the current year.
Related
I created a footer.php file:
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col col-md-5">
<p>Copyright © 2018 Nens Events.</p>
</div>
</div>
</div>`
and it is located on a folder like this one:
/php/footer.php
All I want is to read it on a subfolder like this one: /events/na/1.php
but when I use this code, it doesn't read the footer.php file, does someone know what I am doing wrong?
<?php
echo file_get_contents("/php/footer.php");
?>
Use include() or require() function to join your codes into your script.
So the code for reading(in your terms) will be like this
<?php include 'php/footer.php'; ?>
If the site is on root page, use absolute path like this.
<?php include '/php/footer.php'; ?>
It should work! Give a try.
Use require('php/footer.php') for better coding.
I have a html structure like below, I want to place my custom header at a random position.
<div class="div1">
<div class="div2">
<?php echo do_shortcode('[header]'); ?>
</div>
<div class="div3"></div>
</div>
But it always make my header go to the bottom.
<div class="div1">
<div class="div2">
//I want the header to stay here
</div>
<div class="div3"></div>
<header>......</header>
</div>
However I place it, the header always go to the bottom, please give advice if you experience it.
UPDATE:
In my case, a specific class removed helped. Thanks everybody.
This question already has answers here:
PHP parse/syntax errors; and how to solve them
(20 answers)
Closed 6 years ago.
I'm trying to create a php file with my footer details. I want to include this into the necessary pages. The following is my footer.php
footer.php
<?php
echo "<footer class="footer">
<div class="container">
<p class="text-muted">Contact Us</p>
<p class="text-muted"> Copyright © <span id="yearfooter"> </span>. All rights reserved.</p>
</div>
</footer>";
?>
This is the line I include into my html file to include this footer.php
<?php include 'footer.php'; ?>
But when uploaded to my website, it is not showing the footer file. This is the very first time I'm trying out PHP. I'm not sure if there is something else I'm supposed to do or where I'm going wrong. Any help is much appreciated!
UPDATE
I still cant get this to work. I've also added a .htaccess file and it still doesnt help.
.htaccess
AddType application/x-httpd-php .html
Update
I've managed to get this working. There was some config issues in the server side. Thanks!
Try wrapping your echo in single quotes:
<?php
echo '<footer class="footer">
<div class="container">
<p class="text-muted">Contact Us</p>
<p class="text-muted"> Copyright © <span id="yearfooter"> </span>. All rights reserved. </p>
</div>
</footer>';
?>
And no space between ? and php
<?php include 'footer.php'; ?>
I am working on a website, http://www.amp.com.pk/contact/. The footer works perfect on all of the pages except the contact page. I have tried wrapping the footer under another div (primary div) but still the problem is there.
Please guide me. Thanks.
<div class="footer-wrapper">
<div class="copyright">
<p style="margin-top:-45px;color:#91703A;font-size:15px;">Adnan Malik Productions</p>
<p style="margin-top:-30px;color:#91703A;font-size:13px;">
Follow us on Facebook | Twitter|AMP © <?php echo date('Y') ?>. ALL RIGHTS RESERVED</div></p>
<div class="credit">Powered By: Inspurate</div>
<div class="clear"></div>
</div>
#colophon .footer-wrapper
{
margin-left:150px;
}
try this and see if it works or not or try giving dimensions in Percent instead of Pixels !
I am sure it will work
I'm using CSS and HTML. I'm putting the PHP code inside the HTML, yet the result does not display. Can you help me around? Thanks in advance.
<div id="sidebar_1" class="sidebar one_quarter">
<aside>
<!-- #### -->
<section>
<div>
<h2 class="title">Latest Announcement</h2>
<div>The announcements will move here.
<?php echo date("D , F.d.Y"); ?><br><span id=clock style="position:relative;"></span>
<table align="right" border="0" cellpadding="0" cellspacing="0">
<?php include('annohome.php'); ?>
</table>
</div>
</div>
</section>
</aside>
</div>
Check to see if you have your timezone set. Some servers require that you set the timezone before you can actually use date.
date_default_timezone_set('America/Los_Angeles');
echo date("D , F.d.Y");
results in Wed , February.12.2014
Your server might also be hiding all php errors, so it might be necessary to php_ini set them on at the very beginning of the file.
error_reporting(E_ALL); and ini_set('display_errors', '1');
You would have to use either date_default_timezone_set() or a datetime object, and the user would have to set their own timezone in an options menu somewhere.
Otherwise, PHP is a server side language and has no idea what time it is on the user's end.
// set the default timezone to use. Available since PHP 5.1
date_default_timezone_set('UTC');
// Prints your date format
echo date("D , F.d.Y");