TinyPortal

General => Chit chat => Topic started by: Bec on March 29, 2009, 06:48:05 AM

Title: Problems with scripts
Post by: Bec on March 29, 2009, 06:48:05 AM
Hi Guys,

Totally unrelated tp matter here. I am just after some advice, how the hell do I tell if I have conflicting scripts on my site?

I am calling mootools for both my theme and tp (as I recently found out) and I have just reinstalled my tickerscript on my site and they are refusing to work for me. I have a feeling it might be conflicting with my other two scripts but how do I tell for sure? Not sure but I think my tickers are calling javascript...

Hope that makes sense! Any advice would be appreciated!
Title: Re: Problems with scripts
Post by: G6Cad on March 29, 2009, 09:32:09 AM
The only way to tell is to check the error log for errors, and then go the trial and error way.

Deactivate all blocks, and then start to activate them one by one until you find the one that causes the issues.
Title: Re: Problems with scripts
Post by: Bec on March 29, 2009, 02:50:07 PM
Thanks :)

I am going to try and explain what is happening - total noob when it comes to this so if it doesn't make sense at all, I warned ya lol

I know its a totally unrelated tp issue but I am hoping someone out there will know how to fix it or if you can recommend somewhere else for me to look I would greatly appreciate it!

For starters:-

- my theme calls upon mootools & moomenu
- tp calls upon mootools as well

I also have a tickerscript installed [url removed] and this calls upon javascript "form_processor.js" (from what i can see im pretty sure this is correct)

When you go through the process of trying to select a ticker, at the very bottom it should show you the ticker background/slider that you have chosen as you progress through the steps but instead of it doing this and creating the ticker you request it only allows the first background/slider to be chosen so I am thinking it must be conflicting with the other two scripts that are running.

My problem here is this script is advertised as offering support but the owner bought this as a money making type of thing therefore the offer of support is fake so here I am with something that doesn't work and no1 over there to help me out with it, and I am only just starting to look into coding and while I can figure a few things out I still have a lot to learn (and google can only provide so much) lol

So apart from me uninstalling tp or my theme, which are pretty much out of the question I have no idea what to do with it.

If anyone has any advice or another place for me to look I would greatly appreciate the help!!

Cheers,
Bec :)
Title: Re: Problems with scripts
Post by: IchBin on March 29, 2009, 05:35:56 PM
Some times the error logs in the firefox console will show you if you have javascript errors that are happening in your site. But not in all instances. You can only troubleshoot these problems by eliminating one or the other and testing things to see if they work
Title: Re: Problems with scripts
Post by: Bec on March 29, 2009, 05:55:50 PM
Thanks IchBin. Appreciate the advice!!

I have noticed some errors..

Error: uncaught exception: [Exception... "Access to restricted URI
denied"  code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)"
location: "http://www.bridezunited.com.au/tickers/form_processor.js
Line: 156"]

Checked out line 156... which shows true


    xmlHttp.open
    (
        "GET",
        main_path + "sessiondata.php?datatype=" + _datatype + "&data=" + URLEncode( _data ),
    true
    );
    xmlHttp.send(null);

    return false;
}


Still searching google so hopefully I'll come across a fix. :)
Title: Re: Problems with scripts
Post by: IchBin on March 29, 2009, 06:23:41 PM
I'm guessing that the URL that the code is trying to hit needs to be checked. Sense it is trying to hit the sessiondata.php file, check the permissions on that file and see if the file is readable.
Title: Re: Problems with scripts
Post by: Bec on March 29, 2009, 06:33:41 PM
the url to be checked would that be in the config.php file? just checked sessiondata.php and the file is readable.  thanks for the advice I really appreciate it!
Title: Re: Problems with scripts
Post by: Ianedres on March 29, 2009, 06:43:19 PM
I've had problems before with two scripts trying to use the 'body onload' function when setting up the page. My solution was to google up some javascripts that combine the loading through one generic call that loads multiple functions. I did find one (can't find the link now though) that did just that and let me combine two unrelated scripts that each needed to start automatically.

Not sure if that is what your site's conflict is, and javascript is something I'm struggling with just to learn, much less debug!
Title: Re: Problems with scripts
Post by: Bec on March 29, 2009, 06:47:10 PM
Thanks Ianedres, will see if I can find it! I came across someone asking about something similar but no solution. Just found myself another site which offers help on js so hopefully ill be able to find the solution. Will be sure to post it in case anyone else ever has the same problem! :)
Title: Re: Problems with scripts
Post by: bloc on March 30, 2009, 08:26:24 PM
This body onload javascript that Ianedres is talking about, is a part of TP. You need to fill $context['TPortal']['onload'][] = 'your onload code'; and it will be added togheter.

Check out around lines 2118 in TPortal.php for a look at what it does: // fire the onload events, if any
$context['html_headers'] .= '
<script type="text/javascript">
//the map object
var map = null;

//set page event handlers for onload and unload
if (window.attachEvent) {
window.attachEvent("onload", Page_Load);
window.attachEvent("onunload", Page_Unload);
} else {
window.addEventListener("DOMContentLoaded", Page_Load, false);
window.addEventListener("unload", Page_Unload, false);
}

//load map   
function Page_Load() {
//add your map loading code here
' . implode("; ", $context['TPortal']['onload']) . '


//Clean up all objects
function Page_Unload() {
if (map!=null) {
map.Dispose();
map = null;
}
}
</script>';       

Title: Re: Problems with scripts
Post by: Bec on April 02, 2009, 08:57:51 PM
Thanks Bloc :)