Jump to content

IWD - HTML Ch4.8 - Problem with code??


Rich528

Recommended Posts

Hi 

I am currently working through the IWD course. I am on Chapter 4 part 8 (Paths).

I have followed the instructions exactly but I cannot get the ../ part of the code to navigate up a directory when attempting to link back to the index.html page. 

I have saved the code in Sublime Text and refreshed the page in the browser but all I get is the 'Your file was not found' page. 

The link to the Friends page from the Index page works fine but not the other way around.

I have attached a screenshot containing the code and the file structure. The my_friends.html file is in the sub_pages folder.

Any help much appreciated, it was all going very smoothly until this.

Thanks

Rich

Screenshot.png

Edited by Rich528
Link to comment
Share on other sites

Hi Rich,

Paths are one of the big hurdles in learning web coding. So don't let it get to you.

Suggestion:

Based on what I see in your code and directory screenshot, you are simply not placing your files in the proper directories. So, in your code, you are telling the web browser with this code: 

../

... That the index page is in a directory above the current page. So place your friends.html page in a sub directory and be sure you index page is above that. To test this out and to learn, first get your links working where all your pages are in the same directory.

Stef

Link to comment
Share on other sites

Hi Stef

Thanks for the quick reply. 

The my_friends.html file is in the folder 'sub_pages' which is a sub-directory of where index.html is. I had all the links working fine when the pages were all in the same directory. I even have the Friends link in the index.html page linking to the friends.html page in the sub-pages folder without any issues so I think the file/folder structure is correct. I just cannot get the link to work going back in the other direction i.e. from friends.html (in the sub_pages folder) back to index.html in the main folder one directory above.

The directories are set up exactly as shown in the tutorial video (I think - unless I am missing something)?

Thanks

Rich

Link to comment
Share on other sites

Hi Stef

I solved the problem.

The tab in Sublime Text where I was editing the my_friends.html code was not affecting the code in the sub_pages folder for some reason. When I checked the source code from the web page itself the ../ was not present even though it was in the code editor.  Once I closed the tab and dragged it back into Sublime Text from the sub_pages folder it all began to work fine.

Thanks for your help.

Rich

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Hi Stef

I had the same problem as Rich here and went through Ch4 three times. The third time I checked the code in Chrome and it had the ../ there so I tried Rich's solution to close the tab and drag it back into Sublime, still no joy.

Eventually what worked was a specific "Save as.." to the friends file in the sub-pages folder.

One small issue though, the friends file duplicates back into ../ though it's definitely in sub-pages. Have deleted it several times and still it reappears, is this a problem waiting to happen? The sub-pages version after the Save as.. seems to now be more up to date than the ../ version.

I'm starting to think coding is what a few centuries ago used to be called witchcraft. Do we get a pointy hat at the end of this?

 

Edit: Finally the fog has cleared. If there's ever a profanity Olympics I'm in fine shape for it after this past week. To finish I just want to say that as painful as I've found Chapter 4, well the paths side of it that is, that I knew all along it would be worth the pain for the feeling on the other side of it, which it is, and it's why I kept with it.    

Edited by Jim706
The fog has finally cleared.
Link to comment
Share on other sites

  • 2 months later...
On 5/13/2020 at 12:48 PM, Jim706 said:

Edit: Finally the fog has cleared. If there's ever a profanity Olympics I'm in fine shape for it after this past week. To finish I just want to say that as painful as I've found Chapter 4, well the paths side of it that is, that I knew all along it would be worth the pain for the feeling on the other side of it, which it is, and it's why I kept with it.    

LOL! Nice!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...