Gossamer Forum
Home : Products : DBMan : Installation :

Creating pop-up windows from links

Quote Reply
Creating pop-up windows from links
I have one field in my database (Comments Smile that I finally figured out how to make linkable. Now I'd just like to make a small blank page appear in the corner instead of taking the user to another page. Can the below script be modified for use in DBMan? I found it in another forum.

Thankas again!

<<Place this in site_html.pl with your globals.

$new_win_java = '<script language="JavaScript" type="text/javascript">
<!--
function openNew(url) {
var win = window.open(url, "links2", "scrollbars,height=300,width=600");
win.focus();
}
//-->
</script>';


Then put..

&new_win_java

into the areas of sit_html.pl for the pages on which this function will work (basically puts all
the stuff you just put into globals into your page.PS this has to be within the "head" element.

And then put..

<a href="javascript penNew('your_url_to_be_linked_to_here')">
>>

p.s. I searched for this subject as I'm sure it's been addressed before in DBMan installation but couldn't find anything.

Lenny
Quote Reply
Re: Creating pop-up windows from links In reply to
It actually has been discussed in the DBMAN Discussion Forum...You can put javascript anywhere in the html section of your script between the following codes:

Code:
print qq| |;

For example you can put your javascript between the <head></head> anchors and in the link in any of the sub-routines where you want to have a pop-up window. Just make sure that you put the javascript codes between the above code example.

You do not have to create a sub-routine for this javascript...That is way to much work.
The problem with creating java script as global variables is that there are specific Perl codes, such as { and ; that would not work.

Code:

Regards.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited August 12, 1999).]
Quote Reply
Re: Creating pop-up windows from links In reply to
Dear Eliot,

Sorry I missed the earlier discussion.

I got a bit confused. Do I put the script between the main <HEAD></HEAD> tags in html.pl, then again in the sub html_record ?

Also, If I don't have to create a subroutine for the script how does it run?

Thanks!

Lenny
Quote Reply
Re: Creating pop-up windows from links In reply to
Just put the script within the <HEAD></HEAD> tags like you normally would. Then put your link in html_record.

I would make up a static html page with all your code in it to see how it all works. Just about anything that's in a static html page can be put into a DBMan page.


------------------
JPD





Quote Reply
Re: Creating pop-up windows from links In reply to
CyborgNY,

In the view_success sub-routine, insert the following java script between the <HEAD></HEAD> anchors:

Code:
<scriptlanguage="JavaScript"
type="text/javascript">
<!--
function openNew(url) {
var win = window.open(url, "links2", "scrollbars,height=300,width=600");
win.focus();
}
//-->
</script>

Example:

Code:
&html_print_headers;
print qq|
<html>
<head>
<title>$html_title: Search Results</title>
<scriptlanguage="JavaScript"
type="text/javascript">
<!--
function openNew(url) {
var win = window.open(url, "links2", "scrollbars,height=300,width=600");
win.focus();
}
//-->
</script>

</head>
<body bgcolor="#FFFFFF">

Then in the html_record sub-routine where you have links that you want a pop-up window in the html_record sub-routine, put in the following codes:

Code:
<a href="javascript penNew('your_url_to_be_linked_to_here')">

I hope this is more clear.

You can put ANY type of codes (well, almost anything...there is a problem with using SSI-Server Side Includes codes in sub-routines with cgi scripts, including DBMAN) that you use on a typical Static HTML page between the following codes in Perl scripts:

Code:
print qq| |;

Smile

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited August 13, 1999).]
Quote Reply
Re: Creating pop-up windows from links In reply to
Dear Eliot,

Thanks once again! (I love Arizona!)

I've ALMOST got it to work! Yaay! I'm getting one error that says Access Denied line 46.

Instead of putting
&new_win_open
after the print qql (in sub_html record),
I put
$new_win_open

to make it work, but it opens the window and gives an error??

If you have the time,
See:

www.bestweb.net/~cyborgny/tob/cgi-bin/dbman/main1.html

look up Henry's End

THANKS so much!

lkz

------------------
Catalyst for the new millenium

[This message has been edited by CyborgNY (edited August 13, 1999).]
Quote Reply
Re: Creating pop-up windows from links In reply to
I tried it. When I clicked on the link, I only got a blank window. I would try my suggestion first by inserting the whole first set of javascript codes in the view_success sub-routine between the <head></head> anchors.

In your source code, I noticed that the javascript codes come up AFTER the <body> tag.

Also, is your main goal to open another window for your links??? Just a personal preference...opening a whole web site into a small window is not the best choice for web design...I could understand if you are linking let's say a "survey" or "picture", but a whole web site??

If your end goal is to open a new window for the link...why not take out the java script and add this to your link anchor:

Code:
...target="_link">

So, the whole anchor would like this:

Code:
<a href="$rec{'URL'}" target="_link">$rec{'URL'}</a>

Naming a target something other than "_blank" will open each link in the same window. Also, this is less labor intensive on your part.

Smile

Just a suggestion.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Creating pop-up windows from links In reply to
Eliot,

You're absolutely right (my partner just said so)!

I created a new field (ugh) for popups (mini-reviews or pics) and for restaurants that have their own home page, I'll open a
"_new" browser.

One more query please?

I created an "icon" for my popup window links, and I want the icon to point to the new pop-up and NOT have to show the actual URL. How might I do that? (Sorry to be so curious today)

see same link, and look up Acadia Parish


Thanks again!

lkz
Quote Reply
Re: Creating pop-up windows from links In reply to
You can do the same thing with links as you do with pictures, graphics, icons, etc. What you would do is put the link anchor around the image tag.

For instance,

Code:
<a href="$rec{'FieldName'}" target="_new">
<img src="/path/to/image/*.gif" border="0" width="" height=""></a>

Change FieldName with the field you created for the "pop-up" (New Window). Replace path/to/image/*.gif with the directory path and image file. Also, add in the width and height values for these attributes.

To see an example of how this works, go to

http://www.coco.cc.az.us/

Scroll towards the bottom of page...Type in my Name, Eliot Lee, in the Search Blank.

Look at the Search Results page. You will see a small double window icon...click on it.

Also look at the Page Source of the Search Result page to see the codes I used.

Look at the Source Code via your browser and also click on the double window icon.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us

[This message has been edited by Eliot (edited August 13, 1999).]

[This message has been edited by Eliot (edited August 13, 1999).]

[This message has been edited by Eliot (edited August 13, 1999).]

[This message has been edited by Eliot (edited August 13, 1999).]