PDA

View Full Version : open pop up with ad on link click


jbgscalex
03-15-2007, 11:55 AM
Hi,

it would be cool if when a user click on a listing link it first open a pop up with some ad and then open the url clicked... since my esyndicat web site is free of use, I only get a little money with ad :-)

what do you think about that ?

Dave Baker
03-15-2007, 05:21 PM
Hello jbgscalex,
You can use code like this:

<a href="myLink.html" onclick="openpopup();return true;">myLink</a>

or

<a href="myLink.html" onclick="window.open('http://www.esyndicat.com','esyndicat'); return true;">myLink</a>

jbgscalex
03-18-2007, 04:22 PM
Dave,

can this be included in the link-display.tpl ?
so that on each click a popup opens before redirecting to the url...

I did try like this :
<a href="{$config.base}{$config.dir}view-link.php?id={$link.id}" onclick="window.open('http://www.pixelsolidarite.com'); return true;">{$lang.link_details}</a>

and it is working as long as user click on Link Details but it do not work when I try like this :

<div class="title">{if $link.crossed}@{/if} <a href="{$link.url}" onclick="window.open('http://www.pixelsolidarite.com'); return true;" class="title" id="l{$link.id}" {if $config.new_window} target="_blank" {/if} >{if $config.html_tags}{$link.title}{else}{$link.title| escape:"html"}{/if}</a>

so when users click the link name, no popup, just standard opening windows to the link url

jb

Dave Baker
03-19-2007, 05:05 PM
Hello jbgscalex,
Yes, it should be placed in .tpl files.
Please try to use the following code instead of your:

<div class="title">{if $link.crossed}@{/if} <a href="{$link.url}" class="title" {if $config.new_window}target="_blank"{/if} onclick="window.open('http://www.esyndicat.com'); return true;">{if $config.html_tags}{$link.title}{else}{$link.title| escape:"html"}{/if}</a>

jbgscalex
03-20-2007, 01:35 PM
that was the good way to do it...

thank you.

jb

Dave Baker
03-21-2007, 04:53 PM
Always at your services jbgscalex!

Sai_dallas
03-21-2007, 05:15 PM
Hi,

it would be cool if when a user click on a listing link it first open a pop up with some ad and then open the url clicked... since my esyndicat web site is free of use, I only get a little money with ad :-)

what do you think about that ?

Your visitors may not come back.
As a personal opinion if I see a site like that, I try to avoid such site.

It is a competitive word, keeping your clients is a hard job.

-- If you have good visitor base, your regular ads will pay well. (my $0.02)

Thanks

jbgscalex
03-21-2007, 05:32 PM
you are right, but it is worth a try.... at least for 2 ou 3 weeks and then analyze the result of this action.

jb

jbgscalex
03-22-2007, 01:38 PM
Dave,
doing this :
<div class="title">{if $link.crossed}@{/if} <a href="{$link.url}" class="title" {if $config.new_window}target="_blank"{/if} onclick="window.open('http://www.esyndicat.com'); return true;">{if $config.html_tags}{$link.title}{else}{$link.title| escape:"html"}{/if}</a>

then click counting is not available anymore...
any idea ?

jb

Dave Baker
03-23-2007, 04:35 PM
Yes jbgscalex, it's my fault.
There was conflict between this code:

onclick="window.open('http://www.esyndicat.com'); return true;"

and code for clicks calculation:

id="l{$link.id}"

because both pieces of code use same action for the event "onclick".
Please use this code instead of above:

<div class="title">{if $link.crossed}@{/if} <a href="{$link.url}" class="title" id="l{$link.id}" {if $config.new_window}target="_blank"{/if} onmousedown="window.open('http://www.esyndicat.com'); return true;">{if $config.html_tags}{$link.title}{else}{$link.title| escape:"html"}{/if}</a>

Here is used "onmousedown" action instead of "onclick". :)

jbgscalex
03-23-2007, 05:39 PM
unfortunatly it is only opening the esyndicat site witch is good :-) but not the link listed...

onmousedown="window.open('http://www.esyndicat.com'); return true;"

regard's
jb
http://www.univers-scalex.com

Dave Baker
03-23-2007, 08:29 PM
jbgscalex, for me code works without any problems.
I can check it, if you send me PM with your ftp credentials.

jbgscalex
03-24-2007, 10:51 AM
bonjour Dave,

using IE7 it is only opening the onmousedown="window.open(xxx)".
using Firefox 1.5.0.10 the web site do not look good.. but the 2 links opens
using Opera 9.02 it is only opening the onmousedown="window.open(xxx)".

I have made the modification on the lin-display.tpl file
I send you PM required info to look at.

thank you

jb

Dave Baker
03-25-2007, 05:06 PM
Hello jbgscalex,
I've just checked your directory.
using Firefox 1.5.0.10 the web site do not look good.. but the 2 links opens
You forgot about closing comment tag.

<!--{foreach from=$links item=link}
{include file="link-display.tpl"}
{/foreach}-->

using IE7 it is only opening the onmousedown="window.open(xxx)".
IE block pop-up windows and shows alert about it in the top of page. You just need click on it in order to allow they.
using Opera 9.02 it is only opening the onmousedown="window.open(xxx)".
Now I don't have an opera browser, but I think it's same with the IE browser.

jbgscalex
03-26-2007, 10:42 AM
thank you Dave...
and sorry for taking you time like this.
I will try to find solution before posting :-)

but on IE7 even with popup allowed... only open the onmousedown... and I have read somewhere that onclick and IE are not very good friends... (search google with "onclick and IE").
I was thinking about some script that open a window when user lives the site...

regards
jb

jbgscalex
03-27-2007, 01:28 PM
will this be possible ? and how to integrate in the tpl files ?

<SCRIPT LANGUAGE="JavaScript">

function popup(page) {
// open a new window
window.open(page,'popup','width=640,height=480,too lbar=no,scrollbars=yes');
}
</SCRIPT>

<A href="javascript : popup('http://www.siteinthepopup.com');window.location='pagetobe opened.html'">text to be clicked</A>

jb

Dave Baker
03-27-2007, 06:32 PM
Yes it will be possible, but method window.location is used for redirection, it means that you can not use one with target="_blank". Anyway you can use code like this:

<div class="title">{if $link.crossed}@{/if}<a href="javascript:popup('http://www.esyndicat.com');window.location='{$link.url}'" class="title" id="l{$link.id}">{if $config.html_tags}{$link.title}{else}{$link.title| escape:"html"}{/if}</a>

but before open templates/yourTemplate/footer.tpl and find code:

function count_link()
{
// l = link, b = banner
var tp = this.id.charAt(0);
if(tp != 'l' && tp != 'b')
{
return true;
}
if(this.id.length < 2)
{
return true;
}
itemid = this.id.substring(1);
if(parseInt(itemid.charAt(0)) < 1 || itemid.match(/\D/))
{
return true;
}
i = new Image();
h = Math.random();

i.src= root + 'click-count.php?id='+itemid+'&type='+tp+'&;h='+h;

return true;
}

***Below this code add***

function popup(page)
{
// open a new window
window.open(page,'popup','width=640,height=480,too lbar=no,scrollbars=yes');
}

***Save file***
eventually for pop up windows they use same JS methods "window.open" :)
I was thinking about some script that open a window when user lives the site...
***Open templates/yourTemplate/header.tpl and find code***

<body>

***Replace with***

<body onunload="popup('http://www.esyndicat.com');">

***Save file***
:)

jbgscalex
03-28-2007, 06:03 PM
Nice :-)
unfortunatly the <body onunload="popup('http://www.esyndicat.com');"> in header, open the popup everytim a menu link is cliked (home, top links etc...)

Great support, many thanks to all the Team !
jb

Dave Baker
03-29-2007, 07:26 PM
Always at your services jbgscalex!