1 k_i_t_t_ Aug 21, 2004 21:27
3 k_i_t_t_ Aug 22, 2004 03:11
thanks but i 'am a another question, where must i past these codes? (excuse me but i'am not very good in this domain)
4 k_i_t_t_ Aug 22, 2004 23:45
please who must i past these code?
5 kiesow Aug 23, 2004 10:56
don't hurry. a forum is not a realtime-help-desk, especially not during the weekend :>
well, if you use the custom skin, you could add it before these lines
<?php // -------------------------- CALENDAR INCLUDED HERE -----------------------------
require( dirname(__FILE__).'/_calendar.php' );
// -------------------------------- END OF CALENDAR ---------------------------------- ?>
or after these
<div class="bSideBar">
<div class="bSideItem">
<h3><?php $Blog->disp( 'name', 'htmlbody' ) ?></h3>
<p><?php $Blog->disp( 'longdesc', 'htmlbody' ); ?></p>
6 k_i_t_t_ Aug 23, 2004 14:39
lol excuses me
oki i past the two codes in custom/_main.php?
7 kiesow Aug 23, 2004 18:07
if you use the custom skin, then yes add it to skins/custom/_main.php
8 mikeyboy Aug 24, 2004 18:23
Hi kiesow,
I'm interested in the new window solution, too, so thanks for the code you provided. I'm still unclear on what to put where. I understand the idea of placing the call routine in the sidebar, but where does the Java script go? I suspect somewhere towards the top of main.php, but "somewhere towards the top" leaves a lot of room for screwing up.
Thanks for any help.
Mike
9 edb Aug 24, 2004 18:51
Someone much smarter than me can verify this, but basically as long as the first piece is read before the second piece it'll work. I would put the first piece right after the BODY tag if I was going to use this.
Standard disclaimers apply: Untested code only works in my mind and may not be suitable for web authors who want things their pages to load properly. Validation may or may not happen or matter. People with javascript disabled won't be able to benefit from this but don't deserve such wonderful trinkets anyway.
10 isaac Aug 24, 2004 19:34
JavaScript functions CAN go anywhere, as long as they're before the function call. However, they SHOULD go in the HEAD segment.
Ideally, all SCRIPT tags should be in the HEAD segment only, and loop through elements using the DOM to do stuff.
11 kiesow Aug 24, 2004 19:41
i have both pieces together in the sidebar
12 mikeyboy Aug 26, 2004 05:12
Well, I implemented kiesow's code quite successfully, and even figured out how to style the form so it matched my skin. Thanks! But I'm curious, kiesow...why do you say it's bad style to force links to open in a new window? When you say
using a target is bad style. normally only the user himself should control windows or tabs, not the website
who has dictated what is "good" or "bad" style? The W3C? I have no argument or opinion on the matter myself, I'm just trying to become more educated on the philosophical issues involved.
Thanks again.
Mike
13 graham Aug 26, 2004 08:33
It's just rude, and annoying. And it breaks the back button, which is pretty much universally deemed to be a 'bad thing'.
Apply it to something else. You're driving in your car, you can't choose if you go left or right, someone else has decided that no matter what, you're going to turn left. Wouldn't that be annoying? Wouldn't you rather choose the better route for you?
14 edb Aug 26, 2004 11:11
I'm sorry Graham, but opening a new window has absolutely nothing to do with breaking the back button. When launching a link in a new window you have 2 windows: one with no history and the original window with it's complete history. Back button hijacking rewrites the history (or at least the first step backwards) of the current window, forcing the user to use the drop-down menu next to the back button.
The decision to launch a new window or replace the current window should be made based on context and application - not a hard and fast rule. Take this forum for example, which is pretty much a typical phpbb installation. Links in dynamic sections (posts) open in new windows and links in static portions (forum indexes, options across the top area) replace the current window. To my mind this method makes complete sense. Chances are good that you have not completed reading the dynamic portion of a page when you come across a link. If the link launches a new window you can simply click and continue reading. (One benefit of IE over Mozilla is the ability to launch new windows in the middle size...but not enough benefit to switch back.) There is no need to first finish this then do that, nor is there a need to manipulate a right button and a drop down menu to launch the new window. If you don't need the original window anymore no problem - you close it. The static content of a page is different. After reading some dynamic content you might want to go back to the forum index. Clicking that link will replace the current window, which is fine because you've already consumed the new content.
There is no definitive answer to this issue. Ultimately visitors who visit frequently will get to know the behaviour of the web and deal with it accordingly.
EDIT: Having given this some thought I decided to practice what I preach. My second linkblog now replaces the current window despite the inconvenience it causes me. Now I have to do the right-click-menu thing to get blogs without feeds to open in new windows/tabs, but it makes the link behaviour easier for my occasional (accidental?) visitor to figure out.
15 kiesow Aug 26, 2004 22:18
mikeyboy wrote:
who has dictated what is "good" or "bad" style? The W3C? I have no argument or opinion on the matter myself, I'm just trying to become more educated on the philosophical issues involved.
no one dictated what is good and what is bad. it's just a kind of user friendlyness.
if you (as the webdesigner) specify that a new window has to open, you are going to "steal" the visitor the control of his browser. most browser make it really easy for a visitor to decide by himself if he wants a new window (middle button) or re-use the existing window (left button).
it's not forbidden to use a target _blank but it's not nice to the visitor.
i hope you understand the point - unfortunately my english is not good enough to explain it as i would like to :(
it's just a recommandation to let the visitor decide if he want to have a new window or not.
most webdesigner add the target _blank because they want the visitor to stay longer. but would you stay at a website just because new links open in new window? i guess no.
16 mikeyboy Aug 27, 2004 06:21
I actually never realized "Open link in a new window" was a right-click option. Now I do. I bet 98% of PC users don't realize that.
Interesting.
Thanks for the feedback.
Michael
17 mikeyboy Sep 02, 2004 07:40
By the way, for anyone who reads the previous posts in this thread and implements the solution discussed, be aware that the anchor tag in the following code is not necessary to make the form work. In fact, I'm not sure what the purpose of the anchor tag was intended to be when kiesow posted the code, and it does things that I don't really understand or approve of.
<form>
<input type="checkbox" name="targetnew"
onclick="targetLinks(this.checked)">
<a href="#" onclick="alert('Check the box\nand links will\nopen in a new window.');"
onmouseover="window.status='Check the box and links will open in a new window'; return true"
onmouseout="window.status=' '; return true">New window</a>
</form>
Instead of the anchor tag, you can simply include some text, as in the following, which I am now using on my _main.php
<form>
<input type="checkbox" name="targetnew"
onclick="targetLinks(this.checked)">
Check if you want links to open in a new window
</form>
This way, you get links opening in a new window, and nothing else.
Michael
18 isaac Sep 03, 2004 18:21
Mikeyboy,
Could you post this as a tutorial in the client-side-stuff forum? This is a question that comes up from time to time, and it'd be nice to have a good tutorial out there.
That would also give us a spot to maybe discuss other ways to do the same thing, share javascripts, and so on :)
19 isaac Sep 13, 2004 04:23
Moved from how-to.
the right code is
but using a target is bad style. normally only the user himself should control windows or tabs, not the website.
a much better solution is this javascript
call it via a simple form somewhere in the sidebar (for example)