• [MOD] Small and simply mod for articles publishing 4 0 5 1
Currently:  

Author Topic: [MOD] Small and simply mod for articles publishing  (Read 32068 times)

0 Members and 1 Guest are viewing this topic.

Offline Eld

  • Pre-Newbie
  • Posts: 3
    • View Profile
    • Northern International University
[MOD] Small and simply mod for articles publishing
« on: February 22, 2006, 05:48:15 AM »
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.

Code: [Select]
<?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.html
article file for article with id=2:
http://gallery.yoursite/data/articles/2/index.html
article file for article with id=3:
http://gallery.yoursite/data/articles/3/index.html

and 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".

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] Small and simply mod for articles publishing
« Reply #1 on: February 22, 2006, 07:26:30 AM »
EDIT: Works fine for, me, just had to change some lines for the root-path. Its a very simple MOD, ang you have a good overview.
Do you think to add some more to this MOD? Options like control for the MOD in ACP, a page within 4images to post articles, bbcode support, ration, comment article etc?

;)



« Last Edit: February 22, 2006, 07:37:45 AM by trez »

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [MOD] Small and simply mod for articles publishing
« Reply #2 on: February 22, 2006, 03:04:09 PM »
Is there a demo??
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: [MOD] Small and simply mod for articles publishing
« Reply #3 on: February 23, 2006, 08:12:26 AM »
http://www.ggrec.com/zapomnime2/article.php
but links are not working, i dont use that mod

Offline Eld

  • Pre-Newbie
  • Posts: 3
    • View Profile
    • Northern International University
Re: [MOD] Small and simply mod for articles publishing
« Reply #4 on: February 24, 2006, 01:36:14 AM »
Is there a demo??

The WORK variant this MOD, not a DEMO you can see at: http://gallery.lsintez.net/article.php

Offline Eld

  • Pre-Newbie
  • Posts: 3
    • View Profile
    • Northern International University
Re: [MOD] Small and simply mod for articles publishing
« Reply #5 on: February 24, 2006, 01:51:39 AM »
EDIT: Works fine for, me, just had to change some lines for the root-path. Its a very simple MOD, ang you have a good overview.
Do you think to add some more to this MOD? Options like control for the MOD in ACP, a page within 4images to post articles, bbcode support, ration, comment article etc?
;)

Many thanks for your response!

Certainly, in ideal variant, it would be desirable to enable to add and make comments on articles to each user. And to store them (articles) in mySQL database. Or even to edit and load articles in a text and also picture through ACP. It to make not so it is difficult. And, certainly, to use BBCODE. And also support of comments.
For comments it is possible to use the table "4images_comments" a little having modified it. Can use "image_id" not only for images id's, but and for the articles id's.
Thus it is possible to modify quickly gallery for articles comments too.

There would be a desire and time for work. :)

Offline Zyga

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: [MOD] Small and simply mod for articles publishing
« Reply #6 on: June 11, 2006, 05:29:47 PM »
:idea:

Good options could be wysiwyg editor like for example aynHTML
http://www.aine.be/aynhtml/
If time allow i try do something with it

I saw post about comments - its good option too ;)


edit Zyga

Quote from: Zyga
If time allow i try do something with it
or maybe not ;(
there is no attachment

Offline iguanna

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: [MOD] Small and simply mod for articles publishing
« Reply #7 on: September 13, 2006, 03:34:04 AM »
any mod to use WYSIWYG in description?
www.summer-school-programs.com Summer study programs
http://celebrity.fake-images.com Celebrity Fake Images

Offline knsin0

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: [MOD] Small and simply mod for articles publishing
« Reply #8 on: September 21, 2006, 10:36:29 PM »
where is the attachment?¿  8O  :?

Offline hyde101

  • Sr. Member
  • ****
  • Posts: 410
  • 34TR.COM (Running 4images)
    • View Profile
    • Nostalgia Istanbul
Re: [MOD] Small and simply mod for articles publishing
« Reply #9 on: September 23, 2006, 03:14:17 AM »
Yep, no attachment. Also, what I did was, I simply used the blank page from the template or took one page and copied it as ARTICLE and used index.php?template=xxxxx  so it used the same template... this way, I added the links to the control panel or userlogin bit, please see how it works:
Sample article: http://www.34tr.com/index.php?template=Sultanahmet%20Meydani




Please Vote for my site: Here

Offline KimmyMarie

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: [MOD] Small and simply mod for articles publishing
« Reply #10 on: October 28, 2006, 11:30:47 PM »
I can't locate the file attachment.




Thanks,
Kimmy

Offline kandr

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: [MOD] Small and simply mod for articles publishing
« Reply #11 on: February 22, 2008, 11:55:53 AM »
Большое спасибо за МОД, друг! пиши по-русски тоже тут!

куда добавить это: You are define('ARTICLES_PATH', ROOT_PATH.'data/articles/');?
« Last Edit: February 22, 2008, 12:11:33 PM by kandr »

Offline alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: [MOD] Small and simply mod for articles publishing
« Reply #12 on: November 07, 2008, 09:35:46 AM »
I very liked this mod and want to use it in my gallery. So I added support for comments (stored in files, it's was important for me) and very simply admin panel and I would like to share it with you.
Just some notes before:
1. I don't have php knowledge, so will be good if someone can check the code.
2. I could make spelling mistakes in English.  :oops: (Sorry)
3. The templates are based on default style.
3. Make backup before modifications.

------------------- INSTALLATION -----------------------
1. Download the attachment from this message.
  • upload the file articles.php to root directory of gallery
  • the file add_edit_articles.php to folder admin/plugins
  • the html files to your template directory

2. In the file global.php find:
Code: [Select]
  elseif (preg_match("/categories.php/", $self_url) && !preg_match("/[?|&]".URL_CAT_ID."=[^?|&]*/", $self_url)) {
    $self_url .= "?".URL_CAT_ID."=".$cat_id;
  }

add below this code:
Code: [Select]
  elseif (preg_match("/articles.php/", $self_url) && !preg_match("/[?|&]".URL_ID."=[^?|&]*/", $self_url) && $id) {
    $self_url .= "?".URL_ID."=".$id;
  }

3. In the file includes/page_header.php find:
Code: [Select]
"url_top_images" => $site_sess->url(ROOT_PATH."top.php"),
add below this:
Code: [Select]
  "url_articles" => $site_sess->url(ROOT_PATH."articles.php"),
  "lang_articles" => $lang['articles'],

4. In the file your language/main.php just before ?> add:
Code: [Select]
// --------------- MOD for articles publishing --------------
$lang['articles'] = "Articles";
$lang['edit_article'] = "Edit article";
$lang['total_comments'] = "Total comments: ";

5. In the file home.html use this link to your articles
Code: [Select]
<a href="{url_articles}">{lang_articles}</a>
---------------- END INSTALLATION ------------------

Now you can go in your gallery to articles page and click Edit article
or in admin panel you can find in the left link add_edit_articles in PlugIns menu.

Some important things:
1. You must put article's title between <!-->. For example: <span class="title"><!-->Article title<!--></span>
2. Don't write <span class="title"><!-->{lang_articles}<!--></span> in the articles.html file,
   put it in the file articles/index.html
3. You can find more notes in control panel of mod.

 If your liked this, ENJOY!

Offline Netsu

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [MOD] Small and simply mod for articles publishing
« Reply #13 on: October 02, 2009, 01:12:51 PM »
in add_edit_articles. php find
Code: [Select]
 echo $articles_list."</select></form>";

$edit = "";
add below
Code: [Select]
$show = $_GET['show'];
find
Code: [Select]
 echo $comments_list."</select></form>";
  closedir($base);

$edit = "";
add below
Code: [Select]
$show = $_GET['show'];
« Last Edit: October 03, 2009, 02:15:14 PM by Ken_Kaniff »

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile
Re: [MOD] Small and simply mod for articles publishing
« Reply #14 on: October 03, 2009, 12:04:57 PM »
Waru wurde beim Beitrag hier gelöscht?...

Nochmals.
Das Plugin ist klasse.
Allerdings fehlt da eine Löschfunktion. Die Dateien auf dem Server kann man nicht via FTP löschen, da die Dateien durch ein PHP-Script erstellt wurden.