Jump to content

W3css Carosel - Include a php script ?


sarahfoxnz
 Share

Recommended Posts

<div class="mySlides w3-container"><a href="/todo#feedback" class="w3-bar-item w3-button w3-mobile">Feedback</a></div>

 

<div class="mySlides w3-container"><a href="/todo#feedback" class="w3-bar-item w3-button w3-mobile">Contact us</a></div>

 

Hello - Stupid question - How do i remove all formatting on this forum ? the above is copied from my html code & it looks weird - i cant remove the blank space / gap. (it also appears that this box where im typing is 50% of the available size, it word-wraps much sooner than i want.

 

When i type, i like plain text with no formatting of any description.

 

MAIN QUESTION:-  https://www.w3schools.com/w3css/w3css_slideshow.asp

 

I'm using the carousel()  function. I have successfully used the carousel in another website Ive done (just simply swap between two phrases / words).  However this time, I want to activate / run a PHP script. 

 

I do not need the PHP results to be displayed on screen - I just need it to run every few minutes or so. Ive researched ajax, php, javascript etc & copied the code from my other script.  my text in the div does rotate, however i just cant get the php script to activate.  ive used  content.php   /content.php  and even http://mysite.com/content.php  

 

The bad thing too, is theres no error / result / error messages of any kind. i dont even know if its checking the correct path to find my script (maybe its checking a different / incorrect path. 

 

has anyone got assistance to activate a  php script every xx seconds ? (once i get it going, i can change things).

 

All the php script does is display/echo  the time() value, & also save the time to a file. I'll remove the echo part once i get it going, as i dont need anything displayed on screen. I'll change the php script once its working 

 

 

 

 

 

Link to comment
Share on other sites

Uh, I'm not sure if there is an option for plaintext input with formatting tags. However if you wish to insert code you can press the button that looks like `<>` to make it look nice.
Example:

<div class="mySlides w3-container"><a href="/todo#feedback" class="w3-bar-item w3-button w3-mobile">Feedback</a></div>
<div class="mySlides w3-container"><a href="/todo#feedback" class="w3-bar-item w3-button w3-mobile">Contact us</a></div>

--

PHP is a server side language, and is only processed when you load a page. If you have some invisible 'maintenance' programs to do clean up regularly, you might want to look if your host supports task scheduling. 

If you want 'live' updates(to affect the page your user is viewing), you'll want to create an AJAX request using JavaScript to query some data page (content.php maybe) which will run the processing you require. You could set this request to whenever your carousel turns, or whichever.

Link to comment
Share on other sites

yes - My host apparently stops scheduling at various times & dont notice anything until someone mentions it. 

 

Late last night I fixed it, with this code (not css - sorry). (code is wonky on this screen)

 

 

<script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
  <script type="text/javascript">
   
  var myVar = setInterval(myFunction2, 35000);
   
  function myFunction2() {
  $( "#myID" ).load( "/content.php", function() {});
  }
  script.onerror = function() {
  alert("cannot load script");
  }
   
 

</script>

 

 

Link to comment
Share on other sites

Your code is messed up because you are pasting it directly into into the panel and some code will be interpreted as formating for plain text resulting in the odd results you are experiencing.

Either click the '<>' code button in the top menu or use [ code ] ... [/ code ] (without spacing) to surround your code, which will produce the same result as using '<>' menu button. Like

 this is created using '<>' menu button or [ code ] ... [/ code ] without spacing to show code properly.
Edited by dsonesuk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...