Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1734 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

PHP T _constant error with this code

Thread title: PHP T _constant error with this code
Closed Thread    
    Thread tools Search this thread Display Modes  
11-05-2008, 03:34 PM
#1
Xphic is offline Xphic
Status: I love this place
Join date: Sep 2007
Location:
Expertise:
Software:
 
Posts: 523
iTrader: 13 / 100%
 

Xphic is on a distinguished road

  Old  PHP T _constant error with this code

HTML Code:
<SCRIPT language="Javascript">
var cpmstar_rnd=Math.round(Math.random()*999999);
var cpmstar_pid=xxxx;
document.writeln("<SCR"+"IPT language='Javascript' src='http://server.cpmstar.com/view.aspx?poolid="+cpmstar_pid+"&script=1&rnd="+cpmstar_rnd+"'></SCR"+"IPT>");
</SCRIPT>
I have know idea how to get this code to work with my site. It will give me a T_constant error.

I tried to do the slash method, but it didn't work or I messed it up.


Any ideas?

11-06-2008, 01:32 PM
#2
Sam Granger is offline Sam Granger
Status: Request a custom title
Join date: Feb 2005
Location: The Netherlands
Expertise:
Software:
 
Posts: 2,616
iTrader: 19 / 88%
 

Sam Granger is on a distinguished road

Send a message via MSN to Sam Granger

  Old

can't you just close the php? So where you paste the js - if ifstatement or whatever, ?>js code here, just html...<?php continue php....?

Would be handy to see your code if the above method won't work.

11-09-2008, 01:50 AM
#3
Xphic is offline Xphic
Status: I love this place
Join date: Sep 2007
Location:
Expertise:
Software:
 
Posts: 523
iTrader: 13 / 100%
 

Xphic is on a distinguished road

  Old

Originally Posted by Sam Granger View Post
can't you just close the php? So where you paste the js - if ifstatement or whatever, ?>js code here, just html...<?php continue php....?

Would be handy to see your code if the above method won't work.
Thats what I did for the adsense code, but this one didnt work like that.

And I will post about 50 lines of the code, it's rather long. It's a wallpaper script.

11-09-2008, 03:36 AM
#4
Xphic is offline Xphic
Status: I love this place
Join date: Sep 2007
Location:
Expertise:
Software:
 
Posts: 523
iTrader: 13 / 100%
 

Xphic is on a distinguished road

  Old

Here it is
PHP Code:
<body>
    <
div class="Position">
        <
div class="Header">
            <
a href="'.$image_path.'"><img src="'.$image_path.'images/header.PNG" alt="'.$SEO_Title.'"/></a>
        </
div>
        
        <
div style="float:right;">
        
            
        
        </
div
        
        
<div class="Menu">
            <
a href="'.$image_path.'"><img src="'.$image_path.'images/Home1.png" alt="Home" onmouseout="this.src=\''.$image_path.'images/Home1.png\'" onmouseover="this.src=\''.$image_path.'images/Home2.png\'"/></a'.$Guest_Submit.'
        
</div>
        
        <!-- 
google_ad_section_start -->
            <
div class="ContentLeft Left">
            
            <!-- 
Ads section -->
                <
div class="ContentHeader1">
                    
Ad
                
</div>
                <
div class="ContentArea" align="center">

<
SCRIPT language="Javascript">
var 
cpmstar_rnd=Math.round(Math.random()*999999);
var 
cpmstar_pid=xxxx;
document.writeln("<SCR"+"IPT language='Javascript' src='http://server.cpmstar.com/view.aspx?poolid="+cpmstar_pid+"&script=1&rnd="+cpmstar_rnd+"'></SCR"+"IPT>");
</SCRIPT>
                    
                </div> 

Heres the full error:

Parse error: syntax error, unexpected T_STRING in /home/xphicom/public_html/skin.php on line 229


This was the line

HTML Code:
document.writeln("<SCR"+"IPT language='Javascript' src='http://server.cpmstar.com/view.aspx?poolid="+cpmstar_pid+"&script=1&rnd="+cpmstar_rnd+"'></SCR"+"IPT>");

11-12-2008, 06:53 PM
#5
paitken is offline paitken
Status: I'm new around here
Join date: Nov 2008
Location: Tampa, FL, USA
Expertise:
Software:
 
Posts: 14
iTrader: 0 / 0%
 

paitken is on a distinguished road

Send a message via ICQ to paitken Send a message via AIM to paitken Send a message via MSN to paitken Send a message via Yahoo to paitken

  Old

Above the script language=javascript, put:
?>

Then below the "</SCRIPT>", put:
<?php

It appears like it is messing up because you're using single quotes inside the javascript. You could also escape the single quotes inside the javascript with: \'

So your code:
Code:
document.writeln("<SCR"+"IPT language=\'Javascript\' src='http://server.cpmstar.com/view.aspx?poolid="+cpmstar_pid+"&script=1&rnd="+cpmstar_rnd+"'></SCR"+"IPT>");
Do whatever you feel is easier and less confusing. The above code should work, assuming that everything I stated about the code is correct.

Closed Thread    


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

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed