Click to See Complete Forum and Search --> : Problem auto refresh only a part of the page?
angel_198328
09-22-2008, 04:51 PM
Hello
i am new to this but i will try to explain what i am tring to accomplish.
I have a page that has php and flash on it what i am trying to do is having a script or something that could auto refresh only the php module every x minutes or something to refresh the whole thing but without affecting the flash contianed in it beacuase i don't want flash to reload each time it refreshes.
Any ideas would be really appreciated.
thank you.
FourCourtJester
09-22-2008, 05:26 PM
Hi there,
There's two ways off the top of my head on how to this. One is make a parent php page (ie - index.php) that contains an Iframe to the content you wish to update regularly (ie - updateMe.php) . You can embed the refresh script inside the updateMe.php page, and just let it merrily execute away. You would then embed the flash on index.php so it would not be affected by the Iframe.
The second way would be to do basically the same thing, but encapsulate the updateMe.php page in Ajax, and use Ajax to refresh the data instead.
Either way should work well.
If you embed the updateMe content with the flash on the same page, you cannot (I believe) selectively update without Ajax.
angel_198328
09-22-2008, 06:45 PM
okay the php module
<table width="200" border="0" align="right" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<?php if (@constant('CONF_SHOW_ADD2CART') == 1): ?>
<tr>
<td width="200" align="left" valign="top" bgcolor="#602035" class="topcorners">
<div style="padding:5px;font-size:130%;">
<a href="index.php?shopping_cart=yes" class="menu"><?php echo @constant('CART_TITLE'); ?></a> </div> </td>
</tr>
<tr>
<td style="background: #E5B4C3; background-position: right; padding: 10px;" class="bottomcorners">
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "shopping_cart_info.tpl.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
?> </td>
</tr>
<?php endif; ?>
</table>
Looks like this contained within a layout table in the idnex.html.php
how would i add the update srcipt to this ?
FourCourtJester
09-22-2008, 06:56 PM
If that is the php module that refreshes itself every now and then, you can use a timer in javascript to refresh it, or a similar call in php.
angel_198328
09-22-2008, 07:01 PM
i already tried with <meta http-equiv="refresh" content="600">
but even when i only added this to this .
<?php require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'replace', 'shopping_cart_info.tpl.html', 9, false),)), $this); ?>
<table cellpadding="0" cellspacing="0">
<form name="shopping_cart_form">
<tr><td>
<?php if ($this->_tpl_vars['shopping_cart_value']): ?>
<input class=cart type=text name=gc value="<?php echo $this->_tpl_vars['shopping_cart_items']; ?>
<?php echo @constant('CART_CONTENT_NOT_EMPTY'); ?>
" readonly><br>
<input type=text class=cart name=ca value="<?php echo ((is_array($_tmp=$this->_tpl_vars['shopping_cart_value_shown'])) ? $this->_run_mod_handler('replace', true, $_tmp, '"', '"') : smarty_modifier_replace($_tmp, '"', '"')); ?>
" readonly>
<?php else: ?>
<input class=cart type=text name=gc value="<?php echo @constant('CART_CONTENT_EMPTY'); ?>
" readonly><br>
<input type=text class=cart name=ca value="" readonly>
<?php endif; ?>
<nobr><a href="index.php?shopping_cart=yes"><?php echo @constant('CART_PROCEED_TO_CHECKOUT'); ?>
</a></nobr>
</td></tr>
</form>
</table>
I actually refreshes the whole main page :(
Any other ideas?
FourCourtJester
09-22-2008, 07:08 PM
Take whatever page the module is on right now and replace the entire table with <iframe src="myTable.php"></iframe>
now create a new php page, call it myTable.php, and paste in your entire table with the refresh code.
So , for example, replace
<table cellpadding="0" cellspacing="0">
<form name="shopping_cart_form">
<tr><td>
<?php if ($this->_tpl_vars['shopping_cart_value']): ?>
<input class=cart type=text name=gc value="<?php echo $this->_tpl_vars['shopping_cart_items']; ?>
<?php echo @constant('CART_CONTENT_NOT_EMPTY'); ?>
" readonly><br>
<input type=text class=cart name=ca value="<?php echo ((is_array($_tmp=$this->_tpl_vars['shopping_cart_value_shown'])) ? $this->_run_mod_handler('replace', true, $_tmp, '"', '"') : smarty_modifier_replace($_tmp, '"', '"')); ?>
" readonly>
<?php else: ?>
<input class=cart type=text name=gc value="<?php echo @constant('CART_CONTENT_EMPTY'); ?>
" readonly><br>
<input type=text class=cart name=ca value="" readonly>
<?php endif; ?>
<nobr><a href="index.php?shopping_cart=yes"><?php echo @constant('CART_PROCEED_TO_CHECKOUT'); ?>
</a></nobr>
</td></tr>
</form>
</table>
with
<iframe src="myTable.php"></iframe>
angel_198328
09-22-2008, 07:22 PM
Sorry like i told you i am new to this this seems to be my index code
<html><style type="text/css">
<!--
body {
background-color: #232323;
}
-->
</style>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "head.tpl.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
?>
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">
<script type="text/javascript" src="images/niftycube.js"></script>
<center>
<table width="6492" border="0" cellspacing="0" cellpadding="0">
<!--DWLayoutTable-->
<tr>
<td width="6392" height="1013" valign="top" bgcolor="white"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="32" height="70" valign="middle">
<a href="index.php"><img src="images/companyname.gif" border="0" alt="<?php echo @constant('CONF_SHOP_NAME'); ?>
"></a> </td>
<td colspan="3" valign="bottom">
<table id="tabnav" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td><div <?php if ($this->_tpl_vars['main_content_template'] == "home.tpl.html"): ?> class="topmenu_selected"<?php else: ?> class="topmenu_notselected"<?php endif; ?>><a href="index.php" class="menu"><?php echo @constant('LINK_TO_HOMEPAGE'); ?>
</a></div></td>
<td> </td>
<td><div <?php if ($this->_tpl_vars['main_content_template'] == "pricelist.tpl.html"): ?> class="topmenu_selected"<?php else: ?> class="topmenu_notselected"<?php endif; ?>><a href="index.php?show_price=yes" class="menu"><?php echo @constant('STRING_PRICELIST'); ?>
</a></div></td>
<td> </td>
<td><div <?php if (( $this->_tpl_vars['main_content_template'] == "aux_page.tpl.html" ) && ( $this->_tpl_vars['aux_page'] == 'aux1' )): ?> class="topmenu_selected"<?php else: ?> class="topmenu_notselected"<?php endif; ?>><a href="index.php?aux_page=aux1" class="menu"><nobr><?php echo @constant('ADMIN_ABOUT_PAGE'); ?>
</nobr></a></div></td>
<td> </td>
<td><div <?php if (( $this->_tpl_vars['main_content_template'] == "aux_page.tpl.html" ) && ( $this->_tpl_vars['aux_page'] == 'aux2' )): ?> class="topmenu_selected"<?php else: ?> class="topmenu_notselected"<?php endif; ?>><a href="index.php?aux_page=aux2" class="menu"><?php echo @constant('ADMIN_SHIPPING_PAGE'); ?>
</a></div></td>
</tr>
</table> </td>
<td colspan="2" align="right" valign="middle" style="background: #ffffff url(images/gradientbg1.gif) repeat-y; background-position: right; height:70px; width:170px;">
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "language.tpl.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "search_form.tpl.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
?>
<a href="index.php?search_with_change_category_ability=yes" class="lightsmall"></a> </td>
</tr>
<tr>
<td bgcolor="white" height="32" align="right"><img src="images/gradient-dark-strip.gif"></td>
<td width="798" bgcolor="#203560"></td>
<td width="223" bgcolor="#203560"></td>
<td width="5169" bgcolor="#203560"></td>
<td width="138" bgcolor="#203560"></td>
<td width="32" bgcolor="#203560"></td>
</tr>
<tr>
<td height="124"> </td>
<td> </td>
<td align="right" valign="top">
<table border="0" cellpadding="0" cellspacing="0" bgcolor="#D4D0C8">
<!--DWLayoutTable-->
<tr><td width="3" height="124"> </td>
<td width="220" valign="top" bgcolor="#232323" style="background: white url(images/gradientbg2.gif) repeat-y; background-position: right;width:220px;height:100%;">
<p style="padding:10px;">
<table width="200" border="0" align="right" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<?php if (@constant('CONF_SHOW_ADD2CART') == 1): ?>
<tr>
<td width="200" align="left" valign="top" bgcolor="#602035" class="topcorners">
<div style="padding:5px;font-size:130%;">
<a href="index.php?shopping_cart=yes" class="menu"><?php echo @constant('CART_TITLE'); ?></a> </div> </td>
</tr>
<tr>
<td style="background: #E5B4C3; background-position: right; padding: 10px;" class="bottomcorners">
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "shopping_cart_info.tpl.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
?> </td>
</tr>
<?php endif; ?>
</table> </p> </td>
</tr>
</table></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="55"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="540" colspan="5" align="left" valign="top" bgcolor="#232323" style="padding:10px;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="930" height="520">
<param name="movie" value="http://www.brilliantcrystal.com/taylormade_main.swf">
<param name="quality" value="high">
<param name="wmode" value="transparent">
<param name="allowscriptaccess" value="samedomain">
<embed src="http://www.brilliantcrystal.com/taylormade_main.swf" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="930" height="520"></embed>
</object></td>
<td></td>
</tr>
<tr>
<td height="13"></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td height="68" colspan="5" align="center" valign="top" bgcolor="#232323">
<hr width="300" align="center" size="1" style="margin-top:0px;">
<p class="small" align="center" style="margin-top:-5px;"><i>Copyright © <a href="<?php echo @constant('CONF_FULL_SHOP_URL'); ?>
"> <u><?php echo @constant('CONF_SHOP_NAME'); ?>
</u></a>. All rights reserved.</i></p>
</td>
<td> </td>
</tr>
<tr>
<td height="111"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
<td width="100"></td>
</tr>
<tr>
<td height="100"> </td>
<td></td>
</tr>
</table>
<script type="text/javascript">
<?php echo '
if ( ! (navigator.userAgent.indexOf(\'Opera\') != -1) )
{
Nifty("div.topmenu_notselected,div.topmenu_selected","top transparent");
Nifty("td.topcorners","tl transparent");
var tt_layers= getElementsBySelector("td.topcorners");
for(var k=0, len=tt_layers.length; k<len; k++)
{
tt_layers[k].parentNode.style.backgroundColor = "#e0e7ff";
}
Nifty("td.topcorners","tr transparent");
Nifty("td.bottomcorners","bl transparent");
var tt_layers= getElementsBySelector("td.bottomcorners");
for(var k=0, len=tt_layers.length; k<len; k++)
{
tt_layers[k].parentNode.style.backgroundColor = "#e0e7ff";
}
Nifty("td.bottomcorners","br transparent");
}
'; ?>
</script>
<!--
end of Nifty code
-->
</body>
</html>
where would u suggest to make those changes in ?
thankx in advance for all your help :)
angel_198328
09-23-2008, 05:34 PM
i already replaced like you told me but its not working it only shows an empty frame nothing on it :( i even put the complete path
<iframe src="http://www.brilliantcrystal.com/myTable.php"></iframe>
what am i doing wrong ?
maybe its because the index is php ?
fainsur
09-26-2008, 06:48 AM
this is my first ever post for web development help.
now angel.. this is what you must do.
first and foremost--I would consider that you look carefully at your php script and make it fit u. if you brought a template etc, it's best to review it so you can know the logic of it a little.
organization is the key.. so where ever you see a < or a > its best to just simply hit the space bar at the beginning/end to keep from clutter. i find adding // blah blah
helpful to leave comments of what this and that do.
now what jester was saying was that you need to take
<table cellpadding="0" cellspacing="0">
<form name="shopping_cart_form">
<tr><td>
<?php if ($this->_tpl_vars['shopping_cart_value']): ?>
<input class=cart type=text name=gc value="<?php echo $this->_tpl_vars['shopping_cart_items']; ?>
<?php echo @constant('CART_CONTENT_NOT_EMPTY'); ?>
" readonly><br>
<input type=text class=cart name=ca value="<?php echo ((is_array($_tmp=$this->_tpl_vars['shopping_cart_value_shown'])) ? $this->_run_mod_handler('replace', true, $_tmp, '"', '"') : smarty_modifier_replace($_tmp, '"', '"')); ?>
" readonly>
<?php else: ?>
<input class=cart type=text name=gc value="<?php echo @constant('CART_CONTENT_EMPTY'); ?>
" readonly><br>
<input type=text class=cart name=ca value="" readonly>
<?php endif; ?>
<nobr><a href="index.php?shopping_cart=yes"><?php echo @constant('CART_PROCEED_TO_CHECKOUT'); ?>
</a></nobr>
</td></tr>
</form>
</table>
and create a PHP file out of it called myTable.php and place it exactly in the same directory where you have index at.
now where you just cut the code out of the index.php you must now add in the iframe.
<iframe src="myTable.php"></iframe>
this must go in exactly the same spot and what will happen is that you will have a frame on the page which you can then set to auto refresh by simply putting
<meta http-equiv="refresh" content="600;">
before the <table> in the new myTABLE file that you just created
do you follow?
if that doesn't help. then try leaving the <table> inside of the index.php and put the <iframe in between the <table></table> in the index. but make sure u create that php from whatever is listed in between the <table></table>.
hope this helps.. its basically what jester said in a little more detail
fainsur
09-26-2008, 06:57 AM
nvm i just saw ur site.. seems like u fixed it. :)
at least i tried lol.