4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 30, 2010, 04:33:36 AM

Login with username, password and session length
Search:     Advanced search
You're looking for some 4images templates and styles? Then visit this thread to show websites with 4images templates to download.
Translate this page with google
=>
 Translate this page with Google =>
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Releases & Support) (Moderators: mawenzi, Rembrandt)
| | |-+  [MOD]Another Simple News Publishing Mod
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 4 5 ... 20 » »» Print
Current Topic Rating: *****
Author Topic: [MOD]Another Simple News Publishing Mod  (Read 161239 times)
Vincent
Addicted member
******
Offline Offline

Posts: 1194

Thank You
-Given: 0
-Receive: 2


View Profile WWW
« on: July 27, 2005, 11:22:41 PM »

The Oracle found some errors which required modifications to the MOD. I updated it at 13:50 swisstime 28.07.2005 - thanks TheOracle!
## MOD Title: Another Simple News Publishing Mod
## MOD Author: janfy < janfy@cagades.com > http://www.cagades.com/
## MOD Description: Adds news to your 4images gallery
##
## MOD Version: 1.3.0

Reference:
http://www.4homepages.de/forum/index.php?topic=6787.msg29663#msg29663

##############################################################
## Before Adding This MOD To Your Gallery, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]---------------------------------
#
1
includes/constants.php

#
#-----[ FIND ]---------------------------------
#
1
define('LIGHTBOXES_TABLE', $table_prefix.'lightboxes');

#
#-----[ AFTER, ADD ]------------------------------------------
#
1
define('NEWS_TABLE', $table_prefix.'news');

#
#-----[ OPEN ]---------------------------------
#
index.php

#
#-----[ FIND ]---------------------------------
#
1
unset($categories);

#
#-----[ AFTER, ADD ]------------------------------------------
#

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//-----------------------------------------------------
// ----- Show news ------------------------------------
//-----------------------------------------------------

if (!isset($config['news_home_display']) || $config['news_home_display'] == 1)
$sql = "SELECT news_title, news_text, user_name, news_date FROM ".NEWS_TABLE." ORDER BY news_date DESC LIMIT 0, ".((isset($config['news_nb']))?$config['news_nb']:5);
else if ($config['news_home_display'] == 2)
$sql = "SELECT news_title, news_text, user_name, news_date FROM ".NEWS_TABLE." WHERE news_date > ".(time() - ((isset($config['news_nb_days']))?$config['news_nb_days']:15)*86400)." ORDER BY news_date DESC";

$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $news = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $news .= $lang['no_news'];
  $news .= "</td></tr></table>";
}
else  {
  $news = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";

  while ($image_row = $site_db->fetch_array($result))
  {
    $news .= "<tr class=\"imagerow1\">\n";
    $news .= "<td width=\"100%\" valign=\"top\">\n";
    $new_is_new = ($image_row['news_date'] > time() - ((isset($config['news_cutoff']))?$config['news_cutoff']:3)*86400);
$news .= "<b>".$image_row['news_title']."</b>".(($new_is_new)?" <sup class=\"new\">".$lang['new']."</sup>":"").sprintf($lang['news_posted_by'], $image_row['user_name'], format_date($config['date_format']." ".$config['time_format'], $image_row['news_date']));
    $news .= "\n</td>\n";
    $news .= "</tr>\n";

    $news .= "<tr class=\"imagerow2\">\n";
    $news .= "<td width=\"100%\" valign=\"top\">\n<br/>";
$news .= format_text($image_row['news_text'], ((isset($config['news_html']))?$config['news_html']:0), 0, ((isset($config['news_bbcode']))?$config['news_bbcode']:1), ((isset($config['news_bbcodeimg']))?$config['news_bbcodeimg']:1));
$news .= "<br/><br/>\n</td>\n";
    $news .= "</tr>\n";

  } // end while

  $news .= "</table>\n";
} // end else

$site_template->register_vars(array(
"news" => $news,
"news_archives" => "<a href=\"".$site_sess->url(ROOT_PATH."news.php"\" class=\"link\">".$lang['news_archive']."</a>",
"news_main" => $lang['news_main']
));
unset($news);

#
#-----[ OPEN ]---------------------------------
#
admin/index.php

#
#-----[ FIND ]---------------------------------
#
1
show_nav_option($lang['nav_comments_edit'], "comments.php?action=modifycomments");

#
#-----[ AFTER, ADD ]------------------------------------------
#
1
2
3
show_nav_header($lang['news_main']);
show_nav_option($lang['news_add'], "news.php?action=addnews");
show_nav_option($lang['modify_news'], "news.php?action=modifynews");


#
#-----[ OPEN ]---------------------------------
#
lang/english/main.php

#
#-----[ FIND ]---------------------------------
#
1
$lang['delete'] = "[Delete]";

#
#-----[ AFTER, ADD ]------------------------------------------
#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$lang['news_main'] = 'News';
$lang['no_news'] = 'No news';
$lang['news_deleted'] = ' news deleted';
$lang['newss_deleted'] = ' news deleted';
$lang['news_deletion'] = 'News deletion';
$lang['newss'] = 'news';
$lang['news'] = 'news';
$lang['news_modified'] = 'News modified successfully.';
$lang['news_modified_nok'] = 'Error during news modification.';
$lang['news_deletion_confirmation'] = 'Do you really want to delete the %s selected news.';
$lang['edit_news_title'] = 'News #%d posted by %s';
$lang['news_title'] = 'Title';
$lang['news_content'] = 'Content';
$lang['news_date'] = 'Date';
$lang['modify_news'] = 'Edit news';
$lang['news_author'] = 'Author';
$lang['news_add'] = 'Add a news';
$lang['news_add_ok'] = 'News added successfully.';
$lang['news_posted_by'] = ' -- Posted by <b>%s</b> on <i>%s</i>';
$lang['news_archive'] = 'Archives';
$lang['page'] = 'Page';
#
#-----[ OPEN ]---------------------------------
#
lang/french/main.php

#
#-----[ FIND ]---------------------------------
#
1
$lang['delete'] = "[Supprimer]";

#
#-----[ AFTER, ADD ]------------------------------------------
#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$lang['news_main'] = 'Nouvelles';
$lang['no_news'] = 'Pas de nouvelle';
$lang['news_deleted'] = ' nouvelle supprimée';
$lang['newss_deleted'] = ' nouvelles supprimées';
$lang['news_deletion'] = 'Suppression de news';
$lang['newss'] = 'nouvelles';
$lang['news'] = 'nouvelle';
$lang['news_modified'] = 'Nouvelle modifiée avec succčs';
$lang['news_modified_nok'] = 'Erreur lors de la modification de la nouvelle.';
$lang['news_deletion_confirmation'] = 'Etes vous sur de vouloir supprimer la(les) %s nouvelle(s) sélectionnée(s)';
$lang['edit_news_title'] = 'Nouvelle #%d postée par %s';
$lang['news_title'] = 'Titre';
$lang['news_content'] = 'Contenu';
$lang['news_date'] = 'Date';
$lang['modify_news'] = 'Editer les nouvelles';
$lang['news_author'] = 'Auteur';
$lang['news_add'] = 'Ajouter une nouvelle';
$lang['news_add_ok'] = 'Nouvelle ajoutée avec succés.';
$lang['news_posted_by'] = ' -- Posté par <b>%s</b> le <i>%s</i>';
$lang['news_archive'] = 'Archives';
$lang['page'] = 'Page';

#
#-----[ OPEN ]---------------------------------
#
template/default/home.html

#
#-----[ FIND ]---------------------------------
#
1
{whos_online}

#
#-----[ BEFORE, ADD ]------------------------------------------
#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<table width="450" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="head1">
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr>
          <td class="head1">{news_main}</td>
          <td class="head1" align="right" height="20">{news_archives}</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="head1" colspan="2">{news}</td>
  </tr>
</table>
<br />

#
#-----[ OPEN ]---------------------------------
#
lang/english/admin.php

#
#-----[ FIND ]---------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*-- Setting-Group 8 --*/
$setting_group[8] = "News";
$news_display_optionlist = array(
  "1" => "Show the last 'X' news",
  "2" => "Show news of the last 'X' days",
);

$setting['news_home_display'] = "News display mode";
$setting['news_nb'] = "News number";
$setting['news_nb_days'] = "Days number";
$setting['news_cutoff'] = "Number of days each news is marked as new";
$setting['news_html'] = "Allow HTML in news";
$setting['news_bbcode'] = "Allow BB-Code in news";
$setting['news_bbcodeimg'] = "Allow images (BB-Code) in news";
#
#-----[ OPEN ]---------------------------------
#
lang/french/admin.php

#
#-----[ FIND ]---------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/*-- Setting-Group 8 --*/
$setting_group[8] = "Nouvelles";
$news_display_optionlist = array(
  "1" => "Afficher les 'X' derničres nouvelles",
  "2" => "Afficher les nouvelles des 'X' derniers jours",
);

$setting['news_home_display'] = "Mode d'affichage des nouvelles";
$setting['news_nb'] = "Nombre de nouvelles";
$setting['news_nb_days'] = "Nombre de jours";
$setting['news_cutoff'] = "Nombre de jours ou la nouvelle est considérée comme 'nouvelle'";
$setting['news_html'] = "Autoriser le HTML dans les nouvelles";
$setting['news_bbcode'] = "Autoriser le BB-Code dans les nouvelles";
$setting['news_bbcodeimg'] = "Autoriser les images (BB-Code) dans les nouvelles";
#
#-----[ OPEN ]---------------------------------
#
admin/settings.php

#
#-----[ FIND ]---------------------------------
#
1
show_setting_row("highlight_admin", "radio");

#
#-----[ AFTER, ADD ]------------------------------------------
#
1
2
3
4
5
6
7
8
show_table_separator($setting_group[8], 2, "#setting_group_8");
show_setting_row("news_home_display", "show_news_display_options");
show_setting_row("news_nb");
show_setting_row("news_nb_days");
show_setting_row("news_cutoff");
show_setting_row("news_html", "radio");
show_setting_row("news_bbcode", "radio");
show_setting_row("news_bbcodeimg", "radio");
#
#-----[ FIND ]---------------------------------
#
1
// end of functions

#
#-----[ BEFORE, ADD ]------------------------------------------
#
1
2
3
4
5
6
7
8
9
10
function show_news_display_options($setting_name, $setting_value) {
  global $news_display_optionlist;
  foreach ($news_display_optionlist as $key => $val) {
    echo "<input type=\"radio\" name=\"setting_item[".$setting_name."]\" value=\"$key\"";
    if ($setting_value == $key) {
      echo " checked=\"checked\"";
    }
    echo "> ".$val."<br />";
  }
}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#

#
#-----[ DATABASE UPDATE ]------------------------------------------
#

Open a web browser and open the page http://your_domain/4images_dir/install_news.php

and thanks a lot to theOracle which saved the 4images_news.zip file on his computer
TheOracle also have done a addon --> http://www.4homepages.de/forum/index.php?topic=9059

* 4images_news.zip (32.9 KB - downloaded 2315 times.)
Logged

Beati pauperi spiritus

4images 1.7 // My Installed Mods

TheOracle
Guest
« Reply #1 on: July 28, 2005, 01:35:42 PM »

*** IMPORTANT BUG FOUND AND CORRECTED ABOVE. ***

For users who already installed this MOD yesterday, it is imperative that you make the following modifications from

your index.php file due to sessions issues from the archives page. This was the main reason why numerous users has reported a bug in that page in the past.

Find :

Quote

"news_archives" => $lang['news_archive'],


and strongly replace with :

1
2
3

"news_archives" => "<a href=\"".$site_sess->url(ROOT_PATH."news.php")."\" class=\"link\">".$lang['news_archive']."</a>",


Then, in your templates/<your_template>/home.html file,

find :

Quote

<td class="head1" align="right"><a class="head1" href="news.php">{news_archives}</a></td>


simply replace with :

1
2
3

<td class="head1" align="right" height="20">{news_archives}</td>

Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17088

Thank You
-Given: 21
-Receive: 191

mmm PHP...


View Profile WWW
« Reply #2 on: July 30, 2005, 06:41:56 PM »

and strongly replace with :

1
2
3

"news_archives" => "<a href=\"".$site_sess->url(ROOT_PATH."news.php?sessionid=".$session_info['session_id'])."\" class=\"link\">".$lang['news_archive']."</a>",


Should be:
1
"news_archives" => "<a href=\"".$site_sess->url(ROOT_PATH."news.php")."\" class=\"link\">".$lang['news_archive']."</a>",
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
pkitty
Newbie
*
Offline Offline

Posts: 28

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #3 on: August 01, 2005, 10:10:38 PM »

This is on the new mod is that correct posted by Vano? Not the older ones, right?   ....I dont seem to be having any issues, so do I need to change mine?
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17088

Thank You
-Given: 21
-Receive: 191

mmm PHP...


View Profile WWW
« Reply #4 on: August 02, 2005, 12:06:01 AM »

This is on the new mod is that correct posted by Vano? Not the older ones, right? ....I dont seem to be having any issues, so do I need to change mine?
block the cookies and u'll see the issue: two sessionid in the url for news archive
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
TheOracle
Guest
« Reply #5 on: August 02, 2005, 12:12:28 AM »

Quote

block the cookies and u'll see the issue: two sessionid in the url for news archive


Since the answer above is now clean, modifications will be made above as the first post will be arranged shortly as well.
Logged
pkitty
Newbie
*
Offline Offline

Posts: 28

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #6 on: August 03, 2005, 01:26:21 AM »

Okay, I went and did this....and I see that there is a news/edit news in the control panel, but when I click on it, I now get a huge list of weird errors....

this was the mod for news that I installed http://www.4homepages.de/forum/index.php?topic=5142.0  should I not have done that....  *shakes Head*
Logged
TheOracle
Guest
« Reply #7 on: August 03, 2005, 01:54:50 AM »

Quote

this was the mod for news that I installed http://www.4homepages.de/forum/index.php?topic=5142.0  should I not have done that....  *shakes Head*


These are two seperated MODs which must not be used together.
Logged
BartAfterDark
Hero Member
*****
Offline Offline

Posts: 520

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #8 on: August 03, 2005, 08:30:36 PM »

How can I edit the text colors in the tag that is using {news}
I tried editing news_bit.html (works for the Archives) But news_show.html doesn't do anything. What am I doing wrong?
Logged
TheOracle
Guest
« Reply #9 on: August 03, 2005, 10:26:18 PM »

Quote

How can I edit the text colors in the tag that is using {news}


These classes are located in index.php and news.php file.
Logged
BartAfterDark
Hero Member
*****
Offline Offline

Posts: 520

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #10 on: August 04, 2005, 11:31:00 AM »

Quote

How can I edit the text colors in the tag that is using {news}


These classes are located in index.php and news.php file.

uhm. I found the code. But what should I change exatly? Embarassed
Logged
TheOracle
Guest
« Reply #11 on: August 04, 2005, 01:45:31 PM »

From index.php file :

Quote

$news .= "<tr class=\"imagerow1\">\n";
    $news .= "<td width=\"100%\" valign=\"top\">\n";
    $new_is_new = ($image_row['news_date'] > time() - ((isset($config['news_cutoff']))?$config['news_cutoff']:3)*86400);
    $news .= "<b>".$image_row['news_title']."</b>  -- Posté par <b>".$image_row['user_name']."</b> le <i>".format_date($config['date_format']." ".$config['time_format'], $image_row['news_date'])."</i>";
    $news .= "\n</td>\n";
    $news .= "</tr>\n";

    $news .= "<tr class=\"imagerow2\">\n";
    $news .= "<td width=\"100%\" valign=\"top\">\n<br/>";
    $news .= format_text($image_row['news_text'], ((isset($config['news_html']))?$config['news_html']:0), 0, ((isset($config['news_bbcode']))?$config['news_bbcode']:1), ((isset($config['news_bbcodeimg']))?$config['news_bbcodeimg']:1));
    $news .= "<br/><br/>\n</td>\n";
    $news .= "</tr>\n";


Simply change the bolded statement.

Note: There's no classes in news.php file. Wink
Logged
BartAfterDark
Hero Member
*****
Offline Offline

Posts: 520

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #12 on: August 04, 2005, 02:25:44 PM »

ohh yea my bad he ;D Thanks.

One last question, how come I can't change the bold font for the user who posted the news. The headline did have <b></b> but not the  $image_row['user_name'] Embarassed
Logged
TheOracle
Guest
« Reply #13 on: August 04, 2005, 02:30:11 PM »

I knew I should of left the rest of my message on my recent post.

The answer on this is that I took this peace ' from the very original post ' comparing on the top. As you can see, the quoted part I sent does actually includes the bolded tags on the $image_row['user_name']. Wink
Logged
Xaero
Newbie
*
Offline Offline

Posts: 16

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #14 on: August 07, 2005, 02:48:40 PM »

It works fine for me exept the MOD settings cannot be saved thus I cannot use HTML or BB-code in news. Though other options exept the Mod's work well
Logged
Pages: [1] 2 3 4 5 ... 20 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
piqs.de - Fotocommunity & lizenzfreie Fotos