From: Benjamin Auder Date: Thu, 5 Feb 2015 16:16:25 +0000 (+0100) Subject: fix README.html X-Git-Url: https://git.auder.net/game/%7B%7B%20asset%28%27mixstore/css/store/upsert.css%27%29%20%7D%7D?a=commitdiff_plain;h=47e0f70e94b3d7a770c6946c5e4e2e609963c9ac;p=sview.git fix README.html --- diff --git a/README.html b/README.html index d1ee256..3b3f0a4 100644 --- a/README.html +++ b/README.html @@ -1,32 +1,36 @@

sview : tiny PHP web framework

-

It is inspired by a similar framework written by Arnór Heiðar Sigurðsson. -In the same spirit but more advanced and more complete, see also nanoc - in Ruby. +

+ It is inspired by a similar framework written by Arnór Heiðar Sigurðsson. + In the same spirit but more advanced and more complete, see also nanoc - in Ruby.

-sview is designed to organize essentially static websites. -It does not offer the features you would expect from a complete MVC framework - -actually, it has only the "V" part. -If you want a more demanding dynamic website, consider using an appropriate tool, -Symfony for example. + sview is designed to organize essentially static websites. + It does not offer the features you would expect from a complete MVC framework - + actually, it has only the "V" part. + If you want a more demanding dynamic website, consider using an appropriate tool, + Symfony for example.

How to use it ?

-

The file sample-website.tar.xz provides a basic but full website example. -Alternatively, here are some details about sview usage. +

+ The file sample-website.tar.xz provides a basic but full website example. + Alternatively, here are some details about sview usage.

0. Installation

-

In the following, I assume your website is located under http\[s\]://domain/topic/ -and is named "website" (adapt to your case). For example, in https://github.com/blog/ -domain = github.com and topic = blog. +

+ In the following, I assume your website is located under http\[s\]://domain/topic/ + and is named "website" (adapt to your case). For example, in https://github.com/blog/ + domain = github.com and topic = blog.

-

Get the source code either with `git clone` command or using a zip archive. -Copy all folder contents in the website/ folder : +

+Get the source code either with git clone command or using a zip archive. + Copy all folder contents in the website/ folder :

website/
     a/
@@ -39,24 +43,25 @@ Copy all folder contents in the website/ folder :
     s.php
  • .htaccess : its main job consists in routing everything that is not a resource -to the index.php file. -
  • common.php contains shared variables and functions to be used by at least two different pages. -
  • defaults.php defines default variables for any web page, like the title or javascripts block. + to the index.php file.
  • +
  • common.php contains shared variables and functions to be used by at least two different pages.
  • +
  • defaults.php defines default variables for any web page, like the title or javascripts block.
  • index.php contains your website template, which is rendered for any web page -(and filled with specific values defined in pages under site/ folder; anything can be customized). -
  • s.php consists in the framework code, loaded at the beginning of index.php. + (and filled with specific values defined in pages under site/ folder; anything can be customized).
  • +
  • s.php consists in the framework code, loaded at the beginning of index.php.
  • -

    Now (online), in the .htaccess file, change the line `RewriteBase /` to `RewriteBase /topic`. +

    + Now (online), in the .htaccess file, change the line RewriteBase / to RewriteBase /topic.

    1. Set default contents

    @@ -64,15 +69,16 @@ to the index.php file. Edit the file defaults.php with -

    Each variable name is prepended with "b_" to avoid potential conflicts with your own variables. +

    + Each variable name is prepended with "b_" to avoid potential conflicts with your own variables.

    2. Complete main pages

    @@ -81,74 +87,87 @@ We will see later how to refer to local style sheets (under a/css). Complete -

    You can also change the \ tags if needed. +

    + You can also change the \ tags if needed.

    site/home.php

    -

    The welcome page. You can choose a title ($s_title) or use the default one -(by not specifying anything). Style sheets and javascripts can be customized, ...etc. -Any default variable can be used to define a specific variable (prepended with "s_"). +

    + The welcome page. You can choose a title ($s_title) or use the default one + (by not specifying anything). Style sheets and javascripts can be customized, ...etc. + Any default variable can be used to define a specific variable (prepended with "s_").

    site/404.php

    -

    Customize it; it is probably viewed more often than you think ;-) +

    + Customize it; it is probably viewed more often than you think ;-)

    3. Write all other pages

    -

    All pages are under site/ folder, and you can nest them in any directory tree. +

    + All pages are under site/ folder, and you can nest them in any directory tree.

    -

    Hint : if you don't want to load the main template, just end any site file -with a PHP exit directive. +

    + Hint : if you don't want to load the main template, just end any site file + with a PHP exit directive.

    -

    Now we will see how to access pages and resources (images, CSS, files, javascript). +

    + Now we will see how to access pages and resources (images, CSS, files, javascript).


    How to view a web page ?

    -

    The page at physical location site/some_folder/mypage.php is viewed in the web browser at the URL -http\[s\]://domain/topic/website/some_folder/mypage (thanks to URL rewriting defined in -the .htaccess file). +

    + The page at physical location site/some_folder/mypage.php is viewed in the web browser at the URL + http\[s\]://domain/topic/website/some_folder/mypage (thanks to URL rewriting defined in + the .htaccess file).

    -

    Any page can be linked internally using the r() PHP function ('r' for "resource"), like in -the following : '. This function determines -the nesting level and output the appropriate path. +

    + Any page can be linked internally using the r() PHP function ('r' for "resource"), like in + the following : <a href="<?php echo r('some_folder/mypage'); ?>">. This function determines + the nesting level and output the appropriate path.

    How to access...

    -

    A CSS style sheet : its path is given by the following PHP function call -r('a/css/name_of_the_file.css') from within any site file (assuming you place all CSS files -under a/css/. They may be inside a nested folder structure). +

    + A CSS style sheet : its path is given by the following PHP function call + r('a/css/name_of_the_file.css') from within any site file (assuming you place all CSS files + under a/css/. They may be inside a nested folder structure).

    -

    An image : same as above, with r('a/img/name_of_the_image.xxx'). +

    + An image : same as above, with r('a/img/name_of_the_image.xxx').

    -

    A javascript file : same as above, with r('a/js/name_of_the_file.js'). +

    + A javascript file : same as above, with r('a/js/name_of_the_file.js').

    How to give a download link ?

    -

    Just use a regular link pointing to r('dl/?f=name_of_the_file.xxx'), anywhere you want. +

    + Just use a regular link pointing to r('dl/?f=name_of_the_file.xxx'), anywhere you want.


    Usual workflow

    -

    Just add pages under site/ folder, and potential resources and files under a/ and f/. -All other files will not change a lot. +

    + Just add pages under site/ folder, and potential resources and files under a/ and f/. + All other files will not change a lot.