Changing Links Daily

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm relatively new to HTML, and my coding at present is very fundamental.  I
have a page on my website on which ten different buttons link to an MP3.
But the MP3 could change frequently, almost daily.  Now, I've been looking
at CSS, but so far I haven't incorporated a single CSS into any of my pages.
Maybe I'm jumping to the wrong conclusion, but I was thinking that CSS is
the answer to my problem.  Follow me a moment, and some of you guys probably
already have a solution to this.

Here's the deal.  I have a short MP3.  Rarely will they be more than a
minute long.  I have a jpeg button you click on to activate the MP3.  Now,
tomorrow, I might want to change that MP3.  So far, with my limited
knowledge of HTML, I'll have to open the code in an editor and change the
name of the MP3, save the changed HTML file, then upload it to the site,
where the new code will overwrite the old code.  This hardcoding is a clunky
way to do this.  I know there's got to be a better way to do this than the
way I just described.  Here's what I was thinking.

I was thinking that I'd have a generic name for the link in the HTML.  For
example, I'll reference the MP3 in the HTML code as simply, say,
"current_sound.mp3."  There are several buttons on this page with a
different sound associated with each button; you can imagine that this could
get very awkward and take up a lot of time if I wished for my site to stay
current.  As in CSS, somewhere in the hardcoded page would be a reference to
some external file that would assign a value to "current_sound.mp3".  The
external text file might have a line that says,

I would like to know two things.  First, is what I'm suggesting possible?
Second, if it's possible, can you give me a hint as to what direction to go
in?  What code am I looking for, what's it called?

In conclusion, I haven't worked yet in JavaSript, but I was thinking that
I'd create a small script that would list on one side the hardcoded filename
and in another column the actual file associated with each file name, which
would then write them all to the text file, then upload that text file to
the website, where the HTML page would access the information.

I hope I made this clear.  Thanks for any help.  For clarity, I've included
the page I'm talking about in the link below.

Alric Knebel

Re: Changing Links Daily

In alt.html  Alric Knebel said:

Quoted text here. Click to load it

html describes a document and css adds styling to it so they're not what
you need. you need to use some giggly bits of sexy php

Quoted text here. Click to load it

the easiest i can think of off the top of my head is to name your mp3s
the days of the week you want them to play.

sunday.mp3, monday.mp3, tuesday.mp3 etc etc etc

place them in the same directory as the html page that uses them.

in your html document use the following line:

<a href="<?echo strtolower(date(l)).'.mp3'; ?>">play my mp3</a>

save the html document with a .php extension so the server knows to
prase the above php before sending the page to the visitors browser.
the html page they receive will have the above php replaced with this:

<a href="thursday.mp3">play my mp3</a>

(obviously it will depend on what the day of week is)

all done automatically with no intervention from you. easy peasy

l  i  t  t  l  e    v  o  i  c  e  s    m  a  k  e    m  e

Re: Changing Links Daily

While the city slept, Alric Knebel ( feverishly typed...

Quoted text here. Click to load it

How about you don't change the name of the mp3? Upload your mp3 file, then
change its name to something like "mp3oftheday.mp3" then the link <a
href="mp3oftheday.mp3">MP3 of the day</a> will always play the most recent
one. To keep an online archive, before you ftp the current mp3oftheday.mp3,
rename the exisiting one with its original filename.

Hope that helps,

Nigel Moss
Mail address not valid., take the DOG. out!
In the land of the blind, the one-eyed man is very, very busy!

Re: Changing Links Daily

Quoted text here. Click to load it

Yes, I did think of that.  I can just access it via FTP and rename the files
as I need them.  But I was hoping it would be an opportunity to learn
something . . . SEXY (as Bruce put it).  I did think of that first, just
naming the files according to the line I want them on, the most current file
in the code titled "current.mp3," and so on.  As the files are named now,
they day of the call is embedded in the title.  I was hoping to retain that
convention, just so I can avoid any mix-ups.  But you guys have been a lot
of help.

Alric Knebel

Site Timeline