My blog as an exercise of php
HTML PHP Python Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
html
php
src
.gitignore
ArticleList.py
ArticleSummary.py
Blog.py
MdToBlogHtml.py
README.md
deploy.sh
generic_head.src
my_blog.py
page.php
rss.xml

README.md

Mon blog en php

Comme vous pouvez le voir en vous abonnant, mon blog est extrêmement minimaliste. Entièrement fait à la main en html.

J'ai donc décidé de «moderniser» ça comme exercice de php ... travail en cours ...

Installation

Chez moi

Pour mémoire ...

Pour avoir la liste des anciens articles, il faut lire le fichier rss.xml. Pour ce faire j'utilise la fonction

 simplexml_load_file(  );

Je ne me souviens plus quel paquet il faut installer pour l'obtenir. Je crois un de ceux-ci :

apt install php-pear  libpcre3-dev

Ensuite redémarrer le server Apache :

sudo service apache2 restart

Sur mon site

Il se fait que mon hébergeur OVH a du bon php, et que je n'ai rien dû faire de spécial, à part activer php7 à partir de l'interface web de mon compte OVH.

Directory structure

The directory blog contains the following :

  • html. Contains the text written by the author. These files are automatically included by the php scripts that are the "real" blog files.
  • php. Contains the php files describing the articles. These files are automatically generated by a python script on the author side.
  • src. Contains the php classes and functions for generating the pages.

Workfow

From the author point of view, non php is needed, but few python and html. In the file my_blog.py the author adds an entry by

new_article=ArticleSummary(name="name")
new_article.set_title("My title")
new_article.set_date("December 2016")
new_article.set_description("Some description")

blog=Blog("rss.html")
blog.add_article(new_article)

where name is the name of the html file in which the author writes his article :

blog/html/name.html

A php file is automatically created :

blog/php/name.php

and the file rss.xml is updated.

Now you can publish by copying the three files rss.xml, name.html and name.php on your website.

You can see the result here.