Hi,
I have a minor website that I wish to maintain that I do for gratis (for free). It is for a school. I wish to be able to automate the task of adding links and photos and text body. I already use a css template to maintain the look and feel of the site but would like to go that one step closer to adding automation. I have the concept but do not know how to go from concept to actually programming what I would like to do with python. I have written very basic python and perl code.
I need direction.
Here are my thoughts at what I wish to achieve.

I have already created the basic folder structure for easy of keeping things clean and orderly.
Name of folder - within that -pdf folder - image folder - doc folder.
What I wish to be able to do is have files within these folders. That can be read by a python script.
Firstly to create links to documents or pdfs or photos secondly to grab the text body out of a text file and place it into the html document. Sounds easy. Well I have popped a blood vessel and would like some advise. I know that there are cms systems out there that could do this but the site on which this webpage site is housed will not allow for this interaction. Any suggestions.

Member Avatar for ingeva

Hi,
Name of folder - within that -pdf folder - image folder - doc folder.
What I wish to be able to do is have files within these folders. That can be read by a python script.

I don't know python or perl, but in php including a text file is easy:
include <name of text file>;

In one of my sites I let the script search directories and display the filenames of that directory. The user can select which one he wants to see or download.
By adding new directories, even in several levels, it's possible to add nearly anything dynamically, with no code changes.

Member Avatar for leegeorg07

in python you could use the open method, to write a basic framework you could write:

new_page = open("name.html", "w")#change 'name' to whatever you want/input and you could use "a" to add to the page
framework = """
<html>
  <head><title>basic framework</title></head>#add in any extra
  <body>
    <p>
      This is some text
    </p>
  </body>
</html>
"""
new_page.write(framework)

You would need to use different inputs and editors for extras, but the admins should really move this to the python forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.