Zaloguj | Zarejestruj | FAQ
Anonymous

Newbe looking for help in HTML/CSS/JavaScript and XML

+ Odpowiedz

Posty: 3 Strona 1 z 1


Newbe looking for help in HTML/CSS/JavaScript and XML

przez DaveBock » Śr lut 18, 2015 2:37 am

Hooyah!

Thanks for taking the time to look. I've been using the tutorials on here...Html.net and W3c.schools to rewrite our fishing club website. It was written in HTML many years ago...and all we been doing is cutting and pasting to update the data each month. Well I'm tired of doing that so I'm learning HTML/CSS/JavaScript and XML to update it automatically. I thought about PHP and MySQL but got real confused with that.

So far I've taken the HTML original page...(just one so far) and removed all the formatting stuff out into a CSS file. Then using Microsoft Excel I've created an XML file with all the data that we want to update monthly. Using JavaScript I've assigned variables to all the different data to be displayed from the XML file then document.write it on the screen in locations based on the CSS file. My ultimate goal is to just change the XML file each month so I don't have to cut and paste the webpage.

I know...cut to the point.... I haven't figured out how to change the img file names each month. they look like this:

for the top 4 guys in January

1JAN.JPG
2JAN.JPG
3JAN.JPG
4JAN.JPG

then they switch to these for February

1FEB.JPG
2FEB.JPG
3FEB.JPG
4FEB.JPG

From my XML file I get the "JAN" using JavaScript

var z=0; //calendar month 0-11 JAN - DEC
dataShortMonth=xmlDoc.getElementsByTagName("ShortMonth")[z].childNodes[0].nodeValue;

using HTML for now....I display the image file:

<img src="photos/1JAN.JPG" alt="" style="border: 2px solid ; width: 230px; height: 171px;">

How do I make the "JAN" come from the variable dataShortMonth so each month it will display the correct picture automatically?

Thanks for your interest and any advice you can give or point me in the right direction as I'm sure someone has discussed this topic in the past.

Respectfully,

Dave Bock
Avatar użytkownika

DaveBock

  • Posty: 1
  • Dołączył(a): Śr lut 18, 2015 1:29 am

Re: Newbe looking for help in HTML/CSS/JavaScript and XML

przez nanoverso » Pt lut 27, 2015 10:42 pm

This looks like a perfect case for use of a CMS (Content Management System), they can handle this separation of main content and little updates through use of a database of articles. The most used ones are Wordpress, Joomla and Drupal, written in PHP with MySQL as database. Take a look to see if they could solve your situation.

Good luck !
Avatar użytkownika

nanoverso

  • Posty: 253
  • Dołączył(a): So maja 10, 2014 12:08 am
  • Lokalizacja: Brazil
--
Free VST Plugins Download.

Re: Newbe looking for help in HTML/CSS/JavaScript and XML

przez XainPro » Pn mar 02, 2015 9:34 pm

there can be 101 solutions of your this specific problem

1st try this check if it works

<img src="photos/1<script>document.write(dataShortMonth);</script>.JPG" alt="" style="border: 2px solid ; width: 230px; height: 171px;">
Avatar użytkownika

XainPro

  • Posty: 3933
  • Dołączył(a): Pt lut 17, 2012 8:10 pm


+ Odpowiedz

Strona 1 z 1