Re: Replacing JavaScript functionality with PHP
| From: | DAve Goodrich | Date: | Tue, 15 May 2001 19:01:37 +0000 |
| Subject: | Re: Replacing JavaScript functionality with PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-52911@lists.php.net to get a copy of this message | ||
on 5/15/01 10:47 AM, Richard Notley at richard.notley@oracle.com wrote:
> Hi,
>
> I'm rewriting some web pages trying to replace a lot of JavaScript with
> PHP (before including some mySQL for even more dynamic content);
> however, I am having a little difficulty in one area...
>
> Currently, if a page is displayed in the main window for the site, then
> a menu is displayed on the left (where else); however, if the same page
> is displayed in a popup window, then the menu is suppressed. This
> works because, the site launches all popup windows with the same name,
> 'popupWin', so I can use if (self.name == 'popupWin')... in the
> JavaScript to suppress the menu. The HTML for the menu is built
> dynamically by the JavaScript.
>
> I can't see how PHP (on the server) will know about the browser window
> name, so is there a way to reproduce this functionality in PHP?
>
> I'm new to PHP, so apologies if this is a time-waster. I spent quite a
> while looking through the archives, but... well needles and haystacks!
>
I think..... this is what you are asking, this ain't tested!!!!!!!
Add a test to your page like so,
<?php
if ( !isset $gHide ) {
$gNavigation = "<table><tr><td>";
$gNavigation .= "My Navigation";
$gNavigation .= "</td></tr></table>";
print $gNavigation;
}
?>
Then add the following to your page,
<script language='javascript'>
function openMe(tURL) {
popWin = window.open(tURL,'popWin','featureList');
}
</script>
<a href="javascript:openMe('myPage.php?gHide=true');">Click</a>
$gNavigation will be printed so long as $gHide is unset, but it you call the
page passing the $gHide param, the navigation will be suppressed.
--
Dave Goodrich
Director of Interface Development
Reality Based Learning Company
9521 NE Willows Road, Suite 100
Redmond, WA 98052
Toll Free 1-877-869-6603 ext. 237
Fax (425) 558-5655
daveg@rblc.com
http://www.rblc.com