Excuse for my bad English, but I would like to share with you a little change in gallery.
I shall be glad to any help in normal translation of this article from Russian on English.
Long time I required an opportunity easily and simply to publish articles in gallery.
It is a little having thought, I have found the simple decision as it can be made.
Please, download the attachment from this message. In this attach you can find all files, which need for "article MOD".Save and place this code AS article.php in your 4images directory.
<?php
if (!isset($HTTP_GET_VARS['id'])) $id = "list"; else $id = $HTTP_GET_VARS['id'];
$templates_used = 'article';
$main_template = 'article';
define('GET_CACHES', 1);
define('ROOT_PATH', './');
define('ARTICLES_PATH', ROOT_PATH.'data/articles/');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');
function get_article_content($id)
{
if ($id == "list") {
$article_content_file = ARTICLES_PATH."index.html";
$article_path = ARTICLES_PATH;
} else {
$article_content_file = ARTICLES_PATH.$id."/index.html";
$article_path = ARTICLES_PATH.$id;
}
if (!file_exists("$article_content_file")) {
$article_content = "This article is not exist.";
} else {
$article_content = file_get_contents($article_content_file);
$article_content = str_replace("{article_path}", $article_path, $article_content);
}
return $article_content;
}
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$content = get_article_content($id);
$site_template->register_vars(array(
"content" => $content,
"msg" => $msg
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
the constant "
ARTICLES_PATH" - the directory, where your articles is be placed.
The directories with articles have a simple structure:
/articles/index.html
/articles/1/
/articles/1/img/
/articles/1/index.html
WHERE
/articles/index.html - html-file with a list of articles
/articles/1/index.html - html-file with article №1
/articles/2/index.html - html-file with article №2
/articles/3/index.html - html-file with article №3
In a file of article you can use a variable {article_path} for replacing this with a path to your current article,
e.g. (if article ID =1)
<img src="
{article_path}/img/testimage.jpg">
be replaced with
<img src="
./data/articles/1/img/testimage.jpg">
article.php requre the simple template with name "article.html" in your template ditectory.
In the this template, variable whith a name {content} replaced with a your article content
from a directory in ARTICLES_PATH with name like as id, or, if ID is not set,
replacing with content of file ARTICLES_PATH/index.html.
E.g.:
your gallery site:
http://gallery.yoursite/path to your data (the directory, where places: thumbnails, database, media and other):
http://gallery.yoursite/data/and your path to articles directory:
http://gallery.yoursite/data/articles/You are define('ARTICLES_PATH', ROOT_PATH.'data/articles/');
Your articles with id=1 or 2, or 3 and other must be placed in directories with name (1,2,3 and other) in your ARTICLES_PATH:
http://gallery.yoursite/data/articles/1/http://gallery.yoursite/data/articles/2/http://gallery.yoursite/data/articles/3/...
in index.html file and images in ./img/
http://gallery.yoursite/data/articles/1/img/http://gallery.yoursite/data/articles/2/img/http://gallery.yoursite/data/articles/3/img/than:
article file for article with id=1:
http://gallery.yoursite/data/articles/1/index.htmlarticle file for article with id=2:
http://gallery.yoursite/data/articles/2/index.htmlarticle file for article with id=3:
http://gallery.yoursite/data/articles/3/index.htmland index file with list of all articles:
http://gallery.yoursite/data/articles/index.html---------------------------------------------------------------
all works!
Excuse for my bad English :(
Please, download the attachment from this message. In this attach you can find all files, which need for "article MOD".