logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: PHP doesn't parse a string within Javascript tags
Author
koolholio



Joined: 09 Aug 2006
Posts: 4
Location: England, UK

PostPosted: Wed 09 Aug '06 12:41    Post subject: PHP doesn't parse a string within Javascript tags Reply with quote

Hiya everyone,

Im having trouble posting pictures on screen..

the code has to check a js file for a var before displaying a picture

the variable ccsup IS set to return : "Yes"

it also uses PHP for the images path:

$imagePath is set to the correct address


example of the source code is:

<script> if (""+ccsup+"" == "Yes") {

document.write('<input type="image" src="<?php echo ($imagePath."?Image=Images/pic.gif");?>" alt="picture alternative" onClick="func(1)" ');

all it displays is the picture alternative, and the imagePath doesnt want to echo the correct value to the picture src, and refuses to echo elsewhere in the PHP file.

If anyone can think of any suggestions, please dont hestitate to contact me.

Alex Davies
http://www.tgtbt-online.com


Last edited by koolholio on Wed 09 Aug '06 22:30; edited 1 time in total
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 09 Aug '06 14:26    Post subject: Reply with quote

What output from $imagePath by echo do you see?
is $imagePath set in the same file as the output?

Quote:

the variable ccsup IS set to return : "Yes"

Means what? Which script do you use? Without knowing your scriting I can only guess!
Sure that the js file is parsed by PHP?
Back to top
koolholio



Joined: 09 Aug 2006
Posts: 4
Location: England, UK

PostPosted: Wed 09 Aug '06 15:26    Post subject: Reply with quote

Quote:
and refuses to echo elsewhere in the PHP file.


IT doesnt echo Crying or Very sad

$imagePath -----

its defined in an included php file, the other images on the page with the same $imagepath call work (its just the javascript images that dont!)


ccsup ------

is defined in an included javascript function (document.write) with a php call (echo) to $imagepath/inc/ccsup.js (which works strangley enough!)

its just the blasted pictures!

the alt comes up, so it can process the javascript var .... ccsup

im coding it for compatibillity for a cgi script which has been encoded in an exe file in C++ (the company who coded the console program refuses to give the source code!)

the server runs apache2.2 (latest one) with php 4.4.3


the output src of the images come out as http://ipaddress:8002/portal?Images=imageblahblah (i need to remove the portal bit)


anthing after the ? including the ? is fine and can stay.[/quote]
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Wed 09 Aug '06 15:35    Post subject: Reply with quote

Sure that your file extension is wrong! make sure that is only .php and not .php.txt or what ever. Windows XP/2000 normaly don't show extension of known file types.

Please post the outgiven code from your browser!

if that does not fix your problem you have to ost more of your PHP code.

Quote:

im coding it for compatibillity for a cgi script which has been encoded in an exe file in C++
you can run the exe unter PHP with exec or passthru.

Do you know how the exe chckes for an update? reading a file?
Back to top
koolholio



Joined: 09 Aug 2006
Posts: 4
Location: England, UK

PostPosted: Wed 09 Aug '06 15:42    Post subject: Reply with quote

I'm not a fool lol, they are all extensioned correctly and linked correctly, every file which is included is run, there are no calls from any files linked with it in any way to 'portal' so 'portal' is mysteriously appearing...

by the way, im working with people who have CCNP's and MCP's, so we do know the basics Razz anyway...

all the other images from that var are called, so it could just be the php and javascript compatibillity? / implementation?
Back to top
pnllan



Joined: 05 Dec 2005
Posts: 221

PostPosted: Wed 09 Aug '06 18:52    Post subject: Reply with quote

koolholio,

Please note the forum rules:

http://www.apachelounge.com/viewtopic.php?t=106

Also, your wording and grammar suggest a terse tone, if so, it's not appreciated here. Again, please note forum rules.
Back to top


Reply to topic   Topic: PHP doesn't parse a string within Javascript tags View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner