Pop Up

Help with html/xhtml, css, javascript and other related topics.

Moderator: Moderators

Pop Up

Postby DooBDee on Thu May 26, 2005 5:40 pm

Greetings,

I am trying to do sometihng so that when the user visits the forum a pop up opens and encourages them to visit.

In my overal_header of CA_APHRODITE:

[FIND:]
Code: Select all
{L_LOGIN_LOGOUT}


[ADD AFTER:]
Code: Select all
<!-- BEGIN switch_user_logged_out -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=350,left = 387,top = 259');");
}
// End -->
</script>
<BODY onLoad="javascript:popUp('popup.tpl')">

<!-- END switch_user_logged_out -->

I upload popup.tpl and overall_header, bt does not work. Any reason why ?
DooBDee
Website Ninja
DooBDee.net
User avatar
DooBDee
Moderator
Moderator
 
Posts: 3530
Joined: Tue Mar 01, 2005 6:28 pm
Location: DooBDee.net

Postby Thatbitextra on Thu May 26, 2005 5:55 pm

There's a more annoying version of this here.
My MODs: [NEW] Choose Who to Accept PMs From (Prevents you from receiving unwanted PMs!) | Warn of Old Topic Before Posting Reply
Style: subBlack (Now updated to phpBB 2.0.22 and 5 new color schemes!)

Please note, I do NOT offer support via PM. It's a forum, so post your question, then everyone can help.
User avatar
Thatbitextra
Moderator
Moderator
 
Posts: 1821
Joined: Thu Mar 24, 2005 1:11 pm
Location: A place where something is or could be located; a site.

Postby DooBDee on Thu May 26, 2005 6:03 pm

i dont want that, i just want alittle reminder box ;)

But that code does not seem to be working, any idea why?
DooBDee
Website Ninja
DooBDee.net
User avatar
DooBDee
Moderator
Moderator
 
Posts: 3530
Joined: Tue Mar 01, 2005 6:28 pm
Location: DooBDee.net

Postby Thatbitextra on Thu May 26, 2005 6:12 pm

Your url should be relative to the forum root path.
My MODs: [NEW] Choose Who to Accept PMs From (Prevents you from receiving unwanted PMs!) | Warn of Old Topic Before Posting Reply
Style: subBlack (Now updated to phpBB 2.0.22 and 5 new color schemes!)

Please note, I do NOT offer support via PM. It's a forum, so post your question, then everyone can help.
User avatar
Thatbitextra
Moderator
Moderator
 
Posts: 1821
Joined: Thu Mar 24, 2005 1:11 pm
Location: A place where something is or could be located; a site.

Postby DooBDee on Thu May 26, 2005 6:15 pm

Greetings,

so should it be :

Code: Select all
<!-- BEGIN switch_user_logged_out --> 
<SCRIPT LANGUAGE="JavaScript"> 
<!-- Begin 
function popUp(URL) { 
day = new Date(); 
id = day.getTime(); 
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=350,left = 387,top = 259');"); 

// End --> 
</script> 
<BODY onLoad="javascript:popUp('templates/ca_aphrodite/guests_register.tpl')"> 

<!-- END switch_user_logged_out -->


All i want is for the box to be like the notification of the private message.

So, would this work?
DooBDee
Website Ninja
DooBDee.net
User avatar
DooBDee
Moderator
Moderator
 
Posts: 3530
Joined: Tue Mar 01, 2005 6:28 pm
Location: DooBDee.net

Postby UseLess on Thu May 26, 2005 6:33 pm

Greetings,

No it won't work.

The template is being loaded by the client via Javascript and is therefore not going to be parsed by the template engine.

A better method would be to create a php file and load that, the php file would then assign the template and parse it...
Movie Quote:
It's not the years honey, it's the mileage...

I do not provide any install services for phpBB, Mods or Styles.
Please do not pm me for support/scripting help - you won't get any reply. If you have a question then make a post in the appropriate forum.
User avatar
UseLess
Registered User
Registered User
 
Posts: 6220
Joined: Mon Sep 27, 2004 2:14 am
Location: North East, UK

Postby DooBDee on Thu May 26, 2005 6:40 pm

do yuo mean just put that javascript into a php file

and then in overall_header.tpl use include() ?
DooBDee
Website Ninja
DooBDee.net
User avatar
DooBDee
Moderator
Moderator
 
Posts: 3530
Joined: Tue Mar 01, 2005 6:28 pm
Location: DooBDee.net

Postby UseLess on Thu May 26, 2005 7:58 pm

Greetings,

No, I mean create a PHP file that loads the phpBB common files: extension.inc, common.php and then assigns a template to use in this case 'guests_register.tpl' it then assigns any variables to the template and then parses it.

The PHP file is then loaded by the javascript you mentioned above so instead of a URL of 'templates/ca_aphrodite/guests_register.tpl' you would use 'popup.php' this would then display the reminder.
Movie Quote:
It's not the years honey, it's the mileage...

I do not provide any install services for phpBB, Mods or Styles.
Please do not pm me for support/scripting help - you won't get any reply. If you have a question then make a post in the appropriate forum.
User avatar
UseLess
Registered User
Registered User
 
Posts: 6220
Joined: Mon Sep 27, 2004 2:14 am
Location: North East, UK

Postby UseLess on Thu May 26, 2005 10:07 pm

Greetings,

OK this has been bugging me, so I thought about a simpler way.

Just use the existing switch 'user_logged_out' and wrap it around some html in 'overall_header.tpl', so when someone is logged out it asks them to either login or register, as it's in the overall header then it will appear on every page while that user is not logged in once logged in it disappears.

Another problem with a popup is most people dislike them and therefore block them, so it could not be viewable by guests anyway.
Movie Quote:
It's not the years honey, it's the mileage...

I do not provide any install services for phpBB, Mods or Styles.
Please do not pm me for support/scripting help - you won't get any reply. If you have a question then make a post in the appropriate forum.
User avatar
UseLess
Registered User
Registered User
 
Posts: 6220
Joined: Mon Sep 27, 2004 2:14 am
Location: North East, UK

Postby DooBDee on Fri May 27, 2005 5:51 pm

Isn't that what im trying to do in the first place?

Here is part of my overall_header.tpl:

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="Author" content="http://www.phpbbstyles.com" />
{META}
{NAV_LINKS}
<title>{SITENAME} :: {PAGE_TITLE}</title>
<link rel="stylesheet" href="templates/ca_aphrodite/style.css" type="text/css" />
<script language="javascript" type="text/javascript" src="templates/ca_aphrodite/scripts.js"></script>
{CA_INLINE_CSS}
<!-- IE conditional comments: http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp -->
<!--[if IE]>
<style type="text/css">
/* IE hack to emulate the :hover & :focus pseudo-classes
   Add the selectors below that required the extra attributes */
.row1h, .row1h-new { behavior: url("templates/ca_aphrodite/pseudo-hover.htc"); }
</style>
<![endif]-->
</head>
<body onload="PreloadFlag = true;">
<a name="top"></a>
<table cellspacing="0" width="100%" id="forum">
<tr>
   <td class="forum-header" align="left"><a href="{U_INDEX}" title="{L_INDEX}"><img src="templates/ca_aphrodite/images/logo.gif" height="63" alt="{L_INDEX}" /></a></td>
   <td class="forum-header header-search" align="right" valign="bottom">
      <form action="{U_SEARCH}" method="get"><input name="search_keywords" type="text" class="post" style="width: 100px;" /> <input type="submit" class="liteoption" value="{L_SEARCH}" /></form>
   </td>
</tr>
<tr>
   <td colspan="2" class="forum-buttons" valign="middle">
            <a href="http://www.doobdee.net/site/index.php">Site</a> •
            <!-- BEGIN switch_user_logged_out -->
            <a href="{U_REGISTER}">{L_REGISTER}</a> •
            <!-- END switch_user_logged_out -->
            <!-- BEGIN switch_user_logged_in -->
            <a href="{U_PROFILE}">{L_PROFILE}</a> •
            <a href="{U_PRIVATEMSGS}">{L_PRIVATEMSGS}</a> •
            <!-- END switch_user_logged_in -->
            <a href="{U_SEARCH}">{L_SEARCH}</a> •
            <a href="{U_FAQ}">{L_FAQ}</a> •
            <a href="{U_MEMBERLIST}">{L_MEMBERLIST}</a> •
            <a href="{U_GROUP_CP}">{L_USERGROUPS}</a> •
            <a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a>
<!-- BEGIN switch_user_logged_out -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=350,left = 387,top = 259');");
}
// End -->
</script>
<BODY onLoad="javascript:popUp('templates/ca_aphrodite/popup.tpl')">

<!-- END switch_user_logged_out -->
DooBDee
Website Ninja
DooBDee.net
User avatar
DooBDee
Moderator
Moderator
 
Posts: 3530
Joined: Tue Mar 01, 2005 6:28 pm
Location: DooBDee.net

Postby UseLess on Fri May 27, 2005 6:06 pm

Greetings,

Yes I know that's what your trying to do, but as previously explained it will not work.

1. the URL your passing is a <path> to a tpl file, therefore it's invalid, remember that javascript runs on the client side therefore it should be 'http://www.yourdomain.com/forum/templates/ca_aphrodite/popup.tpl'
2. because your passing a tpl to the popup function, it will not be parsed by the template engine and will therefore be shown as is which means it'll display not like you want or expect it to, try it with this: http://www.doobdee.net/forums/templates ... x_body.tpl as that will how it will be displayed
3. as previously stated you should create a PHP file that loads uses template and populates it with the required information if required it will then work, unless people have popups blocked in which case it won't be shown.

Edit: and the above code would result in 2 <body> tags if a user was not logged in... one of them in the wrong place...
Movie Quote:
It's not the years honey, it's the mileage...

I do not provide any install services for phpBB, Mods or Styles.
Please do not pm me for support/scripting help - you won't get any reply. If you have a question then make a post in the appropriate forum.
User avatar
UseLess
Registered User
Registered User
 
Posts: 6220
Joined: Mon Sep 27, 2004 2:14 am
Location: North East, UK

Postby DooBDee on Fri May 27, 2005 6:14 pm

Thanks for the help useless,

I will generate the php file in a sec and will let you know how I get on.
DooBDee
Website Ninja
DooBDee.net
User avatar
DooBDee
Moderator
Moderator
 
Posts: 3530
Joined: Tue Mar 01, 2005 6:28 pm
Location: DooBDee.net

Postby DooBDee on Fri May 27, 2005 6:51 pm

Greetings,

I have done the following:

in overall_header.tpl,

i have :

Code: Select all
<tr>
   <td colspan="2" class="forum-buttons" valign="middle">
            <a href="http://www.doobdee.net/site/index.php">Site</a> •
            <!-- BEGIN switch_user_logged_out -->
            <!-- INCLUDE guests_register.php -->
            <a href="{U_REGISTER}">{L_REGISTER}</a> •
            <!-- END switch_user_logged_out -->
            <!-- BEGIN switch_user_logged_in -->
            <a href="{U_PROFILE}">{L_PROFILE}</a> •
            <a href="{U_PRIVATEMSGS}">{L_PRIVATEMSGS}</a> •
            <!-- END switch_user_logged_in -->
            <a href="{U_SEARCH}">{L_SEARCH}</a> •
            <a href="{U_FAQ}">{L_FAQ}</a> •
            <a href="{U_MEMBERLIST}">{L_MEMBERLIST}</a> •
            <a href="{U_GROUP_CP}">{L_USERGROUPS}</a> •
            <a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a>
      </td>
</tr>


Then, in guests_register.php, i have: (This file is in ca_aphrodite foler)

Code: Select all
<?php 
define('IN_PHPBB', true); 
$phpbb_root_path = './'; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 

// Session Start 
$userdata = session_pagestart($user_ip, PAGE_INDEX); 
init_userprefs($userdata); 

// Page Output Start 
$page_title = " Register To Take Advantages Of Our Free Services  "; 
include($phpbb_root_path . 'includes/page_header.'.$phpEx); 

        $template->set_filenames(array(
                'body' => 'popup.tpl')
        );


include($phpbb_root_path . 'includes/page_tail.'.$phpEx);


But im not sure where to go from there.

Do i then put popup.tpl in ca_aphrodite foldere:

Code: Select all
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=350,left = 387,top = 259');");
}
// End -->
</script>
<BODY onLoad="javascript:popUp('popup.tpl')">


I'm quite confused :s
DooBDee
Website Ninja
DooBDee.net
User avatar
DooBDee
Moderator
Moderator
 
Posts: 3530
Joined: Tue Mar 01, 2005 6:28 pm
Location: DooBDee.net

Postby UseLess on Fri May 27, 2005 7:20 pm

Greetings,

It's really quite simple...

1. popup.php in root of forum
2. popup.tpl in templates/<style>

[code filename="popup.php"]<?
/*
PopUp script control

Written 27 May 2005
(c) 2005 UseLess


This script is supplied as is, your free to use/modify this script to
suit your needs but the copyright notice above should remain.
*/

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

$gen_simple_header = TRUE;
$page_title = 'Another annoying PopUP Window';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array('body' => 'popup.tpl'));

// Assign common vars
$template->assign_vars(array(
'L_WELCOME_TEXT' => 'Welcome Guest',
'L_WELCOME_MSG_1' => 'Already registered then',
'L_WELCOME_MSG_2' => ', if you want to register and get rid of this annoying box then you may do so here',
));

$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>[/code]

popup.tpl

[code filename="popup.tpl"]<div class="forumline nav-div">
<p class="nav-header">{L_WELCOME_TEXT}</p>
<p align="left" style="padding: 2px;">{L_WELCOME_MSG_1} <a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a>{L_WELCOME_MSG_2}: <a href="{U_REGISTER}">{L_REGISTER}</a></p>
</div>[/code]

Assuming your using Aphrodite.

1. Place the popup function in 'scripts.js' (without the switches)
2. Place this in overall_header.tpl, the end of the file will do

Code: Select all
<!-- BEGIN switch_user_logged_out -->
<script language="javascript">
popUp('popup.php');
</script>
<!-- END switch_user_logged_out -->


There you have it, yet another annoying popup....
Movie Quote:
It's not the years honey, it's the mileage...

I do not provide any install services for phpBB, Mods or Styles.
Please do not pm me for support/scripting help - you won't get any reply. If you have a question then make a post in the appropriate forum.
User avatar
UseLess
Registered User
Registered User
 
Posts: 6220
Joined: Mon Sep 27, 2004 2:14 am
Location: North East, UK


Return to (X)HTML Coding

Who is online

Users browsing this forum: No registered users and 1 guest