bigjoe11a Posted October 22, 2011 Share Posted October 22, 2011 The template system I have that I been working on for the last 3 weeks. I just started added javascript to it. Well when I added the path to the javascript files. I couldn't get my html pages to see run the functiosn from the file. Now if I added them right into my pages. (I Mean the javascript code) Then It would work just fine. I'm thinking this is why I can't get jquery to work. or even some of the wysiwyg editors to work, I'm just not sure. I never done it like this before. A sample in micEdit. in My content_header.html. in between my header tags I added the sample from demo02. This is in my <head> </head> tags <script src="../nicEdit.js" type="text/javascript"></script><script type="text/javascript">});</script> The above works, How ever when I add the rest of the code. and that's below. bkLib.onDomLoaded(function() { new nicEditor().panelInstance('area1'); new nicEditor({fullPanel : true}).panelInstance('area2'); new nicEditor({iconsPath : '../nicEditorIcons.gif'}).panelInstance('area3'); new nicEditor({buttonList : ['fontSize','bold','italic','underline','strikeThrough','subscript','superscript','html','image']}).panelInstance('area4'); new nicEditor({maxHeight : 100}).panelInstance('area5'); The get errors on the pages. at the lower left bottom corner. So I can't figure this out at all. So I tried some small examples and I get the same problem. I can't get the buttons to work. The page shows an error again at the lower left side of the page. So when i try and run a function from a javascript file. It doesn't work. It only works when I add the code (javascript) into my pages. Any one have any ideas. Joe Link to comment Share on other sites More sharing options...
Ingolme Posted October 22, 2011 Share Posted October 22, 2011 If it's a template system, relative URLs might need to be corrected to work with the template directory. In my template systems I have template variables to print out the path to the template directory relative to the current page. Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 22, 2011 Author Share Posted October 22, 2011 See I have some thing like that for my PHP scripts. So that it makes is easy for scripts to locate other scripts. How would I do this for HTML and Javascripts. Link to comment Share on other sites More sharing options...
Ingolme Posted October 22, 2011 Share Posted October 22, 2011 I can't help you because I don't know how your template engine is structured. If you know the directory your site file is and you know where the script file is, then you can put the full path to the script. Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 22, 2011 Author Share Posted October 22, 2011 Ok, I thought of that all ready. and tried it and same thing. That didn't work. See if I put the javascript link in the header of my web site and if the folder is wrong or it can't find that file. Then it will error on. So that's the 1st thing I thought of. See it's not what the problem is. The links to the javascript I don't think is the problem. Since my pages would error if it couldn't find the *.js file any way. I don't know whey. It doesn't seem to see the functions. It's like when I click a button to run a function. It's like it can't find them. I am still playing a round with it. Link to comment Share on other sites More sharing options...
Ingolme Posted October 22, 2011 Share Posted October 22, 2011 Have you tried putting the URL of the script file in your browser to see if it appears? Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 22, 2011 Author Share Posted October 22, 2011 That I haven't tried yet. Let me try that real quick Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 22, 2011 Author Share Posted October 22, 2011 Yes it does. Look for your self http://toppersbbs.dtdns.net/mapnet/jscripts/nicedit.js Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 22, 2011 Author Share Posted October 22, 2011 Oh and here's the one I was working on. http://toppersbbs.dtdns.net/mapnet/jscripts/click.js Link to comment Share on other sites More sharing options...
Ingolme Posted October 22, 2011 Share Posted October 22, 2011 OK.You know where your JS file is. Now figure out where the HTML page is, then make the relative path between the two locations. You could also just put that URL in the src attribute and have an absolute link to the file. Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 23, 2011 Author Share Posted October 23, 2011 Thanks. How ever I have that all ready setup like that and I still have the same problem. I just can't run the functions from those scripts. Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 23, 2011 Author Share Posted October 23, 2011 Now I think I have some thing wrong with the template system I'm using. Look at this. I downloaded a menu using javascript and well it works fine when I view it by it self. It doesn't display right from my telplate system,. This is how it should lookhttp://toppersbbs.dtdns.net/mapnet/navmenu/navmenu.htmlThis is how it looks using my template systemhttp://toppersbbs.dtdns.net/mapnet/ and if you look at the lower bottom of your browser, You will see there's an error. You will see an ! that has a yellow back ground. Any one have any ideas why javascript doesn't seem to work unless I add it right to the pages. and I can't use a external file. Link to comment Share on other sites More sharing options...
Ingolme Posted October 23, 2011 Share Posted October 23, 2011 It's not just Javascript links broken on your site, you have several CSS stylesheets not working too. The problem is that you're using an absolute link. For example, this one:src="/jscripts/click.js" Change it tosrc="./jscripts/click.js"Or simplysrc="jscripts/click.js" This will make the link relative to the current directory and not the site root. Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 23, 2011 Author Share Posted October 23, 2011 Ok, well that fixed that menu, How ever I still have the same problem with the jscript above from your sample above. if if set it like this src="jscripts/click.js" I get errors on the page and the buttons don't work, If I set it like this src="./jscripts/click.js" and I get the same problem, I get errors on the page and and the buttons still don't work. How ever if I set it like this src="/jscripts/click.js" the error is gone. The buttons don't work. http://toppersbbs.dtdns.net/mapnet/blog.php/ I don't know if the paths I have are set right since the path for the content_header.html is in a folder called styles/template/content_header.html where this is off the root folder and the jscripts/click.js folder is off the root folder. any ideas on this too. Link to comment Share on other sites More sharing options...
Ingolme Posted October 23, 2011 Share Posted October 23, 2011 It doesn't matter if you see errors, at least you know the Javascript file is loading. There can't be errors if there is no code for there to be errors in. The first thing is to get the path to the file right, after that you need to figure out what is wrong in the file. Maybe you have some relative URLs in the file that aren't working. Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 23, 2011 Author Share Posted October 23, 2011 well here's the link for the click.js file and here's how I have it in the page.<script type="text/javascript" src="/jscripts/click.js"></script>IE is reporting the error. So if that's not an issue. Then why can't I get the javascripts to work from a external file. I tried adding the full path. I'm not getting any page errors. It's just when I click on the button is when I get the error.Do you know if IE has a log file. Some thing that can tell me what it's getting that error. Link to comment Share on other sites More sharing options...
Ingolme Posted October 23, 2011 Share Posted October 23, 2011 When there's an error in Internet Explorer, you can click on the little warning sign at the bottom left corner of the window. You should be using the file paths I mentioned before, because if you use the one you have now then the file isn't even being loaded. Check the error console to fix errors, all browsers have them. Internet Explorer 8 and up have built-in developer tools which you can use. For Firefox, you can download Firebug. Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 23, 2011 Author Share Posted October 23, 2011 well I'm getting a error of object expected from the blog.php page. I only get that error when I click on the button. So I have no idea what's going on or how to fix it. I never had this problem. Then again I never used the template system I have like this before. It says that the error is on line 107 and 108 in the blog.php 107 : $pageview = new page('blog/header.html');108 : $pageview->replace_tags(array('blog' => 'Mapnet Blogs',)); Like I said. I only get this error when I click a button to run functions in jscript external files. Link to comment Share on other sites More sharing options...
Ingolme Posted October 23, 2011 Share Posted October 23, 2011 That's PHP, not Javascript. Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 23, 2011 Author Share Posted October 23, 2011 let me try again. Yes i know that, what I mean is that I don't get that error until I click a button that should run a javascript function. It seems to relate to my template system. So does that mean I have some thing wrong with my template system or is it some thing else. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 24, 2011 Share Posted October 24, 2011 Open the page in your browser and view the source of it. The source you see there has the code that it's complaining about, not the PHP code. The browser never sees the PHP code, only the output of it. You can see what that looks like by viewing the source from the browser. Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 24, 2011 Author Share Posted October 24, 2011 I under stand what your saying, I just don't know what to look for. Link to comment Share on other sites More sharing options...
justsomeguy Posted October 24, 2011 Share Posted October 24, 2011 Look for the line number where it tells you the error is. You may want to copy the code into a text editor that shows line numbers if the browser doesn't show them. Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 24, 2011 Author Share Posted October 24, 2011 Thank You. the error was not that it couldn't find the script. The problem was that the script had an error in it. Thank YOU VERY MUCH. Joe Link to comment Share on other sites More sharing options...
bigjoe11a Posted October 24, 2011 Author Share Posted October 24, 2011 Now I tryied to add jquery and I get errors coming from that javascript. Let me see if I can find the newest one. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.