[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4284: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4286: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4287: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4288: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
www.dhtmlgoodies.com • View topic - Adding function to Content Organiser script?
Page 3 of 4

PostPosted: Tue Sep 26, 2006 3:16 pm
by Batalf

PostPosted: Tue Sep 26, 2006 3:18 pm
by divtag32

PostPosted: Tue Sep 26, 2006 3:21 pm
by Batalf

PostPosted: Tue Sep 26, 2006 3:22 pm
by divtag32


:lol: :lol: :lol: :lol: :lol: :lol: :lol: :lol:

It all works perfectly! It looks superb.

Thank you so much for your help - you've been quite ridiculously patient!

PostPosted: Tue Sep 26, 2006 3:36 pm
by divtag32
just when I was tidying up code and stuff one oddity is that I can't seem to put images outside the page's directory - so :

imgs[0] = "../images/barclays.jpg";
imgs[1] = "clydesdale.jpg";
imgs[2] = "hsbc.jpg";
imgs[3] = "natwest.jpg";
imgs[4] = "nationwide.jpg";
imgs[5] = "lloydstsb.jpg";
imgs[6] = "hbos.jpg";

won't load the file for imgs[0]

Is there a reason this happens - it just seems to be a little wasteful having to put every logo in every directory I use this!?

I also still get the error 'mystring' is null or is not an object when I manually navigate to the page or refresh it (ie don't use your nifty hyperlink to the exact article thing!) - but if you can't be bothered - I'm sure I can live with it!

PostPosted: Tue Sep 26, 2006 4:04 pm
by Batalf
You should be able to put images outside the directory.

Remeber that the directory is relative to the file where your js code is located.

So in case you have a js directory, you might have to use

imgs[0] = "../../images/barclays.jpg";

instead of

imgs[0] = "../images/barclays.jpg";

I'm not sure why get get the myString error

Can you post your last version of checkText so that I can take a look at it?

PostPosted: Wed Sep 27, 2006 8:11 am
by divtag32

PostPosted: Wed Sep 27, 2006 9:00 am
by Batalf

PostPosted: Wed Sep 27, 2006 9:01 am
by divtag32

PostPosted: Wed Sep 27, 2006 11:45 am
by divtag32
Hmm so is this taking the end off the name
rExp = imgs[i].substring(0,imgs[i].length-4);

And then is this adding the relevant URL?
document.getElementById(rExp+'img').setAttribute('src',imgs[i]);

So maybe:

document.getElementById(rExp+'img').setAttribute("../../images/'src',imgs[i]);

Or is that stupid?!

PostPosted: Wed Sep 27, 2006 11:49 am
by Batalf

PostPosted: Wed Sep 27, 2006 12:28 pm
by divtag32
That works perfectly - interestingly it only works relative to the htm file, not the js file (which I understand is the norm!) but it works exactly right - man I'm actually beginning to understand this stuff! It's cool!

Now I'm going to try and work something out myself - the window keeps jumping up and down when I click each link (it seems pretty random - it's just between 1-40pxs jumps but it's a little annoying and breaks the super-smooth glossy look of my all-singing all-dancing mag! ;)

So I've found a likely suspect:

var topPos = getTopPos(elementToShow);

window.scrollTo(0,Math.max(0,topPos - elementToShow.offsetHeight));
if(tocStyle==1)return false;

So this looks like you're creating a var called topPos and that's referring to the function gettoppos:

function getTopPos(inputObj)
{
var returnValue = inputObj.offsetTop;
while((inputObj = inputObj.offsetParent) != null){
returnValue += inputObj.offsetTop;
}
return returnValue;
}

And you're setting the top position to the height of the current chapter item?!


And damn I'm lost! Is this garbage or am I on the right tracks?

It looks like:

window.scrollTo(0,Math.max(0,topPos - elementToShow.offsetHeight));

Is my prime suspect - this looks like it's scrolling the window but I can't understand:

(0,Math.max(0,topPos - elementToShow.offsetHeight));

guessing is the first 0 for the x pos of the screen and the second for the y?

that'd mean math.max is then following the same logic with the 0 being the x and the y being toppos - elementtoshow.offsetheight

so I 'could' just change it to:

(0,Math.max(0,0));

Or even:

(0,0);

AND IT WORKS!

Cool! - I know it's probably an incredibly inefficient way of doing things, but I don't want to break it all and I feel I'm actually understanding this language now...

Look out for my amazing scripts I'll be submitting to your site in a couple of months!



[/code]

PostPosted: Wed Sep 27, 2006 12:38 pm
by Batalf
I'm glad you figure it out.

Yes, the scrollTo() function is there to scroll down to the element you're going to. In case you have a lot of content on each "page", it will scroll down to the heading of the item you clicked on in the menu.

If you don't want that feature, then it's correct to either remove the scrollTo() call or just scroll to 0,0 as you have done.

PostPosted: Wed Sep 27, 2006 12:49 pm
by divtag32
Heh! Dammit - I've just found the down-side on one of my pages that is longer!

Ok what I need is it to not jump all the time - but if the chapter item is off the page, then to jump down.

var topPos = getTopPos(elementToShow);

window.scrollTo(0,Math.max(0,topPos - elementToShow.offsetHeight));
if(tocStyle==1)return false;

Maybe saying:

If(contentitem yposition > screenheight)

THEN
window.scrollTo(0,Math.max(0,topPos - elementToShow.offsetHeight));
if(tocStyle==1)return false;

ELSE
window.scrollTo(0,0));
if(tocStyle==1)return false;

?

Is there a JS way of getting the value for the height of the user's screen and the ypos of your content item element?

PostPosted: Wed Sep 27, 2006 12:53 pm
by Batalf
Try using

document.body.clientHeight

instead of screenHeight