For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > June 2004 > Javascript Question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Javascript Question
Scott Phelps

2004-06-30, 4:00 pm

Hi, I just discovered Smarty two days ago, and I have a couple of
questions.

First, I have the following files:


-------- <<header.tpl>> ---------
<html>
<head>

<link href="{$SITE.css}style.css" type="text/css" rel="STYLESHEET">

<script type="text/javascript" src="{$SITE.javascript}screen_res.js">
</script>

</head>
<title></title>
<body>
---------<<end of file>>----------

-------- <<screen_res.js>> ---------
function write_screen_res_cookie()
{
var today = new Date();
var exp_date = new Date("January 1, 2099");
var cookie_expire_date = exp_date.toGMTString();
var cookie = "screen_res="+ screen.width +"x"+ screen.height;
var screen_res_cookie = cookie + ";expires=" + cookie_expire_date;
document.cookie=screen_res_cookie
}
---------<<-end of file->>----------

-------- <<sccreen_res.php>> ---------
<?php

if (isset ( $HTTP_COOKIE_VARS['screen_res'] ))
$screen_res = $HTTP_COOKIE_VARS['screen_res'];
else {
?>

<script language="javascript">
write_screen_res_cookie();
</script>

<?php
$screen_res = $HTTP_COOKIE_VARS['screen_res'];
?>
---------<<-end of file->>----------

Now my question is how do I tie "screen_res.php" into my header
template?

Thanks in advance!

--
Scott Phelps
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com