Re: Apply the hyper link ( javascript functon ) with php
| From: | Andrei | Date: | Wed, 11 Oct 2006 06:08:30 +0000 |
| Subject: | Re: Apply the hyper link ( javascript functon ) with php | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-242956@lists.php.net to get a copy of this message | ||
Make sure your $dir variable isn't containing the path to your file from
your OS file system. This should be an apache (or whatever) path (an URL).
Andy
edwardspl@ita.org.mo wrote:
> Richard Lynch wrote:
>
>> On Sun, October 8, 2006 6:53 pm, edwardspl@ita.org.mo wrote:
>>
>>
>>> How to apply the following function with php ?
>>> <a href=javascript:popup('index.htm')> Test </a>
>>>
>>>
>> If you're new to PHP, be a minimalist, and pull out PHP only when you
>> absolutely have to:
>>
>> <a href="javascript:popup('<?php echo $dir?>/index.htm')">
>> Test </a>
>>
>> Since $dir is the ONLY part you want to be changing, use PHP only for
>> that part.
>>
>> Switching in/out of PHP like this is very fast/cheap, and leaves you
>> with HTML that mostly looks just like you are used to.
>>
>> YMMV
>>
>>
>>
> Hello to you,
>
> php web page ( test.php ) :
>
> <script language="javascript" type="text/javascript">
> <!--
> function popup(page)
> {
> window.open(page,title, "height=100,width=100");
> }
> // -->
> </script>
>
> <a href="javascript:popup('./<?php echo $dir?>/index.htm')">
> Test </a>
>
> Result : "homepage error"
>
> Web Server error log :
>
> [Tue Oct 10 18:07:36 2006] [error] [client 202.108.22.70] File does not
> exist: /home/web/index.htm
> [Tue Oct 10 18:10:12 2006] [error] [client 61.135.145.217] File does not
> exist: /home/web/test2004.htm
> [Tue Oct 10 18:10:14 2006] [error] [client 61.135.145.217] File does not
> exist: /home/web/readme.htm
>
> Please help, thanks !
>
> Edward.
>