Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.0
Author Message
djw2
Regular
Regular



Joined: Sep 19, 2003
Posts: 95
Location: St. Louis, MO

PostPosted: Sun Jan 04, 2004 9:55 am Reply with quote

Hey Raven and the gang,

I want to open a couple html pages in a popup window from a page in the content module but I'd like the option of using a popup from anywhere so can I do a global popup script?

I read the script needs to be in includes/javascript.php but when I looked at that file it obviously wasn't standard javascript.

Here's the copyright script from that file.

Code:
global $module, $name;


if ($module == 1 AND file_exists("modules/$name/copyright.php")) {
    echo "<script type=\"text/javascript\">\n";
    echo "<!--\n";
    echo "function openwindow(){\n";
    echo "   window.open (\"modules/$name/copyright.php\",\"Copyright\",\"toolbar=no,location=no,
directories=no,status=no,scrollbars=yes,resizable=no,
copyhistory=no,width=400,height=200\");\n";
    echo "}\n";
    echo "//-->\n";
    echo "</SCRIPT>\n\n";
}


This is essentially what I want but what script would I add to the file?

Does every window need it's own script listed here?

How then do I call that script from a link tag?


Thanks.

Dan
 
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Jan 04, 2004 10:03 am Reply with quote

Actually, it is standard javascript. PHP echos the code to the browser.

Just write your own popup function and place it in includes/my_header.php or add it as a function in mainfile.php. Then just call the function as needed in your page. Or, you could also add a target="" attribute to the anchor tag (link) in your pages.
 
View user's profile Send private message
djw2







PostPosted: Sun Jan 04, 2004 10:16 am Reply with quote

Okay... so I add this script to includes/my_header.php

Code:
echo "<script language="JavaScript">

<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script> ";


But when I call the script with this link.

Code:
<a href="javascript:MM_openBrWindow('issues.html','issues','scrollbars=yes,width=800,height=600')">issues</a>


I get this message.

Quote:
The html tags you attempted to use are not allowed


What am I doing wrong?


Thanks again.

Dan
 
Raven







PostPosted: Sun Jan 04, 2004 10:27 am Reply with quote

Could be a couple of things. When you first open your main web page and do a browse source, do you see your javascript function towards the top of the page? If not, then you have to either echo it to the browser or use the HEREDOC syntax. Place this code in my_header.php before the closing ?> tag
Code:
$js = <<<_JS_

<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
_JS_;
echo $js;
 
djw2







PostPosted: Sun Jan 04, 2004 10:32 am Reply with quote

Okay I'll try that, but what about the whole "The html tags you attempted to use are not allowed" thing.

What do I need to do to call the script?
 
Raven







PostPosted: Sun Jan 04, 2004 10:35 am Reply with quote

Just try my code and see if that resolves it.
 
djw2







PostPosted: Sun Jan 04, 2004 11:03 am Reply with quote

Okay, with the last script you gave me I get

Quote:
Parse error: parse error in /home/dwhelan/public_html/imwithdennis/includes/my_header.php on line 35


Line 35 of my_header.php has

Quote:
$js = <<<_JS_


Oops.
 
Raven







PostPosted: Sun Jan 04, 2004 11:06 am Reply with quote

It works fine here, so it's your syntax. That code must be between the php tags, as in
Code:
<?

$js = <<<_JS_
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
_JS_;
echo $js;
?>
 
djw2







PostPosted: Sun Jan 04, 2004 11:08 am Reply with quote

BTW

This script is already in the my_header.php

Code:
echo "<script language=\"JavaScript\">

<!--
function winOpen(URL) {
window.open(
   URL,
   'popup',
   'width=800,height=600,resizable=1,'
);
}
// -->
</script> ";


Why could I just call that one?

Although, it's resizable and I don't want that... and I need scrollbars as needed... but that's a popup script right? Is that the copyright script?
 
djw2







PostPosted: Sun Jan 04, 2004 11:10 am Reply with quote

It was inside the php tags.

Just like this

Code:
<?php


/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

/*
   This file is to customize whatever stuff you need to include in your site
   when the header loads. This can be used for third party banners, custom
   javascript, popup windows, etc. With this file you don't need to edit
   system code each time you upgrade to a new version. Just remember, in case
   you add code here to not overwrite this file when updating!
   Whatever you put here will be between <head> and </head> tags.
*/
echo "<script language=\"JavaScript\">
<!--
function winOpen(URL) {
window.open(
   URL,
   'popup',
   'width=800,height=600,resizable=1,'
);
}
// -->
</script> ";

$js = <<<_JS_
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
_JS_;
echo $js;

?>


$js = <<<_JS_ is line 35.
 
Raven







PostPosted: Sun Jan 04, 2004 11:16 am Reply with quote

Remove your original echo statement and just leave my code. Yours is syntactically wrong.
 
djw2







PostPosted: Sun Jan 04, 2004 11:19 am Reply with quote

That isn't mine... that's there already.

I don't know what it is but I'm afraid if I remove it then something isn't going to work.

Confused
 
djw2







PostPosted: Sun Jan 04, 2004 11:23 am Reply with quote

I just opened the original my_header.php from the core files and the script isn't there so I don't know what it is.

I have never edited this file before today... how strange.
 
djw2







PostPosted: Sun Jan 04, 2004 11:27 am Reply with quote

I'm sorry. I hadn't "edited" the file but I did overwrite it.

That's the NukeTV popup script. I could just call it couldn't I?
 
Raven







PostPosted: Sun Jan 04, 2004 11:33 am Reply with quote

If it's works then try it.
 
djw2







PostPosted: Sun Jan 04, 2004 11:48 am Reply with quote

It does work in NukeTV.

Here's how they call it

Code:
<a href=\"#\" onClick=\"winOpen('modules.php?name=$ModName&file=cadena&cadena=".$ligne["id"]."')\">".$ligne["cadena"]."</a>


But they’re calling it from NukeTV/index.php.

I need to call it from a link on a content page so how does that translate to a html link?

Here the way I was trying it.

Code:
<a href="javascript:winOpen('issues.html','issues','scrollbars=yes,width=800,height=600')">issues</a>


But I had the html not allowed error and this code is specifying the window size in the script.

Code:
echo "<script language=\"JavaScript\"> 

<!--
function winOpen(URL) {
window.open(
   URL,
   'popup',
   'width=800,height=600,resizable=1,'
);
}
// -->
</script> ";


I'm not going to be able to call the dimensions too.

Do you know how my link should look?

Thanks for all your help.
 
Raven







PostPosted: Sun Jan 04, 2004 12:08 pm Reply with quote

Code:
<a href="#" onClick="winOpen('issues.html','issues','scrollbars=yes,width=800,height=600')">issues</a>
 
djw2







PostPosted: Sun Jan 04, 2004 12:16 pm Reply with quote

That was it!

Thanks Raven, you ROCK!


PEACE!

Dan
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.0

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©