Current location: Hot Scripts Forums » Programming Languages » PHP » with problem javascript in echo php


with problem javascript in echo php

Reply
  #1 (permalink)  
Old 09-23-09, 06:41 AM
chandansangha chandansangha is offline
New Member
 
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
with problem javascript in echo php

HI...I am not much familiar with php.I have this php code below in which I want to use the javascript code.I tried to add but it results in blank page:
PHP Code:

CODE STARTS:--->


<?php

defined
'_JEXEC' ) or die( 'Restricted access' );

echo 
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'
$this->language.'" lang="'.$this->language.'" >';

echo 
'<head>

<link rel="shortcut icon" href="favicon.ico" >
<link rel="icon" type="image/gif" href="animated_favicon1.gif" >

<jdoc:include type="head" />
<link rel="stylesheet" href="'
.$this->baseurl.'/templates/'.$this->template.'/css/template.css" type="text/css" />
<link rel="stylesheet" href="'
$this->baseurl .'/templates/'$this->template.'/css/menu.css" type="text/css" />';



echo 
'<script type="text/javascript"><!--//--><![CDATA[//><!--

sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]></script><style type="text/css">'
;



if(!
$this->countModules('left')) : echo '#main{width:100%!important; float:left;}';
endif;
if(
$this->countModules('user1 + user2')==1) : echo '#user2{width:100%;}';
endif;
if(!
$this->countModules('right')) : echo '#middle{width:100%;}';
endif;


echo 
'</style></head><body><div id="bgtop" align="center"><div class="wrapper"><div id="header"><div id="logo"><jdoc:include type="modules" name="header" style="xhtml" /><img src="'$this->baseurl .'/templates/'$this->template.'/images/logo.gif"></div>';
if(
$this->countModules('user3')) : echo '<div id="user3"><jdoc:include type="modules" name="user3" style="xhtml" /></div>';
endif;
echo 
'<div class="clear"></div></div>';
if(
$this->countModules('menu')) : echo '<div id="nav"><jdoc:include type="modules" name="menu" style="xhtml" /></div>';
endif;
echo 
'
<div class="clear"></div>
</div></div>
<div id="bgbottom" align="center"><div class="wrapper">
<div id="container">'
;
if(
$this->countModules('left')) : echo '<div id="left"><div class="banneritem"><jdoc:include type="modules" name="left" style="xhtml" /><div class="clr"></div>
</div></div>'
;
endif;
echo 
'<div id="main">';
if(
$this->countModules('user1 + user2')) : echo '<div id="user12"><div id="user1"><jdoc:include type="modules" name="user1" style="xhtml" /></div><div id="user2"><jdoc:include type="modules" name="user2" style="xhtml" /></div><div class="clear"></div></div>';
endif;
echo 
'<div id="br"> <div id="middle"><div id="mainbody"><jdoc:include type="component" style="xhtml" /></div>';
if(
$this->countModules('top')) : echo '<div id="top"><jdoc:include type="modules" name="top" style="xhtml" /></div>';
endif;
echo 
'</div>';
if(
$this->countModules('user4 + right')) : echo '<div id="right">';
if(
$this->countModules('user4')) : echo '<div id="user4"><jdoc:include type="modules" name="user4" style="xhtml" /></div>';
endif;
if(
$this->countModules('right')) : echo '<div id="rightmodule"><jdoc:include type="modules" name="right" style="xhtml" /></div>';
endif;
echo 
'</div>';
endif;

echo 
'</div></div><div class="clear"></div></div><div id="footer"><div class="bgright"><div class="bgleft">';
// <!-- Footer Links Are In The Contract Of Use. If You Dont Want Them, Then Use A DIFFERENT Template! -->
echo '<div id="getmesome" style="text-indent:-9000em;margin-top:-50px">';
echo 
'<jdoc:include type="modules" name="footer"/>';
echo 
'</div></div></div>';
</
body></html>';

?>

--->CODE ENDS
And I want to add the below javascript code in the above php file.Please tell me what tags/code I need to use.
HTML Code:
CODE STARTS:--->

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.<acronym title="JavaScript"><acronym title="JavaScript">js</acronym></acronym>' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10706039-1");
pageTracker._trackPageview();
} catch(err) {}</script>

--->CODE ENDS

Thanks
leen

Last edited by wirehopper; 09-23-09 at 07:21 AM. Reason: PHP & HTML tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 09-23-09, 06:54 AM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
Do you have error reporting turned off? You don't escape your quotes in the echo command. Or am I missing something?
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 09-23-09, 07:23 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
End the PHP content just before the </body> tag, then past the javascript in just prior to the </html> tag.

PHP Code:

echo '</div></div></div>'?>

</body>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.<acronym title="JavaScript"><acronym title="JavaScript">js</acronym></acronym>' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10706039-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</html> 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks

Tags
echo php, javascript, php


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
html tags in php n3wb!e PHP 3 07-12-06 11:00 AM
How To Make Form Processor Handle Unlimited Fields cebuy PHP 9 01-25-05 05:39 AM
domain check ramez Script Requests 8 03-07-04 12:26 AM
Problem with adding content to mysql from php HasansWeb PHP 3 01-10-04 06:26 PM
Query on url dihan PHP 17 01-04-04 04:47 PM


All times are GMT -5. The time now is 01:14 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.