Gossamer Forum
Home : Products : DBMan : Customization :

HTML in record? How to ...

Quote Reply
HTML in record? How to ...
I'd like to store some ad management IFRAME code in our records so
that when the record is displayed, the specific ad will display.

I've tried saving the HTML in a text field, but it will not save.

Ideas? Thanks.
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
I know a solution has been posted regarding this. Have you searched the DBMan forums to see what you could find?

Try searching IFRAME or click this link

http://www.gossamer-threads.com/...username=&mh=150

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
I searched on "IFRAME", no luck. Let me clarify...

Let's say I want to enter the following iframe ad code in my decscription column:

Code:
<script language="javascript"><!--
var id=743; var jar=new Date();var s=jar.getSeconds();var m=jar.getMinutes();
var flash=s*m+id;var cgi='http://www.sitename.com/cgi-bin/adcycle';
var p='<iframe src="'+cgi+'/adcycle.cgi?gid=21&t=_top&id='+flash+'&type=iframe" ';
p+='height=60 width=468 border=0 marginwidth=0 marginheight=0 hspace=0 ';
p+='vspace=0 frameborder=0 scrolling=no>';
p+='<a href="'+cgi+'/adclick.cgi?gid=21&id='+flash+'" target="_top">';
p+='<img src="'+cgi+'/adcycle.cgi?gid=21&id='+flash+'" width=468 height=60 ';
p+='border=1 alt="Click to Visit"></a></iframe>'; document.write(p); // -->
</script><noscript><a href="http://www.sitename.com/...gi?gid=21&id=743" target="_top">
<img src="http://www.sitename.com/cgi-bin/adcycle/adcycle.cgi?gid=21&id=743" width=468 height=60 border=0></a>
</noscript>


So, next, I'd like the above code, when displayed in the dbman record, to display the actual 468x60 banner ad. In other words, I want the HTML to actually function.

I've seen some posts that say HTML does function as in my example above. But I can't make it work.

Comments?
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
It's beyond my knowledge as I don't use javascript, but perhaps someone else who is more familiar may have a solution.

You may need to do a search on just "javascript" and try and find posts related to using it within records.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
I am not sure how an Iframe is going to be displayed within your html page using this code. I would place a js call inside a table, in any event, so that it has a place-holder in your html.pl code.

You should create a separate js file with the javascript.

Save the following code:

<!--
var id=743; var jar=new Date();var s=jar.getSeconds();var m=jar.getMinutes();
var flash=s*m+id;var cgi='http://www.sitename.com/cgi-bin/adcycle';
var p='<iframe src="'+cgi+'/adcycle.cgi?gid=21&t=_top&id='+flash+'&type=iframe" ';
p+='height=60 width=468 border=0 marginwidth=0 marginheight=0 hspace=0 ';
p+='vspace=0 frameborder=0 scrolling=no>';
p+='<a href="'+cgi+'/adclick.cgi?gid=21&id='+flash+'" target="_top">';
p+='<img src="'+cgi+'/adcycle.cgi?gid=21&id='+flash+'" width=468 height=60 ';
p+='border=1 alt="Click to Visit"></a></iframe>'; document.write(p); // -->

as, say "adcycle.js" and load it into your public html directory. Then, instead of the above code, simply put <Script Language="JavaScript" src="http://www.yourdomain.com/adcycle.js"></script> inside the table.

Perl can get confused when it comes across javascript within it, and can attempt to interpret it - with bad results!

I frequently use javascript withing dbman scripts, but always use this method.

Hope you can get it to work.
-------------
David Olley
Anglo & Foreign International Limited,
http://www.firehelmets.co.uk

There are 10 types of people in the world: those who understand binary, and those who don't.
Quote Reply
Re: [davidolley] HTML in record? How to ... In reply to
David

Sorry, I'm not being clear.

First, I have successfully pasted the subject javascript into the html.pl. It does work by pasting it directly into html.pl without the need for a separate js file.

Here's the issue.

The purpose of the jscript is to display a banner from our ad management application, AdCycle. We want the banner displayed to be driven by the record. Example: Record #1 = Banner#1, Record #2 = Banner #2, and so on.

We're thinking we could accomplish this by saving the jscript code in a record column. So, when a record is displayed, the field containing the jscript would display the banner. Make sense?

The problem is that dbman will not "save" the jscript.

dbman will save simple html such as href tags and <b>bold tags, etc., but will not save / display jscript.

Does that help?
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
OK. It was not at all clear. And it still isn't. Crazy Just what exactly are you trying to display? You say a banner. Is this a graphic or something much more complex?

I do not see a problem with displaying a graphic that is determined by a record, or why it should even require javascript. Dbman, I believe, is capable of displaying graphics to order, all on its own! (Hell, there isn't much it can't do!)

I do think that is is good practice to call js files, though. Wink
-------------
David Olley
Anglo & Foreign International Limited,
http://www.firehelmets.co.uk

There are 10 types of people in the world: those who understand binary, and those who don't.
Quote Reply
Re: [davidolley] HTML in record? How to ... In reply to
David

If you look through this thread you'll see the code. It's a bit more complex than just a "graphic". And I agree, it's a no brainer to display a graphic.

This is banner ad code. The code is generated by our ad management application, AdCycle. So, the code is actually jscript to track the cookie, ensure proper refreshes, etc.

We could also use SSI, but since the page is generated by dbman and is not a "shtml" page, SSI is not an option.
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
In your db.cgi file in sub parse_form there is a line that reads:

$value =~ s/<!--(.|\n)*-->//g; # Remove SSI.

This will also prevent javascript code from being accepted in your textareas.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] HTML in record? How to ... In reply to
Lois
Should I remove that line?

$value =~ s/<!--(.|\n)*-->//g; # Remove SSI

Thanks.
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
Lois

I have v2.05 of db.cgi

In sub parse_form, I don't have the code you indicated:
$value =~ s/<!--(.|\n)*-->//g;

Comments? I wonder if this was removed previously...

If the above code doesn't exist, what's preventing my jscript from saving?
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
It's in the copy I have, but maybe I added it myself?

$value =~ s/<!--(.|\n)*-->//g; # Remove SSI.

I think it's as David stated regarding needing to use a .js file. Or search though the forum for other threads related to using banners within the script, although I don't remember anyone trying to associate each record to a specific banner.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] HTML in record? How to ... In reply to
Lois, I do appreciate your help, but I think we're off track again.

I don't think this has anything to do with jscript in the html file or
whether or not we use an external js file ...

The issue is that dbman won't let me save jscript in a textfield.

How do I do that?

Thanks again.
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
Perhaps you missed it. I have 2.05 and it is on about line 1117
Quote Reply
Re: [Paul] HTML in record? How to ... In reply to
Paul, you're right-- I missed it. Thanks.

Okay. I deleted that line and now it is saving jscript to the table.

However, the jscript [banner ad] still will not display.

Ideas?
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
Do you see any javascript errors?

Look for a yellow icon in the bottom left of your browser.
Quote Reply
Re: [Paul] HTML in record? How to ... In reply to
Nope, no jscript error. But I think I found the problem.

I compared "functional" code to the saved "dbman non-functional" code and here's what I found:

There I have several jscript lines that contain a plus "+" symbol. For example:

p+ ='height=60 width=468 border=0 marginwidth=0 marginheight=0 hspace=0 ';

Apparantly, dbman is stripping the "+" so after a save, the textfield code looks like this:

p ='height=60 width=468 border=0 marginwidth=0 marginheight=0 hspace=0 ';

Ideas?
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
Try entering them in the textarea as &#43;

Last edited by:

Paul: Jan 7, 2003, 1:49 PM
Quote Reply
Re: [Paul] HTML in record? How to ... In reply to
Nope. Returns a jscript error, "invalid character".
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
Check out this thread as it may help:

http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=188710

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [jmueller] HTML in record? How to ... In reply to
Why don't you place the JavaScript code in the HTML template, and just the values for gid and id in the database, then merge the two when the page is built?

The gid and id values are the only parts that change, right?