• [MOD]Another Simple News Publishing Mod 5 0 5 1
Currently:  

Author Topic: [MOD]Another Simple News Publishing Mod  (Read 348966 times)

0 Members and 1 Guest are viewing this topic.

Offline janfy

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • http://www.cagades.com
Re: [MOD]Another Simple News Publishing Mod
« Reply #135 on: December 19, 2005, 01:54:45 PM »
I fight with it but..... :oops:

when i dont have news i see "no news" how can I add something like {if_news} news table here {end_if_news)  :?:

I need to remowe whole table when no news

Hi, here is a solution

Find the following code in index.php file at the 4images root directory
Code: [Select]
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>";
}

and replace by the following code :

Code: [Select]
if (!$num_rows)  {
  $news = "";
}

Find the following code in home.html file in directory <4images root directory>/templates/default (il you use the default template)

Code: [Select]
<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"><a class="head1" href="news.php">{news_archives}</a></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="head1" colspan="2">{news}</td>
  </tr>
</table>

Add before this code :

Code: [Select]
{if news}
Add after this code :

Code: [Select]
{endif news}
That's all folks

Offline Digital1

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #136 on: December 23, 2005, 12:39:59 AM »
I installed the mod, and it works fine. But when I post something under news... Who it is posted by is not in english. How Do I fix that?

Example... "Poste Par "so in so".

Rather, I want... Posted by "so in so".


ps- "newbie" under my name says it all. :)

Offline janfy

  • Newbie
  • *
  • Posts: 49
    • View Profile
    • http://www.cagades.com
Re: [MOD]Another Simple News Publishing Mod
« Reply #137 on: December 23, 2005, 10:55:16 AM »
Edit file index.php,

FIND this line :

Code: [Select]
$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>";
and REPLACE by this one :

Code: [Select]
$news .= "<b>".$image_row['news_title']."</b>".sprintf($lang['news_posted_by'], $news_row[$i]['user_name'], format_date($config['date_format']." ".$config['time_format'], $news_row[$i]['news_date']));

Offline Zyga

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #138 on: December 24, 2005, 08:35:19 PM »
yeah thx !

it works great

Offline aq8.net

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #139 on: December 25, 2005, 02:02:23 PM »
hi

i got something for you

you can change the news text feild to make it small with (read more..).... and a link for sure

how to make that ? simple

in index.php (make back up ist)

try to find
Code: [Select]
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";

replace with

Code: [Select]
else if ($config['news_home_display'] == 2)
$sql = "SELECT news_id, 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";

and also in index.php

try to change this code

Code: [Select]
    $new_is_new = ($image_row['news_date'] > time() - ((isset($config['news_cutoff']))?$config['news_cutoff']:3)*86400);
$news .= "<b><a href=newsfull.php?news_id=".$image_row['news_id'].">".$image_row['news_title']."</a>".(($new_is_new)?" <sup class=\"new\">".$lang['new']."":"").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";
    $boldstart = "<b>";
    $boldend = "</b>";
    $news_text = substr($image_row['news_text'],0, 400);
    $image_row['news_text'] = $news_text;
    $news .= "<tr class=\"imagerow2\">\n";
    $news .= "<td width=\"100%\" valign=\"top\">\n<br/>";
$news .= $boldstart.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 .= "<b>.....</b>";
$news .= "<b><a href=newsfull.php?news_id=".$image_row['news_id'].">".$lang['news_tafasel']."</a></b>";
$news .= "<br/><br/>\n</td>\n";
    $news .= "</tr>\n";

to be like this

Code: [Select]
    $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";

also in index.php

change this code

Code: [Select]
$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']
));

to become this code

Code: [Select]
$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']
));

this is for index.php

the newsfull.php = news.php ....( i rename the file)

demo www.aq8.net/library

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #140 on: December 25, 2005, 02:42:44 PM »
@aq8.net :

I have not tested your codings but sounds interesting.

Althought, I have found weaknesses in your modifications.

Find :

Quote

$news .= "<b><a href=newsfull.php?news_id=".$image_row['news_id'].">".$image_row['news_title']."</a>".(($new_is_new)?" <sup class=\"new\">".$lang['new']."":"").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";


replace with :

Code: [Select]

$news .= "<b><a href=\"".$site_sess->url(ROOT_PATH."newsfull.php?news_id=".$image_row['news_id'])."\" class=\"link\">".$image_row['news_title']."</a>".(($new_is_new)?" <sup class=\"new\">".$lang['new']."":"").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";


Then, find :

Quote

$news .= "<b><a href=newsfull.php?news_id=".$image_row['news_id'].">".$lang['news_tafasel']."</a></b>";


replace with :

Code: [Select]

$news .= "<b><a href=\"".$site_sess->url(ROOT_PATH."newsfull.php?news_id=".$image_row['news_id'])."\" class=\"link\">".$lang['news_tafasel']."</a></b>";


Then, find :

Quote

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


replace it with :

Code: [Select]

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


These should do the trick. ;)

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #141 on: December 25, 2005, 02:44:11 PM »
For presentation of this news in a NEWS-READER :
Für die Präsentation dieser News in einem NEWS-READER :

[MOD] News-RSS-Feed V.1.0

mawenzi
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline aq8.net

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #142 on: December 25, 2005, 02:44:58 PM »
you are the king

:)

any way i was try to help and the code is working with me fine

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #143 on: December 25, 2005, 03:03:28 PM »
Quote

any way i was try to help and the code is working with me fine


I may believe so. Althought, you did not used $site_sess within your <a href which is a pretty high risk when requesting your users to be logged in. ;)

In the mean time, one line were badly commented when using the $site_sess class statement.

However, all has been fixed now and thanks for posting this.

Merry Christmas.

Offline aq8.net

  • Pre-Newbie
  • Posts: 7
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #144 on: December 26, 2005, 02:06:07 PM »
i did so and it work with the sessionid ....

thanks

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #145 on: December 26, 2005, 02:53:42 PM »
Quote

i did so and it work with the sessionid ....


May be it did. However, it wasn't validated through the SQL's sessions table. ;)

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #146 on: December 30, 2005, 01:17:06 AM »
@aq8.net :

Recently, I have created a tutorial on this subject. Perhaps you'd like to take a look at it to gain more information about this :

http://www.4homepages.de/forum/index.php?topic=10897.0

;)

Offline castor

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #147 on: December 30, 2005, 12:02:38 PM »
@ aq8.net :
 the Copyright footer at your site is not readable.. in this color ..

Offline JensF

  • Addicted member
  • ******
  • Posts: 1.028
    • View Profile
    • http://www.terraristik-galerie.de
Re: [MOD]Another Simple News Publishing Mod
« Reply #148 on: January 16, 2006, 10:59:41 AM »
Hi ivan,

danke für deine Mail aber dein Problem hättest du eventuell selber lösen können wenn du das Thema hier genau verfolgt hättest ;)

http://www.4homepages.de/forum/index.php?topic=9064.msg45868#msg45868

Ich hoffe das hilft dir weiter....
Mit freundlichem Gruß
Jens Funk



-> Sorry for my bad English <-

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #149 on: January 16, 2006, 05:25:42 PM »
Would it be possible to report this problem in english in order to have a better understanding of this situation ? ;)