/    Sign up×
Community /Pin to ProfileBookmark

To Javascript or not to Javascript.

Hi, I know very little about Javascript, before yesterday I thought you javascript when you tell your wife to get you a coffee. ?

Anyway…

I some how got sucked in to creating a new web site for my daughters school. What I am trying to do is give the school the ability to once every 2 weeks upload the school newsletter to be viewable via the web. I would also like the web users to be able to view the previous newsletters by clicking on the PDF document. I tried doing a search on “directory browser” but I don’t really think that is what I am after as I don’t wish for people to be able to browse directories as such. I only want them to be able to click on any document in a set directory and be able to view it. The HTML listing will update automatically as a new document is added. I would also like this to be able to work regardless of OS type of the web server. (Windoze or Linux)…

Am I making myself clear or do I need to write what I am after in a different way? Is this even possible in javascript?

Thanks in advance for any advice.

Regards

auscop

Ooops I just realized I posted this in the client-side forum. If my concept is possibleI want to put the JS on the server…

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@JPnycJan 27.2008 — You need some kind of a portal page. someplace containing links to the newest pdf. I think you need to google CMS, then choose a content management system that suits your needs.
Copy linkTweet thisAlerts:
@auscopauthorJan 27.2008 — You need some kind of a portal page. someplace containing links to the newest pdf. I think you need to google CMS, then choose a content management system that suits your needs.[/QUOTE]

Ouch.... I wasn't wanting to get that involved. CMS seems to be a whole way of doing you day to day running of your entire web site. I was wanting to get around this by doing some type of dynamic web page that will just list the files in just one directory. The thought of implementing CMS makes my brain hurt. :eek:

JPnyc, Thanks for you input anyway. ?

Auscop
Copy linkTweet thisAlerts:
@felgallJan 27.2008 — JavaScript can't reference files at all so you will need some sort of server side scripting solution.
Copy linkTweet thisAlerts:
@auscopauthorJan 27.2008 — JavaScript can't reference files at all so you will need some sort of server side scripting solution.[/QUOTE]

felgall, After posting I noticed I posted on the client side forum. I realize I need to have server side scripting. I am now finding that javascript will not do it. So my next question is.... What type of server side scripting do you guru's recommend. Remember I don't need any complexities... Just create a link to any doc in the designated folder. ?

Auscop
Copy linkTweet thisAlerts:
@Declan1991Jan 27.2008 — felgall, After posting I noticed I posted on the client side forum. I realize I need to have server side scripting. I am now finding that javascript will not do it. So my next question is.... What type of server side scripting do you guru's recommend. Remember I don't need any complexities... Just create a link to any doc in the designated folder. ?

Auscop[/QUOTE]

Any will do. I would suggest PHP, but that is personal preference.
Copy linkTweet thisAlerts:
@auscopauthorJan 27.2008 — Declan1991, Thanks for the advice.... A quick question to you... or anyone, what terms should I Google for to get an example. As i said in my first post I think "Directory Browser" is not the right term. What do they call what I am after??


Thanks
Copy linkTweet thisAlerts:
@fifthJan 27.2008 — If you want a php example, something like this will what your looking for;

[code=php]
<?

//change to the directory of your pdf files
$path = "./downloads";

//using the opendir function
$dir_handle = @opendir($path) or die("Unable to open $path");

//loop through the files in the directory
while ($file = readdir($dir_handle)) {
//Echo a link if its a pdf file
if ( strpos($file, ".pdf") )
echo "<a href='$file'>$file</a><br/>";
}

//closing the directory
closedir($dir_handle);

?>
[/code]
Copy linkTweet thisAlerts:
@felgallJan 27.2008 — Using a CMS that has already been written by someone else is probably the easiest way if you don't already know PHP.
Copy linkTweet thisAlerts:
@auscopauthorJan 28.2008 — If you want a php example, something like this will what your looking for;........

[/QUOTE]



Fifth thanks heaps for the example. I will look in to trying this as soon as I get a spare moment next weekend. Thanks everyone for the advise. ?


Auscop
Copy linkTweet thisAlerts:
@auscopauthorJan 29.2008 — Fifth, You are a champ. Script works perfectly, just what I needed, neat and simple. And the scary bit is I understand the script and what it does... I guess my old VMS DCL scripting helps with that.

Thanks again. ? ?

Regards

Auscop
×

Success!

Help @auscop spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...