Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Add Specific Information In A Panel

I was wanting to add this in a panel below the header how can this be done.

Sitename - Day - Date

I want it to be in this format
Ok, so I am not a coder. I have played around with themes a little but that was 8 years ago in v7. The last thing i want is a site crash because i screwed up

So I would need the correct format to add this to a panel
You could also set up a test site on localhost for your learning experience. Once it works as you want, simply push to live.
Laragon for windows is great.
I am not sure on the correct reply from the back of my head.
Try, ". date('Y-m-d') ." , all info you need is there in the links until you reach your wanted result.
Ok so I am using this in my Main.Inc. Don't like the Marguee but it is what I have.

I tried using the echo in panel, but it doesn't work.

CodeDownload  

echo "
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td><img src='".THEME."images/headerannounce_01.gif' width='156' height='32' alt='' /></td>
<td style='width: 100%; height: 32px; background-image: url(".THEME."images/headerannounce_stretch.gif')'

id='announcements'>
<marquee direction='left' scrollamount='2' scrolldelay='30' width='100%' onmouseover='this.stop()' onmouseout='this.start

()'>".showsubdate()."</marquee>
</td>
<td><img src='".THEME."images/headerannounce_02.gif' width='73' height='32' alt='' /></td>
</tr>
</table>
";



If I could get it fixed center no scroll would be great. If I could put it in a panel, even better. But I need to know how to call the Location and the day of week if possible.
Set up your files as such

root/infusions/custom_panel/custom_panel.php
root/infusions/custom_panel/index.php


Go to Panel management, add panel, you should see a "custom-panel" options. Select that and enable it. Now, edit custom-panel.php and paste in your code accordingly.

CodeDownload  
<?php
echo "Test";



Turn off "Allow PHP Execution".
this is all fine, but i still need to know how to call the location and the day of week.
location - day of week - ".showsubdate()."
Ok so here is what I have in a working panel.

CodeDownload  
<?php

date_default_timezone_set("America/New_York");
echo date('l - F jS Y - h:i:s A');



Wednesday - August 12th 2020 - 09:09:21 PM

This is fine, except I am still needing the user_location.

user_location - Wednesday - August 12th 2020 - 09:09:21 PM

and I can not figure out how to center it. It has to be centered.
CodeDownload  
<?php

date_default_timezone_set("America/New_York");
echo "<center> ".fusion_get_userdata('user_location')." - ".date('l - F jS Y - h:i:s A')." </center>";



Most Themes support the center tag from helpers, if it does not work add this to your styles.css

CodeDownload  
.center, *[align="center"] {
margin-left: auto;
margin-right: auto;
}

first part worked fine. thanks.

just got to find a new time, since the one i am using doesn't move. only if you refresh page
Sorry, can't help putting my 2 cents worth in. Try this:
CodeDownload  
echo '<div align="center"> '.fusion_get_userdata('user_location').' - <span style="font-size:12px; color:#ffff00;"><b>'.showdate('forumdate',"").' @</b> <span id="clock"></span>
<script type="text/Javascript">
<!--
function clock(){
//Save the times in variables
var today = new Date();
var hours = today.getHours();
var minutes = today.getMinutes();
var seconds = today.getSeconds();
//Set the AM or PM time
if (hours >= 12){
 meridiem = " <sup>PM</sup>";
}
else {
 meridiem = " <sup>AM</sup>";
}
//convert hours to 12 hour format and put 0 in front
if (hours>12){
   hours = hours - 12;
}
else if (hours===0){
   hours = 12;   
}
//Put 0 in front of single digit minutes and seconds
if (minutes<10){
   minutes = "0" + minutes;
}
else {
   minutes = minutes;
}
if (seconds<10){
   seconds = "0" + seconds;
}
else {
   seconds = seconds;
}
document.getElementById("clock").innerHTML = (hours + ":" + minutes + ":" + seconds + meridiem);
}
setInterval("clock()", 1000);
//-->
</script>    </span></div>';


Not sure where to tell you to add it. In my Atom-X theme it's added in "Atom-X/classes/AtomX.inc" after and within the <div class='logo'>. This will give you a dynamic running clock function. Check it out here on one of my websites; it's to the right under the Social icons.
https://elgheko.us/home.php
I added it into my main.inc, but the clock stayed fixed unless page was refreshed
https://www.w3schools.com/js/tryit.asp?filename=tryjs_timing_clock

Quote

I added it into my main.inc, but the clock stayed fixed unless page was refreshed

Check out this site; it works perfectly fine with this code in Main.inc of the Magazine theme. This is in 9.03.70 version.
https://trans-galactic.com

CodeDownload  
 if ($this->GetParam('container') == TRUE) {
 echo '<div class="container-fluid"><div align="center"><span style="font-size:20px; color:#000;">'.date("F d, Y @ ").'<span id="clock"></span>
<script type="text/Javascript">
<!--
function clock(){
//Save the times in variables
var today = new Date();
var hours = today.getHours();
var minutes = today.getMinutes();
var seconds = today.getSeconds();
//Set the AM or PM time
if (hours >= 12){
 meridiem = " <sup>pm</sup>";
}
else {
 meridiem = " <sup>am</sup>";
}
//convert hours to 12 hour format and put 0 in front
if (hours>12){
 hours = hours - 12;
}
else if (hours===0){
 hours = 12;
}
//Put 0 in front of single digit minutes and seconds
if (minutes<10){
 minutes = "0" + minutes;
}
else {
 minutes = minutes;
}
if (seconds<10){
 seconds = "0" + seconds;
}
else {
 seconds = seconds;
}
document.getElementById("clock").innerHTML = (hours + ":" + minutes + ":" + seconds + meridiem);
}
setInterval("clock()", 1000);
//-->
</script></span><hr></div>';
 }

Thread Information
Author
Replies
15 posts
Views
224 times
Last Post
Last updated on 2 months ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Falk, Chan, Grimloch, Vyper69, RobiNN