Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Help finding PHP script - RELOAD DIV...

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
sarahfoxnz
Smarty Regular


Joined: 11 Apr 2010
Posts: 76

PostPosted: Mon Oct 12, 2015 11:43 am    Post subject: Help finding PHP script - RELOAD DIV... Reply with quote

Smarty - 2.6.26

Hello. I have the above Smarty version.

What i'm trying to do, is to create a DIV, & auto-reload that div every 10 seconds..

PROBLEM :- How do i find out the path of an included file ?

If i go to :- http://ss.DOMAIN.com/rotateevents.php - i see my rotated text whenever i refresh the screen.

HOWEVER, when i try to include the same file in a div in another script - the text / script does not display.

(rotateevents is a small script just to display rotating text - its included in another URL of my subdomain)

My latest version is :-

[code]

<div>
1. <? include="http://ss.DOMAIN.com/rotateevents.php" ?>
<!-- {$smarty.version} -->
</div>

and

<div>
1. <? include="/rotateevents.php" ?>
<!-- {$smarty.version} -->
</div>


and

<div>
1. <? include="rotateevents.php" ?>
<!-- {$smarty.version} -->
</div>

[/code]

Nothing works...


I'm guessing this is my main problem. It should work once i get the path name correct.

can anyone advise ?




Once i get the php script to work, & display as text, I'll try to get it to 'refresh' every 10 seconds... (refresh the div, not the entire page)


EDIT - Ive also googled & found lines like :-

$('div').load('phpfile.php')

and

$("#captcha").html('<?php include 'myFile.php';?>'); // doesn't work

etc.. - But nothing i try works...

(changing the names to match my DIV class (i also changed my DIV to "id" too - Doesnt work)
Back to top
View user's profile Send private message
sarahfoxnz
Smarty Regular


Joined: 11 Apr 2010
Posts: 76

PostPosted: Tue Oct 13, 2015 8:33 am    Post subject: Reply with quote

Ive solved my problem & the rotate now works.

Its not a Smarty problem, but i found an additional function with response headers etc...

THOUGH with just this line, it doesn't work.

$("#events1").load( "/rotateevents.php");


Working script:

<script type="text/javascript">
setInterval(function() {
$("#events1").load( "/rotateevents.php", function( response, status, xhr ) {
if ( status == "error" ) {
var msg = "Sorry but there was an error: ";
$( "#events1" ).html( msg + xhr.status + " " + xhr.statusText );
}
});



},
5000); // every 5 second
</script>
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP