X-Git-Url: https://git.auder.net/?p=sview.git;a=blobdiff_plain;f=HOWTO.html;fp=HOWTO.html;h=c0b580f739a0dd26330c93e7cbad352a5dc3b0a8;hp=0000000000000000000000000000000000000000;hb=706611cda224a682954db6e5603de2cbf73183d6;hpb=293d9fcaedf385724c0e8587ff9f8966a198240b diff --git a/HOWTO.html b/HOWTO.html new file mode 100644 index 0000000..c0b580f --- /dev/null +++ b/HOWTO.html @@ -0,0 +1,157 @@ +HOWTO + +

sview : tiny PHP web framework

+ +

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. +

+ +

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

+
website/
+    a/
+    f/
+    site/
+    .htaccess
+    common.php
+    defaults.php
+    index.php
+    s.php
+ + +

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

+ +

1. Set default contents

+ +Edit the file defaults.php with + + +

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

+ +

2. Complete main pages

+ +

index.php

+ +Complete + + +

+ You can also change the <meta> 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_"). +

+ +

site/404.php

+ +

+ 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. +

+ +

+ 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). +

+ +
+ +

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). +

+ +

+ 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). +

+ +

+ 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'). +

+ +

How to give a download link ?

+ +

+ 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. +

+ +