homepage Welcome to WebmasterWorld Guest from 54.205.106.111
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
general server-side tips for a newbie?
database, login, edit lots of files at once
monie




msg:4056952
 8:58 pm on Jan 8, 2010 (gmt 0)
Hey,
I'm pretty new to the non-browser-side of web development (my experience = I edited .htaccess yesterday), and I'm wondering what my server is capable of.

1. Let's say I've just written mystyle.css and I want it to apply to multiple .html documents. There are enough of them that opening each one, copy-pasting the <link rel>, and saving is not something I particularly want to do. Is there a way to use the server to say, "all files in directories x, y, and z, use mystyle.css"?

2. If so, is there any performance issue with using that method instead of the copy-paste method?

3. Is there any way to edit the actual text of multiple files at once? For example, I have old pages that I wrote before I knew how to use javascript includes. I want to tweak the common layout a little, and while doing so, make them all just point to the same javascript file so I won't have to do this in the future.

Do I have to go to each one, delete the HTML layout, paste in the javascript include, save--or now that I'm venturing into fancy new territory, can I somehow say "for any file in directory x, replace "html layout text" with "javascript include"? Or is this the perfect example of why one uses some sort of include in the first place?

4. Is there a fancy way to rename files? For example, rename all filename.txt files in directory x to filename.html?

5. Does anyone know of a good tutorial for accessing and using your server for the first time? I checked the New To Web Development library before posting this, but none of the titles seemed to cover what I was looking for.

6. I'm also just beginning with mySQL. Although the tutorial I found is really helpful as to SQL commands, it doesn't cover something pretty basic--um, how to get info from the html input to your database and vice-versa, KUEK. Does anyone know of a database-html interaction tutorial intended for someone with a firm html base but zero experience with non-browser-side?

7. Are databases publicly accessible--that is, is it safe to just stick a username/password table for people who use my site into my SQL database?

8. I know how to use .htaccess to restrict who views certain files, but how are more user-friendly logins done? And what about showing the page but restricting certain actions: i.e. no posting to the page?

9. I know python and I've heard it's useful for this kind of stuff--but how do you write a .py file that makes HTML and databases do things?

Oof. :)
Obviously, if you know the answer to one-some of my questions but not to all of them, post anyway!

By the way: I know there's lots of questions.... if you moderators want to break up this post or send parts of it to other forums, I won't be offended.

 

phranque




msg:4058965
 11:08 am on Jan 12, 2010 (gmt 0)

you would probably get a much better response if you did some work and posted questions in the appropriate forums.
you would also do well to try your questions in the search function on WebmasterWorld.
for example it you searched for " edit multiple files" you could have easily found the How to edit a bunch of static HTML files at once? [webmasterworld.com]thread.

i'll answer a coupel of others for you anyway:
- passwords should be encrypted before storage.
depending on your application and location there may be strict requirements regarding how to handle passwords.
- there are many "application frameworks" that simplify the interface between web pages and databases.
- the method for renaming files depends a lot on the operating system on which they reside.
- if you are into unix-type systems you can do some cool text processing with awk.
many scripting languages are well suited to manipulating text files, specifically perl.

monie




msg:4060589
 12:59 pm on Jan 14, 2010 (gmt 0)

will do next time.

Thanks for the link!

thecoalman




msg:4060623
 2:23 pm on Jan 14, 2010 (gmt 0)

3. Is there any way to edit the actual text of multiple files at once? For example, I have old pages that I wrote before I knew how to use javascript includes. I want to tweak the common layout a little, and while doing so, make them all just point to the same javascript file so I won't have to do this in the future

Assuming your server supports SSI, php or some other server side scripting language you might as well move on from static HTML pages. One basic function in php is the include.

Simple example using PHP:

<html>
<head>
</head>
<body>

<?php include($_SERVER['DOCUMENT_ROOT'] . '/somefolder/header.php'); ?>

<p>Some content</p>

<?php include($_SERVER['DOCUMENT_ROOT'] . '/somefolder/footer.php'); ?>

</body>
</html>

Lots of benefits. Firstly you're no longer relying on JS, the browser is sent plain HTML.

You'll want to either redirect your old HTML pages to the new ones if you switch to the .php extension. You could also have the server parse HTML files as PHP

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved