Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_php thread: Have u encountered this?????


Message #1 by "Elliott" <guru@i...> on Thu, 28 Jun 2001 23:52:25 -0400
Again, the idea is that PHP will generate everything that you want the
browser to see.

Whenever I find myself in a situation like this, you really need to
differentiate server-side and client-side script execution.

Write up a small web page that does what you want WITHOUT using PHP to
generate it... just do it by hand.

Basically, when you're done with that, you're essentially looking at the
OUTPUT of what you want generated by PHP...  If your HTML/JavaScript is
always going to be static, i.e. it's not going to be different based on DB
queries or POST/GET vars or session vars, then maybe it'd be simplest just
to do this:

<?php
   // all your normal php code...
   // ...
?>

<!-- Don't waste your processor time having php
     parse a bunch of plain echo statements, especially
     strings using double-quotes as delimiters...  So
     end the PHP script with "?>" and write all your
     HTML/JavaScript for the image map by hand.
-->

<map   name="etc...
<...>
<...>
<script language="JavaScript" ...>
  ...
</script>


<!-- If you need PHP to do more stuff after, just start
     another script block.
-->

<?php
   // oooooo yay!  more php code!
?>


Hope this helps, somehow. =)

Nik


> -----Original Message-----
> From: Elliott [mailto:guru@i...]
> Sent: Thursday, June 28, 2001 8:52 PM
> To: professional php
> Subject: [pro_php] Have u encountered this?????
>
>
> Hi I am coding a website using PHP and I recently ran into this dilemma, I
> am sortta new to php and therefore will try to explain my problem
> as clearly
> as possible
>
> This is my image map, which I am trying to create on the fly
> using php, the
> problem I am having is, I want to call a javascript function the code is
> listed below.....
>
> how can I call this function from my imagemap, in the href
>
> ---------My ImageMap-----------------------------
> echo("<map   name=\"navbar_for_admin\">");
> echo("<area shape=\"rect\" coords=\"22,0,64,21\" href=\"view.html\">");
> echo("<area shape=\"rect\" coords=\"98,1,159,21\" href=\"modify.html\">");
> echo("<area shape=\"rect\" coords=\"195,0,233,20\" href=\"add.html">\");
> echo("<area shape=\"rect\" coords=\"275,2,330,21\"
> href=\"delete.html\">");
> echo("<area shape=\"rect\" coords=\"372,0,430,22\"
> href=\"search.html\">");
> echo("<area shape=\"rect\" coords=\"678,0,747,22\"
> href=\"logout.html\">");
> echo("<area shape=\"default\" nohref>");
> echo("</map>");
>
> -----------JavaScript Code------------------------
> This javascript code displays a picture which when clicked executes the
> javascript function
> <a href="#"
> onClick="MM_openBrWindow('http://www.montreal.com','','toolbar=no,l
> cation=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width
> 640,height
> =48
> ')"><img src="poweredby.png" width="175" height="35" border="0"></a>
>
> Any help is highly appreciated.
>
> Elliott


  Return to Index