PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
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 Back to top

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: 16987
Location: Kansas

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

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 Visit poster's website AIM Address Yahoo Messenger
djw2
Regular
Regular


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

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

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
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: 16987
Location: Kansas

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

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;
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
djw2
Regular
Regular


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

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

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?
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: 16987
Location: Kansas

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

Just try my code and see if that resolves it.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
djw2
Regular
Regular


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

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

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.
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: 16987
Location: Kansas

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

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;
?>
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
djw2
Regular
Regular


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

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

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?
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
djw2
Regular
Regular


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

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

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.
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: 16987
Location: Kansas

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

Remove your original echo statement and just leave my code. Yours is syntactically wrong.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
djw2
Regular
Regular


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

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

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
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
djw2
Regular
Regular


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

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

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.
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
djw2
Regular
Regular


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

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

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?
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: 16987
Location: Kansas

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

If it's works then try it.
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
djw2
Regular
Regular


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

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

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.
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: 16987
Location: Kansas

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

Code:
<a href="#" onClick="winOpen('issues.html','issues','scrollbars=yes,width=800,height=600')">issues</a>
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
djw2
Regular
Regular


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

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

That was it!

Thanks Raven, you ROCK!


PEACE!

Dan
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
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.

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum