4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Fugaziman on April 13, 2003, 04:37:23 AM

Title: [Mod] Latest News and Archive
Post by: Fugaziman on April 13, 2003, 04:37:23 AM
Okay I was told by a friend that this original mod was getting a bit to confusing with all the additions and improvements I made over time. So with this in mind I've replaced my original post with this one.
Hopefully it will be easier to follow (and still work :wink:  )

Mod - Create Latest/Archive News feature for your home page.

History: I've been asked quite a few times about the Latest News section I had on my home page and how I did it. Well it was only two HTML pages that I had to manually edit each time to add or move to the archive page. It was also formatted to fit in my site so wasn't easy to install on other 4image sites.
So I've created this quick Mod hoping that it would be helpful to others wanting this function.

What it does: Rather than creating more new tables and pages to create a whole new comment/bulletin board I cheated. This mod actually uses the exiting Comments table and pages (without any changes) to enter in your latest news.
Okay it's not rocket science but it works and gives the results required.

NOTE: Remember each time you add a latest news comment it will add a count to your total comments.
BUT remember as this is a very private category only the administrator will see the full count as other wont have access to it.

So READ THE INSTRUCTIONS BELOW FIRST to see if it's okay for you.
Take a look at my site to see what you think. Then Install this Mod if you want to.  

As always before starting any Mod make backup copies of the files you are going to modify(Just in case).

Modified files:
./Index.php
./templates/your_template/home.html
./details.php

New Files:
./templates/your_template/news_comment_bit.html
./templates/your_template/archive.html

 :arrow: Step 1.  Create simple image to be used to as your Latest_news image as you would any other image.
You can use this one if you want http://www.newman.d2g.com/Code_help_files/Latest_News.jpg

 :arrow: Step 2  Log into your sites Admin Control Panel

 :arrow: Step 3  Create a New Category called something like "News Updates"and set all Permissions to "Private"

 :arrow: Step 4  If you want others to add news then you can update their user settings to give them permissions to this new category.

 :arrow: Step 5  Add the image you created (in step 1) to this category as you would any other image.
VERY IMPORTANT: WRITE DOWN the "image_id" value given when imported (eg 3456).    I can't stress how important this is. You will need this number several times during installation of this mod. YOU HAVE BEEN WARNED

Ok! Here's were the code changes start.

 :arrow: Step 6  In your templates directory CREATE NEW TEMPLATE FILE called news_comment_bit.html.

INSERT this code
Code: [Select]
<tr>
<td class="row2" ><div align="right"><small>(Date Posted: {news_comment_date})</small></div><b>Headline: {news_comment_headline}</b></td>
</tr>
<tr>
<td class="row1" align="left">{news_comment_text}</td>
</tr>

 :arrow: Step 7  Edit index.php

Find :
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------

Just BEFORE this, INSERT:
Code: [Select]
//--------------------------------------------------------
// Latest and Archive News Mod --
// --
// User configurable variables --
// You must change the first 4 variables to meet --
// your requirements:     (see notes below) --
//     $display_by_count --
//     $latest_news_day --
//     $show_news_articles --
//     $news_image --
//--------------------------------------------------------
  $display_by_count = "0";      // values 0 or 1 ....
                                // .... change this to 0 if display by days posted
                                // .... or 1 to display fixed number of news articles as Latest
                               
  $latest_news_days = "31";     // Number of days news displays at Latest ....
                                // .... change This to the number of days news shows as Latest
                               
  $show_news_articles = "5";    // Number of news articles to show ....
                                // .... change This to fixed number of articles to display for latest news
                               
  $news_image = "*****";          // Change This to your Latest news image id
//----------------------------------------------------

$new_news = (time() - 60 * 60 * 24 * $latest_news_days);

if ($newstype == "latestnewsall"){
    $news_type = "latestnewsall";
    }
else {
    $news_type = "latestnews";
    }

  $additional_sql = "";

  if ($news_type == "latestnews") {

    if ($display_by_count) {
        $additional_sql .= "  c.image_id = '".$news_image."'";
        $additional_sql_2 .= " LIMIT ".$show_news_articles;
    }
    else {
        $additional_sql .= " c.comment_date > '".$new_news."' AND c.image_id = '".$news_image."'";
        $additional_sql_2 .= "";
    }
  }

  else {
    $additional_sql .= " c.image_id = '".$news_image."'";
    $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>&nbsp;/&nbsp;Archived News";
  }

  $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2 ;

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

  while ($row = $site_db->fetch_array($result)) {
    $news_comment_row[] = $row;
  }

  $site_db->free_result($result);
   
// This is the Paging stuff
  if ($newstype == "latestnewsall") {
       
    include(ROOT_PATH.'includes/paging.php');
    $perpage = $show_news_articles;
    $link_arg = $site_sess->url(ROOT_PATH."index.php?newstype=latestnewsall");
    $getpaging = new Paging($page, $perpage, $num_rows, $link_arg);
    $offset = $getpaging->get_offset();

    $site_template->register_vars(array(
      "paging" => $getpaging->get_paging(),
      "paging_stats" => $getpaging->get_paging_stats()
    ));
     
    $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2."  
            LIMIT $offset, $perpage";

          $result = $site_db->query($sql);
          $num_rows = $site_db->get_numrows($result);
          $news_comment_row = array();
           
      while ($row = $site_db->fetch_array($result)) {
            $news_comment_row[] = $row;
          }
  }

  if (!$num_rows) {
      $news_comments = "&nbsp;&nbsp;&nbsp;<b>No New News to report within the last ".$latest_news_days." days.</b>";
  }
  else {
      $news_comments = "";
      $bgcounter = 0;

    for ($i = 0; $i < $num_rows; $i++) {
        $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;

        $site_template->register_vars(array(
            "news_comment_headline" => format_text($news_comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
            "news_comment_text" => format_text($news_comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
            "news_comment_date" => format_date($config['date_format']." ".$config['time_format'], $news_comment_row[$i]['comment_date']),
            "row_bg_number" => $row_bg_number));

        $news_comments .= $site_template->parse_template("news_comment_bit");
    }

  }
  $site_template->register_vars("news_comments", $news_comments);
  unset($news_comments);

//-----------------------------------------------------
//---End of Show Latest News   -------------------------------
//-----------------------------------------------------

 :arrow: Step 8  at bottom of page Search for
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));
 


Replace with
Code: [Select]
if ($news_type == "latestnewsall") {  
  $site_template->print_template($site_template->parse_template(archive));      
}  
else {  
  $site_template->print_template($site_template->parse_template($main_template));  
}
 
 :arrow: Step 9  In the code you just added to your Index.php you need to change the 4 variables to meet your sites requirements.

$display_by_count = "0";        Set to values 0 or 1 ....
                                Set to 0 (Zero) If you want to display by number of days posted
                                Set to 1 (One) to display a fixed number of Latest News comments.
                               
$latest_news_days = "31";       Set to the Number of days New News comments are displayed before
                                moving to archive page/link
                               
$show_news_articles = "5";      Set to a fixed number of news comments you want to display at Latest
                               
$news_image = "*****";            Change this to your Latest news image id (eg 3421) that you got in step 5

 :arrow: Step 10  Edit ./templates/your_template/home.html
Insert this code where you want the Latest News comments to display
Code: [Select]
<table width="100%" border="1" cellspacing="1" cellpadding="1">
    <tr>
        <td align="left"  class="head1" height="20" width="100%"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" /><a href="./index.php">Latest News</a></td>
    </tr>
    <tr>
        <td>
        <table width="100%" border="1" cellspacing="1" cellpadding="4">
        {news_comments}
        </table>
        </td>
    <tr>
    <tr>
        <td align="right" class="head1" height="20" width="100%"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" /><a href="./index.php?newstype=latestnewsall">News Archive</a>&nbsp;&nbsp;</td>
    </tr>
</table>

 :arrow: Step 11  By default 4images only allows 1 comment per image per ip address per given time period. This is to stop your site being spammed with loads and loads of comments. For the Private Latest News image though you may want to enter 2 or 3 news comments at once so to bypass this for just your Latest News Image do this...
         
Edit ./details.php file
Find:
Code: [Select]
$sql = "SELECT comment_ip, comment_date
            FROM ".COMMENTS_TABLE."  
            WHERE image_id = $id  
            ORDER BY comment_date DESC  
            LIMIT 1";
    $spam_row = $site_db->query_firstrow($sql);
    $spamtime = $spam_row['comment_date'] + 180;

    if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  {
      $msg .= (($msg != "") ? "" : "").$lang['spamming'];
      $error = 1;
    }
   
Replace with
Code: [Select]
if ($id != "****"){   //added for latest news mod
    $sql = "SELECT comment_ip, comment_date
            FROM ".COMMENTS_TABLE."  
            WHERE image_id = $id  
            ORDER BY comment_date DESC  
            LIMIT 1";
    $spam_row = $site_db->query_firstrow($sql);
    $spamtime = $spam_row['comment_date'] + 180;

    if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  {
      $msg .= (($msg != "") ? "" : "").$lang['spamming'];
      $error = 1;
    }
  }

In the code you just replaced change "****" to be your Latest_News image id that you wrote down in step 5

 :arrow: Step 12  Create a new template page in your templates directory to show your news archive page and allow paging of old news. I suggest making a copy of your home.html file, renaming it archive.html, edit it and removing all the stuff you don't want to display on your news archive page.

Edit archive.html and insert this code where you want the Archived News Comments Archive to appear
Code: [Select]
<table width="100%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td align="left"  class="head1" height="20">Archived News</td>
                <td align="right" class="head1" height="20">{paging}></td>
</tr>

<tr>
<td colspan="2">
<table width="100%" border="1" cellspacing="1" cellpadding="4">
{news_comments}
</table>
</td>
</tr>
<tr>
<td align="left"  class="head1" height="20"> <a href="./index.php">Latest News</a></td>
<td align="right" class="head1" height="20">{paging} </td>
</tr>            
</table>


That's it. Now you can test it to see if it works.
1)Log into your site as your admin account.
2)Find your new Category, remember it's something like News Updates
3)Add a comment or 3 to the Latest News image you created
3)Go back to home page and see the results.

I think thats it.
I tested this documents steps fully on a fresh install of the 4images PHP pages and Default template pages. It worked fine. So if you follow the steps carefully it should work for you first time.

Thanks to Chris for getting on my back and making me do this re-write
Good luck with your sites Everyone.

Fugaziman
Title: cna you share
Post by: mantra on April 14, 2003, 01:29:45 AM
This mood I always wait ,nice job
Fugaziman


Can you share what code to add to make  paging in your comment :?:  :?: :wink:
Title: [Mod] Latest News and Archive
Post by: Fugaziman on April 14, 2003, 03:49:22 AM
Mantra.

I've played about with my member.php file so much that I wouldn't know where to start instructiong you how to add the paging bit to yours. :oops:
BUT...
If you want to compare my files to yours and make the changes you can download them here
http://www.newman.d2g.com/code_help_files/member_comment_paging.zip

I've include the template page as well as you need to add the {paging} variable conditionally. You'll know what I mean when you see it.   :?  

Hope that helps just a little
Fugaziman  8)
Title: [Mod] Latest News and Archive
Post by: ai-gu on April 14, 2003, 04:01:53 AM
Hi all,

Any one is here have the MOD like "lastest post in the phpBB forum" to show up on 4images??

Thanks for quick helps
Title: [Mod] Latest News and Archive
Post by: Chris on April 14, 2003, 04:29:12 AM
It would have been better to post your question in the
"Mods & Plugins (Requests & Discussions)" forum.

Having said that, http://www.4homepages.de/forum/viewtopic.php?t=4648
Title: [Mod] Latest News and Archive
Post by: mantra on April 14, 2003, 05:11:55 AM
thanks Fugaziman, I will try.

 :D
Title: [Mod] Latest News and Archive
Post by: PuCK on April 14, 2003, 11:36:09 AM
Great MOD. It worked right away but I encountered one little "problem":

Code: [Select]
$sql = "SELECT comment_ip, comment_date
            FROM ".COMMENTS_TABLE."
            WHERE image_id = $id
            ORDER BY comment_date DESC
            LIMIT 1";
    $spam_row = $site_db->query_firstrow($sql);
    $spamtime = $spam_row['comment_date'] + 180;

    if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['spamming'];
      $error = 1;


must be replaced with:
Code: [Select]
if ($id != "8136"){   //added for latest news mod
    $sql = "SELECT comment_ip, comment_date
            FROM ".COMMENTS_TABLE."
            WHERE image_id = $id
            ORDER BY comment_date DESC
            LIMIT 1";
    $spam_row = $site_db->query_firstrow($sql);
    $spamtime = $spam_row['comment_date'] + 180;

    if ($session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  {
      $msg .= (($msg != "") ? "<br />" : "").$lang['spamming'];
      $error = 1;
       }


So without the last }

Also it's better to change the lins of the spacer images:

replace
Code: [Select]
"./templates/newman_grey/images/spacer.gif"


with:

Code: [Select]
"{template_url}/images/spacer.gif"
Title: Amended script in my Mod
Post by: Fugaziman on April 14, 2003, 03:49:31 PM
OOps  :oops:

I forgot about that one. I've amended the code above in my script to add your changes.
Thanks for checking my mod for me.

Fugaziman  8)
Title: [Mod] Latest News and Archive
Post by: Bomba on April 15, 2003, 02:41:33 PM
great mod!

i think it would be even better if all registed users could post news or articles on it, and it would be really cool if there was a "leave comment" to every single news/article posted.

i'm now working on something of this kind but my knowledge in coding isn't the best.
u can check what i achive here:
http://www.web-fxdesigns.com/4images/

it's only a test gallery, and it's in portuguese.
thanks[/url]
Title: Fantastic
Post by: lakeside on April 15, 2003, 07:45:44 PM
Fantastic Mod

This is a great mod, I was hand editing the template everytime I wanted to add a bit of info to the home page in the form of a news update.  This is great since as admin I can delete the comments when they are out of date or taking up too much space on the home page.

Thank you very very very much for making my life a little easier.
Title: [Mod] Latest News and Archive
Post by: mantra on April 16, 2003, 04:43:25 AM
How to make paging for this mod???



The last time Fugaziman member.php it's hard to understand.
 :wink:
Title: [Mod] Latest News and Archive
Post by: bag53 on April 17, 2003, 07:49:22 AM
Instead of time limit on how long they stay up, a post limit would be better. Like set it to only show 10 news posts displacing older ones. Then the older news would move to an archive paging system.

I've been looking for a better way to post news in 4images. Right now I have a hacked up b2 from cafelog running on my site. Don't ask me how I did it. You may not want to do it since it is really chopped up.
Title: This should be easy to do...
Post by: Fugaziman on April 17, 2003, 04:29:40 PM
Quote
set it to only show 10 news posts displacing older ones


This should be quite easy to do but I wont be able to get round to it until probably later today (some of us have to work as well as have fun  :D ).

I'll post a code change soon.

Fugaziman
Title: Done
Post by: Fugaziman on April 18, 2003, 02:43:22 AM
Quote
set it to only show 10 news posts displacing older ones


Okay it's done.
I Have changed the code you add to your index.php, (see first post) to allow you the choice of displaying a fixed number of News Comments or News comments posted within a set number of days.

And all you have to do is set a single variable to  0 or 1 depending on your preference   :)

Somebody asked about
Quote
paging
for this Mod !!! I'll look into it over the next couple of days to see if I can get it to work.

Hope that helps
Fugaziman
Title: thanks
Post by: mantra on April 18, 2003, 05:30:32 PM
thanks Fugaziman :lol:
Title: [Mod] Latest News and Archive
Post by: rcole82 on April 24, 2003, 06:25:28 AM
this is an awesome mod, you rock man!! 8)  it works fine on my homepage. i switched it around though. hope you don't mind.  :P

http://member.lycos.co.uk/rcole82
Title: [Mod] Latest News and Archive
Post by: Fugaziman on April 24, 2003, 05:33:43 PM
Quote from: rcole82
this is an awesome mod, you rock man!! 8)  it works fine on my homepage. i switched it around though. hope you don't mind.  :P

http://member.lycos.co.uk/rcole82


Thanks You  :oops:

That's fine by me. I tried looking on the link you left to see what you had done but it doesn't work ?

If you look at the news archive on my site now you can see it uses a template without all the latest images, etc. If anybody is interested in this then I'll add a bit more to this mod. Let Me Know !

Fugaziman
Title: [Mod] Latest News and Archive
Post by: mantra on April 25, 2003, 02:31:45 AM
The paging Fugaziman????
Title: [Mod] Latest News and Archive
Post by: Fugaziman on April 27, 2003, 04:23:56 AM
Quote from: mantra
The paging Fugaziman????


I'm trying to find time to do it Honest  :oops:
I'll try to get round to in in the next couple of days. As I've created a template page to use it should be a little easier.

Please be patient with be though  :)
Fugaziman
Title: thanks
Post by: mantra on April 27, 2003, 04:36:53 AM
Big thanks :P  :P
Title: [Mod] Latest News and Archive
Post by: Fugaziman on April 27, 2003, 07:17:12 PM
THIS POST HAS BEEN REPLACE BY THE FIRST ONE IN THIS THREAD.
THE UPDATES WHERE GETTING TO CONFUSING FOR PEOPLE TO FOLLOW SO I'VE RE-DOCUMENTED THE STEPS AND TESTED FULLY. PLEASE GO PACK TO MY FIRST POSTING ON THIS TOPIC TO FOLLOW INSTUCTIONS


THANKS
Fugaziman



Quote from: mantra
The paging Fugaziman????


Okay here's the changes you need to make to my original mod to allow for paging...

To display the Archived News I now use a new template page rather than showing all the new images, categories, in the home.html page each time.

So here's what you need to do...

Step 1  :arrow:  Make a copy of you Index.php file (just in case)
Step 2  :arrow:  Edit the index.php and search for my latest news mod you added
Step 3  :arrow:  Make a note of the variable you set previously especially your Latest News image ID
Step 4  :arrow:  Replace the mod with this ....
Code: [Select]
//----------------------------------------------------
// Latest and Archive News Mod                      --
//                                --
// User configurable variables                      --
// You must change the first 4 variables to meet    --
// your requirements:     (see notes below)        --
// $display_by_count    --
// $latest_news_day    --
// $show_news_articles    --
// $news_image        --
//----------------------------------------------------
  $display_by_count = "0";      // values 0 or 1
  // Change this to 0 if display by days posted or 1 to display fixed number of news articles as Latest
  $latest_news_days = "31";     // Number of days news displays at Latest
  // Change This to the number of days news shows as Latest
  $show_news_articles = "5";    // Number of news articles to show
  // Change This to fixed number of articles to display for latest news
  $news_image = *****; // Change This to your Latest news image id

  $new_news = (time() - 60 * 60 * 24 * $latest_news_days);
//----------------------------------------------------

if ($newstype == "latestnewsall"){
    $news_type = "latestnewsall";
    }
else {
    $news_type = "latestnews";
    }

//-----------------------------------------------------
//---Show Latest News   -------------------------------
//-----------------------------------------------------
  $additional_sql = "";

  if ($news_type == "latestnews") {

if ($display_by_count) {
$additional_sql .= "  c.image_id = '".$news_image."'";
$additional_sql_2 .= " LIMIT ".$show_news_articles;
}
else {
$additional_sql .= " c.comment_date > '".$new_news."' AND c.image_id = '".$news_image."'";
$additional_sql_2 .= "";
}
  }

  else {
    $additional_sql .= " c.image_id = '".$news_image."'";
    $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>&nbsp;/&nbsp;Archived News";
  }


  $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2 ;

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


  while ($row = $site_db->fetch_array($result)) {
    $news_comment_row[] = $row;
  }

  $site_db->free_result($result);
 
// Paging stuff
  if ($newstype == "latestnewsall") {
 
include(ROOT_PATH.'includes/paging.php');
$perpage = $show_news_articles;
$link_arg = $site_sess->url(ROOT_PATH."index.php?newstype=latestnewsall");
$getpaging = new Paging($page, $perpage, $num_rows, $link_arg);
$offset = $getpaging->get_offset();

$site_template->register_vars(array(
 "paging" => $getpaging->get_paging(),
 "paging_stats" => $getpaging->get_paging_stats()
));

$sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2."
            LIMIT $offset, $perpage";

  $result = $site_db->query($sql);
  $num_rows = $site_db->get_numrows($result);
  $news_comment_row = array();
 
  while ($row = $site_db->fetch_array($result)) {
    $news_comment_row[] = $row;
  }
  }
//

  if (!$num_rows) {
      $news_comments = "&nbsp;&nbsp;&nbsp;<b>No New News to report within the last ".$latest_news_days." days.</b>";
  }
  else {
      $news_comments = "";
      $bgcounter = 0;

    for ($i = 0; $i < $num_rows; $i++) {
        $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;

        $site_template->register_vars(array(
            "news_comment_headline" => format_text($news_comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
            "news_comment_text" => format_text($news_comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
            "news_comment_date" => format_date($config['date_format']." ".$config['time_format'], $news_comment_row[$i]['comment_date']),
            "row_bg_number" => $row_bg_number));

        $news_comments .= $site_template->parse_template("news_comment_bit");
    }

  }
  $site_template->register_vars("news_comments", $news_comments);
  unset($news_comments);


This uses the   $show_news_articles = "5"; variable to set the number of news comments to display at the to of the page. You can change this number to fit in your site.

Step 5 :arrow: Search for
Code: [Select]

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream
));


Step 6 :arrow: Insert this code immediatley after
Code: [Select]

  if ($news_type == "latestnewsall") {
  $site_template->print_template($site_template->parse_template(archive));
  }
  else {
$site_template->print_template($site_template->parse_template($main_template));
  }

 
Step 7 :arrow: set the variables at the top of this mod especially the $news_image with your Latest News image ID
Step 8  :arrow: Create a new template page in your templates directory. I suggest making a copy of your home.html file, renaming it archive.html, and removing all the stuff you don't want to display on your news archive page.

Step 9  :arrow: insert this code where you want the news archive to appear
Code: [Select]
<table width="100%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td align="left"  class="head1" height="20">Archived News</td>
<td align="right" class="head1" height="20">{paging}></td>
</tr>

<tr>
<td colspan="2">
<table width="100%" border="1" cellspacing="1" cellpadding="4">
{news_comments}
</table>
</td>
</tr>
<tr>
<td align="left"  class="head1" height="20"> <a href="./index.php">Latest News</a></td>
<td align="right" class="head1" height="20">{paging} </td>
</tr>
</table>


Okay I think that's it.
I had a little trouble posting this update as I kept getting "Unable to connect to database errors but I think it's all here.  If you have any problems then let me know and I'll help you.

Good luck
Fugaziman
Title: you cooll
Post by: mantra on April 28, 2003, 02:23:49 AM
you coolllll man, thank's. :D  :D  :D  :D  :D  :D
Title: [Mod] Latest News and Archive
Post by: tmacisnbr1 on May 17, 2003, 12:47:36 AM
Fugaziman,

Hello, ive tried this whole thing over and over again, im just not the best at applying mods. Would it be so much trouble if you could maybe insert just the mod for me? Sorry for this request, but i would really like to have this and just cant seem to get it right.

If you have a little spare time and would be willing to help me out a little, please email at tmacisnbr1@aol.com.

Thanks!
Alex
Title: [Mod] Latest News and Archive
Post by: Chris on May 17, 2003, 03:38:33 AM
Quote from: Fugaziman
Quote from: mantra
The paging Fugaziman????


Okay here's the changes you need to make to my original mod to allow for paging...


 :D  8)  :D  8) :D

I have one request though.  In reviewing your original post and this latest update, I'm confused as to what exactly needs to be done since I have NOT installed this mod yet.

Could you please EDIT your original post to provide us with one set of instructions for your latest mod change?

You could summarize a list of changes made in each edit while keeping the code and instructions current with whatever is the latest.  Here's an example of what I mean:
http://www.4homepages.de/forum/viewtopic.php?t=3850
http://www.4homepages.de/forum/viewtopic.php?t=4606

Anyone reading this thread a week or month from now who hasn't installed any of it would find it much easier to follow one set of instructions rather than several.

I'm sure we would all appreciate it.  If you can find the time to do this, BIG TIME Thanks  :!:

Outstanding mod by the way...
Title: [Mod] Latest News and Archive
Post by: Fugaziman on May 17, 2003, 03:44:25 AM
Quote from: tmacisnbr1


If you have a little spare time and would be willing to help me out a little, please email .

Thanks!
Alex


Have sent you an email. Will help if I can.
Might I suggest next time sending me a PM from the forum. :wink:
Title: Re: [Mod] Latest News and Archive
Post by: Chris on May 17, 2003, 09:55:46 PM
Great mod.  There's just one little bug in the instructions.  The following step has an error:
Quote from: Fugaziman

 :arrow: Step 8  Search for
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream
));


Insert this code immediatley AFTER
Code: [Select]
if ($news_type == "latestnewsall") {
  $site_template->print_template($site_template->parse_template(archive));    
  }
  else {
    $site_template->print_template($site_template->parse_template($main_template));
  }
 

It really should be...

 :arrow: LOCATE this at the very bottom of index.php
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));
REPLACE that line with
Code: [Select]
if ($news_type == "latestnewsall") {
  $site_template->print_template($site_template->parse_template(archive));    
}
else {
  $site_template->print_template($site_template->parse_template($main_template));
}

Thanks for the nice mod.
Title: Thanks
Post by: Fugaziman on May 17, 2003, 10:04:28 PM
Thanks Chris

have amended post
Fugaziman
Title: [Mod] Latest News and Archive
Post by: weezle on May 22, 2003, 10:21:22 AM
Step 5 Add the image you created (in step 1) to this category as you would any other image.
VERY IMPORTANT: WRITE DOWN the "image_id" value given when imported (eg 3456). I can't stress how important this is. You will need this number several times during installation of this mod. YOU HAVE BEEN WARNED



How do i get the image_id?
Is this an name or an value, like "news.jpg"?
I dont know what i have to do there,
i am sorry my english wasnt the best, i come from germany...
i am a beginner....where can i find the image_id?

Thanks for all help!!

Greetings Marco
Title: [Mod] Latest News and Archive
Post by: Fugaziman on May 22, 2003, 04:18:32 PM
Quote
How do i get the image_id?


Just log in to your site with your admin account
find your latest News image
click on it's thumbnail to get the details page
in the URL you should see something like image_id = XXXX

That's your image id.
Good luck
Fugaziman
Title: [Mod] Latest News and Archive
Post by: weezle on May 22, 2003, 11:10:55 PM
Thanks ,for your help,
News Mod is still working, its very nice.

Greetings
Marco
Title: [Mod] Latest News and Archive
Post by: weezle on May 22, 2003, 11:40:52 PM
New Problem...

http://www.bleischter-suffkoepp.de/4images/index.php

if your are looking on my suite,
you will see, there is on the left side an free place,
you know, how i can change the side of my news..?

if i am logged on, there wasnt this failure...whats happend?

Thx for help again


Greetings
Marco
Title: [Mod] Latest News and Archive
Post by: V@no on May 23, 2003, 01:23:56 AM
check your user_loginform.html template
Title: [Mod] Latest News and Archive
Post by: weezle on May 23, 2003, 02:19:01 PM
<table width="100%" border="0" cellpadding="4" cellspacing="0">
  <tr>
    <td valign="top" align="left">
      <form action="{url_login}" method="post">
        {lang_user_name}<br />
        <input type="text" size="10" name="user_name" class="logininput" />
        <br />
        {lang_password}<br />
        <input type="password" size="10" name="user_password" class="logininput" />
        <br />
        <table border="0" cellspacing="0" cellpadding="0">
          <tr valign="top">
            <td><input type="checkbox" name="auto_login" value="1" /></td>
            <td><span class="smalltext">{lang_auto_login}</span></td>
          </tr>
        </table>
        <br />
      <input type="submit" value="{lang_login}" class="button" />
      </form>
      &raquo; <a href="{url_lost_password}">{lang_lost_password}</a><br />
     &raquo; <a href="{url_register}">{lang_register}</a></td>
  </tr>
</table>
 



that is my user_loginform.html, but i wont find a failure.....
normally i have to change the home.html or?
Title: [Mod] Latest News and Archive
Post by: Fugaziman on May 23, 2003, 05:00:20 PM
Looks like a problem with your home.html file.
perhaps a missing <tr> or <td>

Fugaziman
Title: [Mod] Latest News and Archive
Post by: tmacisnbr1 on May 30, 2003, 05:25:30 AM
Is there a way to make it so that it shows the name of the user that posted the comment in the news header?
Title: [Mod] Latest News and Archive
Post by: Fugaziman on May 31, 2003, 04:32:28 PM
Quote from: tmacisnbr1
Is there a way to make it so that it shows the name of the user that posted the comment in the news header?


I haven't tested this but it should work.....

Replace Step7 with this code
Code: [Select]
//--------------------------------------------------------
// Latest and Archive News Mod            --
//                     --
// User configurable variables            --
// You must change the first 4 variables to meet   --
// your requirements:     (see notes below)      --
//     $display_by_count            --
//     $latest_news_day               --
//     $show_news_articles            --
//     $news_image               --
//--------------------------------------------------------
  $display_by_count = "0";      // values 0 or 1 ....
                                // .... change this to 0 if display by days posted
                                // .... or 1 to display fixed number of news articles as Latest
                               
  $latest_news_days = "31";     // Number of days news displays at Latest ....
                                // .... change This to the number of days news shows as Latest
                               
  $show_news_articles = "5";    // Number of news articles to show ....
                                // .... change This to fixed number of articles to display for latest news
                               
  $news_image = "*****";          // Change This to your Latest news image id
//----------------------------------------------------

$new_news = (time() - 60 * 60 * 24 * $latest_news_days);

if ($newstype == "latestnewsall"){
    $news_type = "latestnewsall";
    }
else {
    $news_type = "latestnews";
    }

  $additional_sql = "";

  if ($news_type == "latestnews") {

    if ($display_by_count) {
        $additional_sql .= "  c.image_id = '".$news_image."'";
        $additional_sql_2 .= " LIMIT ".$show_news_articles;
    }
    else {
        $additional_sql .= " c.comment_date > '".$new_news."' AND c.image_id = '".$news_image."'";
        $additional_sql_2 .= "";
    }
  }

  else {
    $additional_sql .= " c.image_id = '".$news_image."'";
    $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>&nbsp;/&nbsp;Archived News";
  }

  $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id, c.user_name
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2 ;

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

  while ($row = $site_db->fetch_array($result)) {
    $news_comment_row[] = $row;
  }

  $site_db->free_result($result);
   
// This is the Paging stuff
  if ($newstype == "latestnewsall") {
       
    include(ROOT_PATH.'includes/paging.php');
    $perpage = $show_news_articles;
    $link_arg = $site_sess->url(ROOT_PATH."index.php?newstype=latestnewsall");
    $getpaging = new Paging($page, $perpage, $num_rows, $link_arg);
    $offset = $getpaging->get_offset();

    $site_template->register_vars(array(
      "paging" => $getpaging->get_paging(),
      "paging_stats" => $getpaging->get_paging_stats()
    ));
     
    $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id, c.user_name
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2."  
            LIMIT $offset, $perpage";

          $result = $site_db->query($sql);
          $num_rows = $site_db->get_numrows($result);
          $news_comment_row = array();
           
      while ($row = $site_db->fetch_array($result)) {
            $news_comment_row[] = $row;
          }
  }

  if (!$num_rows) {
      $news_comments = "&nbsp;&nbsp;&nbsp;<b>No New News to report within the last ".$latest_news_days." days.</b>";
  }
  else {
      $news_comments = "";
      $bgcounter = 0;

    for ($i = 0; $i < $num_rows; $i++) {
        $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;

        $site_template->register_vars(array(
            "news_comment_headline" => format_text($news_comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
            "news_comment_text" => format_text($news_comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
            "news_comment_date" => format_date($config['date_format']." ".$config['time_format'], $news_comment_row[$i]['comment_date']),
            "news_comment_name" => $news_comment_row[$i]['user_name'],
            "row_bg_number" => $row_bg_number));

        $news_comments .= $site_template->parse_template("news_comment_bit");
    }

  }
  $site_template->register_vars("news_comments", $news_comments);
  unset($news_comments);

//-----------------------------------------------------
//---End of Show Latest News   -------------------------------
//-----------------------------------------------------



Then in the news_comment_bit.html you created add
Code: [Select]
{news_comment_name} Where you want the username to appear.

Good luck
Fugaziman
Title: [Mod] Latest News and Archive
Post by: tmacisnbr1 on May 31, 2003, 06:31:44 PM
Thank you so much!!!
Title: [Mod] Latest News and Archive
Post by: aymanati on June 06, 2003, 03:17:27 PM
I think this is very stupid, but how could I know the image id ?  :oops:

I tried to look for it in the file manager but didn't find it...

help me in that please.
Title: [Mod] Latest News and Archive
Post by: Fugaziman on June 06, 2003, 04:19:43 PM
Quote from: aymanati
I think this is very stupid, but how could I know the image id ?  :oops:
quote]

IOf you mean the image_id of the Latest_News image you created in step1 then the easiest way is to...
log into your site as the administrator.
Find your Latest News image
Click on it to bring up the Details page
Look at the URL/Address line in the browser and you should see something like image_id=****

That's your Lates News image ID.

Hope that Helps
Fugaziman  8)
Title: [Mod] Latest News and Archive
Post by: aymanati on June 07, 2003, 07:56:07 PM
:)
thanks Fugaziman
it works



BUT the last modification



Quote
I haven't tested this but it should work.....

Replace Step7 with this code
Code: .......


didn't work.
It gives me this error:
Parse error: parse error, expecting `')'' in c:\apache\htdocs\gallery\index.php on line 243

any advice?
Title: [Mod] Latest News and Archive
Post by: aymanati on June 07, 2003, 07:57:12 PM
this was in line 243:

     "row_bg_number" => $row_bg_number));
Title: [Mod] Latest News and Archive
Post by: Fugaziman on June 07, 2003, 08:31:35 PM
Quote from: aymanati
this was in line 243:

     "row_bg_number" => $row_bg_number));


Oops ! Just noticed I missed a comma (,) at the end of this line

Code: [Select]
"news_comment_name" => $news_comment_row[$i]['user_name'],

See if that helps
Sorry but I still haven't had time to test this.
Fugaziman
Title: I'll try it
Post by: aymanati on June 10, 2003, 08:57:22 AM
thanks man,

I'll try it and let you know.
Title: [Mod] Latest News and Archive
Post by: aymanati on June 10, 2003, 04:45:50 PM
it works ..
Thanks
:)
Title: Re: [Mod] Latest News and Archive
Post by: earthlyk on March 27, 2005, 07:02:54 AM
Hi, Fugaziman:

    First, thank you post this MOD, I have used this MOD with no problem by using WinXP+Easyphp 1.7 + 4images.

    Then, when I download a program call "Tenable NeWT Security Scanner" to scan my site, give me the result that my site had many holes. So I have to upgrade Easyphp1.7 to 1.8(apache 1.3.33 PHP 4.3.10 Mysql 4.1.9) and there comes some problem: one is this MOD, below are the message:

Notice: Undefined variable: newstype in ...\4images\index.php on line 184

Notice: Undefined variable: additional_sql_2 in ...\4images\index.php on line 197

I set PHP.ini register_globals = On (PHP 4.3.10 default is off) but still don't work.

I did not familiar with PHP coding, and it also painful for me to write English to ask help, BUT I have to, so if my expression didn't get well enough and let you could not understand what I mean just forget this post.

Sorry for my poor English and Thank you for reading my post.

earthlyk
Title: Re: [Mod] Latest News and Archive
Post by: earthlyk on March 27, 2005, 10:39:00 AM
I have found a temporary solution maybe it will help to solve the problem, here are my code :


-------------------------------------------------------------------------------------------------------------
$new_news = (time() - 60 * 60 * 24 * $latest_news_days);

$newstype = $_GET["newstype"];     //I add this line.

if ($newstype == "latestnewsall"){
    $news_type = "latestnewsall";
    }
else {
    $news_type = "latestnews";
    }

  $additional_sql = "";
  $additional_sql_2  = ""; //and add this line too.

-------------------------------------------------------------------------------------------------

then it work, but still have error message(same above post), so I set PHP.ini to display_errors = Off

earthlyk
Title: Re: [Mod] Latest News and Archive
Post by: ascanio on April 09, 2005, 04:45:09 AM
Is there a way to show for example 3 comments (news) in home.html and 10 in the archive.html?
Title: Re: [Mod] Latest News and Archive
Post by: bibabobu on May 20, 2005, 08:44:41 PM
Hello!

I was corrected by Vano not to post once more in troubleshooting forum.
So i hope finally could someone help me what to do in my case.
Posting LATEST NEWS works :) BUT

My prob is:
the NEWS ARCHIVE Link does not work for me as you can see on www.industrie-gravuren.de/galerie  :(

I followed the suggest in the instruction to copy the home.html and to rename it as archive.html
But I cannot see the archive. Whats my mistake?

Here is the code of my Data files:

HOME-HTML:

{header}
 <tr>
 <td>
 <?php
 $tu = "{template_url}";
 $us = "{url_search}";
 $ls = "{lang_search}";
 $las = "{lang_advanced_search}";
 require "{template_url}/incl/searchbox.php";
 ?>
 </td>
 </tr>
 <tr>
 <td class="bordercolor">
 <table width="100%" border="0" cellspacing="1" cellpadding="0">
 <tr>
 <td class="tablebgcolor">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" class="row2" valign="top">
<?php
 $ub = '{user_box}';
 $lru = "{lang_registered_user}";
 require "{template_url}/incl/user_incl.php";
 ?>
{if random_image}
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2" height="20" background="{template_url}/images/top_bg.gif"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<td align="center" class="row1">
<br />
{random_image}
<br />
<br />
</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
{endif random_image}
<img src="{template_url}/images/spacer.gif" alt="" width="150" height="1" />
<?php
require "{template_url}/incl/menu.php";
?>
</td>
 <td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" width="1" height="1" alt="" /></td>
 <td width="18" valign="top"><img src="{template_url}/images/spacer.gif" width="18" height="18" alt="" /></td>
 <td width="100%" valign="top">
<?php
 $uti = "{url_top_images}";
 $lti = "{lang_top_images}";
 $uni = "{url_new_images}";
 $lni = "{lang_new_images}";
 require "{template_url}/incl/click_incl.php";
 ?>
  <br />
  <span class="title">{site_name}</span>
<hr size="1" />
  {if categories}
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr>
   <td class="head1">
   <table width="100%" border="0" cellspacing="0" cellpadding="3">
    <tr>
    <td class="head1" valign="top" background="{template_url}/images/top_bg.gif">{lang_categories}</td>
    </tr>
    <tr>
    <td class="row2" valign="top">{categories}</td>
    </tr>
   </table>
   </td>
   </tr>
  </table>
  <br />
  {endif categories}
 {lang_site_stats}<br />
   {if msg}<b>{msg}</b><br /><br />{endif msg}
  <br />
<?php
 $ni='{new_images}';
 require "{template_url}/incl/new_incl.php";
?>
 
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr>
   <td>{category_dropdown_form}</td>
   <td align="right">{setperpage_dropdown_form}</td>
   </tr>
  </table>
 
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td align="left"  class="head1" valign="top" background="{template_url}/images/top_bg.gif" height="20" width="100%"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" /><a href="./index.php">Latest News</a></td>
    </tr>
    <tr>
        <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        {news_comments}
        </table>
        </td>
    <tr>
    <tr>
        <td align="right" class="head1" height="20" width="100%"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" /><a href="./index.php?newstype=latestnewsall">News Archive</a>&nbsp;&nbsp;</td>
    </tr>
</table>

 <br />
{whos_online}
 <br />

<?php
 require "{template_url}/incl/t_close.php";
?>
</td>
</tr>
<tr>
<td>
<?php
 require "{template_url}/incl/bott_incl.php";
?>
</td>
</tr>
</table>
{footer}

news_comment_Bit.html :

<tr>
   <td class="head1" ><div align="right"><small>{news_comment_date}</small></div><b>{news_comment_headline}</b></td>
</tr>
<tr>
   <td class="imagerow2" align="left">{news_comment_text}</td>
</tr>

index.php :

<?php

$templates_used = 'home,category_bit,whos_online,thumbnail_bit';
$main_template = 'home';

define('GET_CACHES', 1);
define('ROOT_PATH', './');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();

if (isset($HTTP_GET_VARS['template']) || isset($HTTP_POST_VARS['template'])) {
  $template = (isset($HTTP_GET_VARS['template'])) ? stripslashes(trim($HTTP_GET_VARS['template'])) : stripslashes(trim($HTTP_POST_VARS['template']));
  if (!file_exists(TEMPLATE_PATH."/".$template.".".$site_template->template_extension)) {
    $template = "";
  }
  else {
    $main_template = $template;
  }
}
else {
  $template = "";
}
include(ROOT_PATH.'includes/page_header.php');

if (!empty($template)) {
  $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].str_replace("_", " ", ucfirst($template));
  $site_template->register_vars("clickstream", $clickstream);
  if ($news_type == "latestnewsall") { 
  $site_template->print_template($site_template->parse_template(archive));     

else { 
  $site_template->print_template($site_template->parse_template($main_template)); 
}
  include(ROOT_PATH.'includes/page_footer.php');
}

$cache_id = create_cache_id(
  'cat.page.index',
  array(
    $user_info[$user_table_fields['user_id']],
    isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
    $config['template_dir'],
    $config['language_dir']
  )
);

if (!$cache_page_index || !$content = get_cache_file($cache_id)) {
// Always append session id if cache is enabled
if ($cache_page_index) {
  $old_session_mode = $site_sess->mode;
  $site_sess->mode = 'get';
}

ob_start();

//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
$categories = get_categories(0);
if (!$categories)  {
  $categories = $lang['no_categories'];
}
$site_template->register_vars("categories", $categories);
unset($categories);

//-----------------------------------------------------
//--- Show New Images ---------------------------------
//-----------------------------------------------------
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
  $imgtable_width .= "%";
}

$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}

$num_new_images = $config['image_cells'];
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT $num_new_images";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $new_images .= $lang['no_new_images'];
  $new_images .= "</td></tr></table>";
}
else  {
  $new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $new_images .= $site_template->parse_template("thumbnail_bit");
    $new_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $new_images .= "</tr>\n";
    }
  }
  $new_images .= "</table>\n";
} // end else

$site_template->register_vars("new_images", $new_images);
unset($new_images);

//--------------------------------------------------------
// Latest and Archive News Mod            --
//                     --
// User configurable variables            --
// You must change the first 4 variables to meet   --
// your requirements:     (see notes below)      --
//     $display_by_count            --
//     $latest_news_day               --
//     $show_news_articles            --
//     $news_image               --
//--------------------------------------------------------
  $display_by_count = "1";      // values 0 or 1 ....
                                // .... change this to 0 if display by days posted
                                // .... or 1 to display fixed number of news articles as Latest
                               
  $latest_news_days = "31";     // Number of days news displays at Latest ....
                                // .... change This to the number of days news shows as Latest
                               
  $show_news_articles = "3";    // Number of news articles to show ....
                                // .... change This to fixed number of articles to display for latest news
                               
  $news_image = "240";          // Change This to your Latest news image id
//----------------------------------------------------

$new_news = (time() - 60 * 60 * 24 * $latest_news_days);

if ($newstype == "latestnewsall"){
    $news_type = "latestnewsall";
    }
else {
    $news_type = "latestnews";
    }

  $additional_sql = "";

  if ($news_type == "latestnews") {

    if ($display_by_count) {
        $additional_sql .= "  c.image_id = '".$news_image."'";
        $additional_sql_2 .= " LIMIT ".$show_news_articles;
    }
    else {
        $additional_sql .= " c.comment_date > '".$new_news."' AND c.image_id = '".$news_image."'";
        $additional_sql_2 .= "";
    }
  }

  else {
    $additional_sql .= " c.image_id = '".$news_image."'";
    $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>&nbsp;/&nbsp;Archived News";
  }

  $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2 ;

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

  while ($row = $site_db->fetch_array($result)) {
    $news_comment_row[] = $row;
  }

  $site_db->free_result($result);
   
// This is the Paging stuff
  if ($newstype == "latestnewsall") {
       
    include(ROOT_PATH.'includes/paging.php');
    $perpage = $show_news_articles;
    $link_arg = $site_sess->url(ROOT_PATH."index.php?newstype=latestnewsall");
    $getpaging = new Paging($page, $perpage, $num_rows, $link_arg);
    $offset = $getpaging->get_offset();

    $site_template->register_vars(array(
      "paging" => $getpaging->get_paging(),
      "paging_stats" => $getpaging->get_paging_stats()
    ));
     
    $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2." 
            LIMIT $offset, $perpage";

          $result = $site_db->query($sql);
          $num_rows = $site_db->get_numrows($result);
          $news_comment_row = array();
           
      while ($row = $site_db->fetch_array($result)) {
            $news_comment_row[] = $row;
          }
  }

  if (!$num_rows) {
      $news_comments = "&nbsp;&nbsp;&nbsp;<b>No New News to report within the last ".$latest_news_days." days.</b>";
  }
  else {
      $news_comments = "";
      $bgcounter = 0;

    for ($i = 0; $i < $num_rows; $i++) {
        $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;

        $site_template->register_vars(array(
            "news_comment_headline" => format_text($news_comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
            "news_comment_text" => format_text($news_comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
            "news_comment_date" => format_date($config['date_format']." ".$config['time_format'], $news_comment_row[$i]['comment_date']),
            "row_bg_number" => $row_bg_number));

        $news_comments .= $site_template->parse_template("news_comment_bit");
    }

  }
  $site_template->register_vars("news_comments", $news_comments);
  unset($news_comments);

//-----------------------------------------------------
//---End of Show Latest News   -------------------------------
//-----------------------------------------------------

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,
  "clickstream" => $clickstream
));
if ($news_type == "latestnewsall") { 
  $site_template->print_template($site_template->parse_template(archive));     

else { 
  $site_template->print_template($site_template->parse_template($main_template)); 
}

$content = ob_get_contents();
ob_end_clean();

if ($cache_page_index) {
  // Reset session mode
  $site_sess->mode = $old_session_mode;

  save_cache_file($cache_id, $content);
}

} // end if get_cache_file()

echo $content;

include(ROOT_PATH.'includes/page_footer.php');
?>

archive.html :

{header}
 <tr>
 <td>
 <?php
 $tu = "{template_url}";
 $us = "{url_search}";
 $ls = "{lang_search}";
 $las = "{lang_advanced_search}";
 require "{template_url}/incl/searchbox.php";
 ?>
 </td>
 </tr>
 <tr>
 <td class="bordercolor">
 <table width="100%" border="0" cellspacing="1" cellpadding="0">
 <tr>
 <td class="tablebgcolor">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" class="row2" valign="top">
<?php
 $ub = '{user_box}';
 $lru = "{lang_registered_user}";
 require "{template_url}/incl/user_incl.php";
 ?>
{if random_image}
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2" height="20" background="{template_url}/images/top_bg.gif"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<td align="center" class="row1">
<br />
{random_image}
<br />
<br />
</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
{endif random_image}
<img src="{template_url}/images/spacer.gif" alt="" width="150" height="1" />
<?php
require "{template_url}/incl/menu.php";
?>
</td>
 <td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" width="1" height="1" alt="" /></td>
 <td width="18" valign="top"><img src="{template_url}/images/spacer.gif" width="18" height="18" alt="" /></td>
 <td width="100%" valign="top">
<?php
 $uti = "{url_top_images}";
 $lti = "{lang_top_images}";
 $uni = "{url_new_images}";
 $lni = "{lang_new_images}";
 require "{template_url}/incl/click_incl.php";
 ?>
  <br />
  <span class="title">{site_name}</span>
<hr size="1" />
  {if categories}
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr>
   <td class="head1">
   <table width="100%" border="0" cellspacing="0" cellpadding="3">
    <tr>
    <td class="head1" valign="top" background="{template_url}/images/top_bg.gif">{lang_categories}</td>
    </tr>
    <tr>
    <td class="row2" valign="top">{categories}</td>
    </tr>
   </table>
   </td>
   </tr>
  </table>
  <br />
  {endif categories}
 {lang_site_stats}<br />
   {if msg}<b>{msg}</b><br /><br />{endif msg}
  <br />
<?php
 $ni='{new_images}';
 require "{template_url}/incl/new_incl.php";
?>
 <br />
{whos_online}
  <br />
  <table width="100%" border="1" cellspacing="1" cellpadding="1">
   <tr>
      <td align="left"  class="head1" height="20">Archived News</td>
                <td align="right" class="head1" height="20">{paging}></td>
   </tr>

   <tr>
      <td colspan="2">
         <table width="100%" border="1" cellspacing="1" cellpadding="4">
         {news_comments}
         </table>
      </td>
   </tr>
   <tr>
      <td align="left"  class="head1" height="20"> <a href="./index.php">Latest News</a></td>
      <td align="right" class="head1" height="20">{paging} </td>
   </tr>             
</table>

 
<?php
 require "{template_url}/incl/t_close.php";
?>
</td>
</tr>
<tr>
<td>
<?php
 require "{template_url}/incl/bott_incl.php";
?>
</td>
</tr>
</table>
{footer}

So i hope someone has a solution for me.

Many thanks for helping me :cry:
Title: Re: [Mod] Latest News and Archive
Post by: drhtm on May 27, 2005, 12:48:56 PM
Is there a way to show for example 3 comments (news) in home.html and 10 in the archive.html?

I agree.  This mod would be 10x better with this added feature.  For my site, I like to add one news headline but then when you click to see more news, it only shows one news per page  :x
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on May 27, 2005, 02:37:19 PM
hi ascanio, hi drhtm, hi all ...

Quote
Is there a way to show for example 3 comments (news) in home.html and 10 in the archive.html ?

yes ...  :!: ... here we go :

Step 1.
open index.php and find in [MOD] Latest and Archive News :
Code: [Select]
$show_news_articles = "5";    // Number of news articles
                                // .... change This to fixed number of articles to display for latest news

and replace with :
Code: [Select]
$show_news_articles = "3";    // Number of news articles to show in index ....
                                // .... change This to fixed number of articles to display for latest news

$show_news_articles_archive = "10";    // Number of news articles to show in archive ....
                                // .... change This to fixed number of articles to display for latest news

Step 2.
then find in index.php in [MOD] Latest and Archive News :
Code: [Select]
$perpage = $show_news_articles;

and replace with :
Code: [Select]
$perpage = $show_news_articles_archive;

thats all ...  :wink: ...
this modificaton works since some time in the best way on my page ... :D ...
and now (drhtm) is the [Mod] Latest News and Archive 10x better ...  :wink: ...

thanks again to Fugaziman for this great MOD

mawenzi


Title: Re: [Mod] Latest News and Archive
Post by: ascanio on May 27, 2005, 05:30:06 PM
thanks a lot :)
Title: Re: [Mod] Latest News and Archive
Post by: drhtm on May 27, 2005, 11:39:06 PM
wow that was easy...thanks!
Title: Re: [Mod] Latest News and Archive
Post by: pkitty on July 18, 2005, 03:36:06 AM
Okay, I added this mod, one problem, for some reason, I am not getting a comment box on the image I uploaded and I dont know why....*shakes head*

I am having a hard time figuring this out....The latest news banner is showing, and the archive, well, lets just say I wasnt sure what to take out of the home.html so its just a blank page, but thats okay...please help??

Title: Re: [Mod] Latest News and Archive
Post by: pkitty on July 18, 2005, 11:53:06 PM
Kay, been a day, does anybody have a solution as to why I am not getting a comment box on my news Image in the latest news folder?  No?
Title: Re: [Mod] Latest News and Archive
Post by: TheOracle on July 19, 2005, 01:25:29 PM
How about sending a captured image to see more clairly what you mean ?

Perhaps it is due to a bad implementation by following the instructions during the process ? ;)
Title: Re: [Mod] Latest News and Archive
Post by: pkitty on July 20, 2005, 05:41:15 PM
How about sending a captured image to see more clairly what you mean ?

Perhaps it is due to a bad implementation by following the instructions during the process ? ;)

Well, went back and double checked the code, made sure all was put in where it needed to be and what not, because I am not that blonde.....Then I got to thinking, and deleted the original image and reuploaded it, then changed the image ID and it is now working properly.  It could have been that the image was put in before I put in a certain part of the code, not sure.  But I figured it out and got it working.
Title: Re: [Mod] Latest News and Archive
Post by: TheOracle on July 20, 2005, 08:41:03 PM
Quote

I am not that blonde


Well, if you admit yourself that way ... why not ? ! :mrgreen:

Quote

It could have been that the image was put in before I put in a certain part of the code, not sure.


Thx for pointing this out. This will be useful for other users in the future. ;)
Title: Re: [Mod] Latest News and Archive
Post by: karimun on July 24, 2005, 10:43:19 PM
Is there a way of only displaying the title when visitors are logged out and when they log in to show the full post?

I use this MOD at a site where confidential data gets posted in the news section. It would be great to hide the actual news block from non-members ..

Title: Re: [Mod] Latest News and Archive
Post by: TheOracle on July 24, 2005, 10:45:16 PM
Quote

Is there a way of only displaying the title when visitors are logged out and when they log in to show the full post?


Outstanding idea. I will try this out right now. ;)
Title: Re: [Mod] Latest News and Archive
Post by: TheOracle on July 24, 2005, 11:11:28 PM
Ok, let's try this.

In your index.php file,

find :

Quote

$news .= multilang(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));


replace with :

Code: [Select]

$news .= ($user_info['user_level'] != USER ? "" : multilang(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)));


Note: I have installed the multilang MOD at that time. If you did not installed this MOD,

find :

Quote

$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));


simply replace with :

Code: [Select]

$news .= ($user_info['user_level'] != USER ? "" : 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)));


Is that what you were looking for to do ? ;)
Title: Re: [Mod] Latest News and Archive
Post by: karimun on July 25, 2005, 02:01:03 AM
TheOracle, thank you for the quick answer, but:
in my index.php there is no code to replace which fits to the one(s) you mentioned above.  :?:

I also checked the original code posted on page one of this MOD .. there is no such code.
Title: Re: [Mod] Latest News and Archive
Post by: TheOracle on July 25, 2005, 02:17:08 AM
Woops. My apologize. I thought it was the same MOD as this one :

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

I found it more easy to customize than this actual topic. However, it does look interesting to customize as well. ;)
Title: Re: [Mod] Latest News and Archive
Post by: karimun on July 25, 2005, 12:30:26 PM
TheOracle, the other news MOD has too many replies crying for help - so I have not tried it.
Is anybody able to modify this news MOD ? For sure the modification can be used on several other sites, too.

 
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on July 25, 2005, 01:19:45 PM
Is there a way of only displaying the title when visitors are logged out and when they log in to show the full post?
I use this MOD at a site where confidential data gets posted in the news section. It would be great to hide the actual news block from non-members ..

according to this example : here (http://www.4homepages.de/forum/index.php?topic=8732.msg40442#msg40442) ...
take this for your news_comment_bit.html ... :

Code: [Select]
<tr>
<td class="row2" ><div align="right"><small>(Date Posted: {news_comment_date})</small></div><b>Headline: {news_comment_headline}</b></td>
</tr>
{if user_loggedin}
<tr>
<td class="row1" align="left">{news_comment_text}</td>
</tr>
{endif user_loggedin}

untested ... but should work ...  :wink:

mawenzi
Title: Re: [Mod] Latest News and Archive
Post by: TheOracle on July 25, 2005, 01:43:00 PM
Quote

I have not tried it.


It's worth it. ;)
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on July 25, 2005, 03:45:51 PM
@ TheOracle , @ karimun ... and @ all ...  :wink:

now it is tested ... it works absolutely perfectly and as desired ...   :mrgreen:

mawenzi
Title: Re: [Mod] Latest News and Archive
Post by: karimun on July 25, 2005, 09:40:25 PM
That simple. Thanks a lot guys.
Title: Re: [Mod] Latest News and Archive
Post by: IzyB on August 07, 2005, 05:02:57 AM
Quote
Step 1.  Create simple image to be used to as your Latest_news image as you would any other image.
You can use this one if you want http://www.newman.d2g.com/Code_help_files/Latest_News.jpg

His page has been down for quite some time and I was wondering if someone could post an image for me as an example? Thanks!
Title: Re: [Mod] Latest News and Archive
Post by: V@no on August 07, 2005, 08:40:17 PM
(http://www.1024x768wallpapers.com/Code_help_files/Latest_News.jpg)
Title: Re: [Mod] Latest News and Archive
Post by: IzyB on August 12, 2005, 12:57:31 AM
I want my "latest news" table to have the same feel as my "categories" table. Can someone tell me what the code would be in home.html? I've tried and it's not working. I'm sure it's just some minor things I am missing. But here is the code to my "categories" table located in my home.html. So how would I modify this so that it will be the actual latest news table?

Code: [Select]
<table border="0" cellpadding="0" cellspacing="0" class="ttb">
<tr>
<td><img src="{template_url}/images/tt12_l.gif" width="10" height="12" alt="" /></td>
<td class="tt12bkg"><img src="{template_url}/images/spacer.gif" width="200" height="12" alt="" /></td>
<td><img src="{template_url}/images/tt12_r.gif" width="10" height="12" alt="" /></td>
</tr>
</table>

<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<td class="cat">{lang_categories}</td>
</tr>

<tr>
<td class="row1" width="100%">
{categories}
</td>
</tr>

</table>

<table border="0" cellpadding="0" cellspacing="0" class="ttb">
<tr>
<td><img src="{template_url}/images/tb12_l.gif" width="10" height="12" alt="" /></td>
<td class="tb12bkg"><img src="{template_url}/images/spacer.gif" width="200" height="12" alt="" /></td>
<td><img src="{template_url}/images/tb12_r.gif" width="10" height="12" alt="" /></td>
</tr>
</table>
Title: Re: [Mod] Latest News and Archive
Post by: Tusnelda99 on August 22, 2005, 04:22:10 PM
Hello,

i have also a question.
What must i do that i can display the news not on my index-side (home.html) like here but on a extra side (for example with index.php?template=news).

I made a copy from home.html and rename it to news.html (add the code from this mod inside) but this is not working??!!

Could anybody help me??

Big Thanx Tusnelda
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on August 22, 2005, 06:15:45 PM
hi Tusnelda99,

in your home.html don't use (Step 10) :
Code: [Select]
{news_comments}

use in your template (e.g. home.html, menue .... ) as link to your News :
Code: [Select]
<a href="./index.php?newstype=latestnewsall">News</a>

that's all ...  :wink:

mawenzi
Title: Re: [Mod] Latest News and Archive
Post by: Tusnelda99 on August 23, 2005, 11:18:24 AM
Hi mawenzi,

thanks for the answer but this is not really what i want. Because with this code the user see only the archive side of the news but i want that he/ she could first see a side a la "weblog" with 3-5 news and in one corner is the link to the next side - the archive !!!

did you have any answer to this problem??

Thanks Tusnelda
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on August 23, 2005, 03:15:09 PM
hi Tusnelda99,

ok, than this :

1. create a news.php like index.php but only with the "Latest and Archive News - Code " and on the top with :
Code: [Select]
$templates_used = 'news,news_comment_bit';
$main_template = 'news';
...
and replace :
Code: [Select]
$link_arg = $site_sess->url(ROOT_PATH."index.php?newstype=latestnewsall");
with this:
Code: [Select]
$link_arg = $site_sess->url(ROOT_PATH."news.php?newstype=latestnewsall");

and on the bottom you need from index.php :
Code: [Select]
//--- Print Out ----
...
don't forget to add this (http://www.4homepages.de/forum/index.php?topic=5142.msg37435#msg37435) to the News-Code ... :wink: ... ( e.g. 3 NEWS in news.php and 10 NEWS/page in archive )

2. create a news.html like home.html but only with the "Latest and Archive News - Code " :
Code: [Select]
{news_comments}

3. in inludes/page_header.php add after:
Code: [Select]
"url_home" => $site_sess->url(ROOT_PATH."index.php"),
this :
Code: [Select]
"url_news" => $site_sess->url(ROOT_PATH."news.php"),

4. now you can use in your templates as link to your NEWS :
Code: [Select]
<a href="{url_news}">News</a>

for example it works here (http://klick.kl.funpic.de/news.php) ...  :wink: ... the rest is work on template.
mawenzi
Title: Re: [Mod] Latest News and Archive
Post by: Tusnelda99 on August 25, 2005, 11:50:24 AM
@ mawenzi

thank you very much  :wink: It works fine!!!!

cu Tusnelda
Title: Re: [Mod] Latest News and Archive
Post by: Maniac on September 12, 2005, 10:18:39 PM
Great MOD - Thank you!

i have a quick question. I created the archives.html file as suggested but I cannot get to it - the news archive link simply reloads index.php I saw a user had a similar problem - he posted all of his code - 8O.

This is what I set my index.php variables to:

Code: [Select]
$display_by_count = "1";
$latest_news_days = "31";
$show_news_articles = "1";
$show_news_articles_archive = "10";

I have two news items (as of now) - one shows up on the home page as expected by the show_news_articles but I cannot get to the archive... When I do click the archive link though both news items appear on the page - wrong template though...

Any advice would be appreciated.
Title: Re: [Mod] Latest News and Archive
Post by: udaman on September 15, 2005, 05:34:10 PM
Did you get to resolve your problem? My site is doing exactly the same thing. It was fine before but now if you click on Archive it reloads the index.php again. Any help to fix the problem will be greatly appreciated.

My setting:
Code: [Select]
$display_by_count = "1";
$latest_news_days = "14";
$show_news_articles = "1";
$show_news_articles_archive = "10";
Title: Re: [Mod] Latest News and Archive
Post by: Nasser on October 27, 2005, 11:39:40 AM
great MOD .. thanks
Title: Re: [Mod] Latest News and Archive
Post by: Olphi on November 29, 2005, 11:24:43 PM
Hi @ all

Great MOD, really!

But i have one problem with the table of the news_comment_bit! My wish is, that border="0" and cellspacing="0"! It doesn't function! I think its because I have no table - if I make a table, the whole site get a problem, so I can't have table.... Please help me!???????

The Problem: http://web72.login-22.hoststar.ch/home/index.php


The Code of the news_comment_bit.html:
Code: [Select]
<tr>
<td class="row2" border="0" cellspacing="0"><div border="0" cellspacing="0" align="right"><small>(Datum: {news_comment_date})</small></div>
  <b>Schlagzeile: {news_comment_headline}</b></td>
</tr>
<tr>
<td class="row1" border="0" cellspacing="0" align="left">{news_comment_text}</td>
</tr>

Thanks a lot for your help!
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on November 30, 2005, 12:01:20 AM
@ Olphi,

... Frage 1 : was soll eine Border haben ... die gesamten News oder nur deine news_comment_bit.html ?
... Frage 2 : wie soll die Border aussehen ? Als 1Pixel-Border oder normale Table-Border ?

Die home.html und die news_comment_bit.html sind dann entsprechend zu gestalten ... also ?

 
Title: Re: [Mod] Latest News and Archive
Post by: Olphi on November 30, 2005, 08:41:59 AM
@ mawenzi

Also wie du siehst scheint bei mir etwa border="1", etc... Das Problem ist nun ich habe alle files, ausser der news_comment_bit.html auf border"0" gesetzt, wenn ich nun eben diesen auch auf border="0" setzte (mit <table> funktion), kommt mein gesamter Desgin der Homepage durcheinander, vorallem rechts und unten verschiebt sich alles....

Das Problem ist der Code der news_comment_bit.html, meines erachtens müsste ein <table> drin sein, dann könnte ich nämlich einen border="0" setzen, doch so weiss ich nicht wie ich es hinkriege, dass der Rahmen wegfällt!!! Alle anderen Files hab ich hingekriegt!

Title: Re: [Mod] Latest News and Archive
Post by: Olphi on November 30, 2005, 12:13:06 PM
Schein, als ob ich alles ingekriegt habe  :lol: (zwei Tage basteln.... ) 

Thx @ mawenzi
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on November 30, 2005, 06:18:40 PM
@ Olphi,

... tja ... learning by doing ist doch nicht so schlecht ... und sicher auch nachhaltig für die Lösung von weiteren Problemen !
Das Ergebnis sieht gut aus und könnte noch hiermit verfeinert werden :
http://www.4homepages.de/forum/index.php?topic=5142.msg37435#msg37435

mawenzi
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on December 12, 2005, 05:33:06 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 (http://www.4homepages.de/forum/index.php?topic=10715.0)

mawenzi
Title: Re: [Mod] Latest News and Archive
Post by: chip on January 22, 2006, 04:50:38 AM
hi everyone,

I have the same problem as mentioned above:

Quote
... if you click on Archive it reloads the index.php again.

There's no chance to get to the archive.

The problem is caused by register_globals being off. If I turn it on everything is fine.

Does anybody have an idea how this issue can be solved by leaving register_globals = off ? My host won't change this.


Thanks

btw: thanks Fugaziman for this one  :D


update:

okay I was to overhasty, I love my host  :D
Title: Re: [Mod] Latest News and Archive
Post by: zaisk on February 20, 2006, 07:22:24 PM
I have the same problem too. I can't get to the news archuve :/
Title: Re: [Mod] Latest News and Archive
Post by: IcEcReaM on February 20, 2006, 07:41:34 PM

Try this:
Search
Code: [Select]
if ($news_type == "latestnewsall") { 
 $site_template->print_template($site_template->parse_template(archive));     

else { 
 $site_template->print_template($site_template->parse_template($main_template)); 
}

and insert above:
Code: [Select]
if (isset($HTTP_GET_VARS['news_type']) || isset($HTTP_POST_VARS['news_type'])) {
  $news_type = (isset($HTTP_GET_VARS['news_type'])) ? stripslashes(trim($HTTP_GET_VARS['news_type'])) : stripslashes(trim($HTTP_POST_VARS['news_type']));
}


Title: Re: [Mod] Latest News and Archive
Post by: spacefighter on March 03, 2006, 05:59:20 PM
Hallo

Habe den Mod in meiner Gallery eingebaut.

So weit so gut.
Nur kann ich keine News schreiben.
Bei Details ist der Bereich Kommentare verschwunden.

Weis einer eine Lösung?

mfg
Meik
Title: Re: [Mod] Latest News and Archive
Post by: spacefighter on March 03, 2006, 06:48:49 PM
Hat sich erledigt. Hab den Fehler gefunden.

mfg
Meik
Title: Re: [Mod] Latest News and Archive
Post by: IWS_steffen on April 18, 2006, 10:56:58 PM
Danke

für den tollen MOD. Klappt super.

Nice

Steffen
Title: Re: [Mod] Latest News and Archive
Post by: troopers on August 29, 2006, 12:39:58 PM
thx a lo, it worked until now fine.

I dont know, why it doenst work now. archived news, doenst work. :(
Title: Re: [Mod] Latest News and Archive
Post by: troopers on August 29, 2006, 04:31:40 PM
if i use:

Code: [Select]
if ($_GET['newstype'] == "latestnewsall"){
   $news_type = "latestnewsall";
   }
it works fine.
Title: Re: [Mod] Latest News and Archive
Post by: troopers on August 31, 2006, 04:19:50 PM
ok, next try :)

i'm trying some modifications with this script.But now i have a questions about this, cause i don't know, if it will be securityhole or something like a fatal coding error.
(yes im a php newbie)

in details.php i modified this line

Code: [Select]
if (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id) || !$image_row) {
  redirect($url);

with this:
Code: [Select]
if ($_GET['image_id'] == "37") {
#    redirect($url);
      header("Location: ".$site_sess->url(ROOT_PATH."index.php", "&"));
}

else {
if (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id) || !$image_row) {
  redirect($url);
}
}

I want that normal users write an article, like a blog. But everytime the user will be redirected to the mainpage, without any entry in the db. And the admin will be redirected to the blog-picture with a comment. with the code above the user wount be redirected, and a comment is also written.

i hope you'll unterstand what i mean.

Title: Re: [Mod] Latest News and Archive
Post by: blue22deep on November 19, 2006, 09:39:09 PM
Hi

Anyone got this running on a site so i can see what it looks like...?? :)
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on November 19, 2006, 10:04:28 PM
@ blue22deep 

... here the NEWS (http://klick.kl.funpic.de/index.php) (Die letzten Neuigkeiten auf der Website) ...
... here the Archived News (http://klick.kl.funpic.de/index.php?newstype=latestnewsall) ...
Title: Re: [Mod] Latest News and Archive
Post by: skiemor on December 30, 2007, 12:17:54 PM
Hi @ all,
If I delete a comment, the new must be delete in the table of news too.
But is not so?
Ok, I can change the text of the comment or change the date to get the new out of table.

Chris.
Title: Re: [Mod] Latest News and Archive
Post by: musicsurfer on April 26, 2008, 12:43:50 PM
Hallo zusammen

Ich habe 2 Fragen zu dem MOD

Zum einen möchte ich nicht, das bei der News-Auflistung die Uhrzeit angezeigt wird, sondern nur das Datum.
Was muss ich denn da ändern ?

Außerdem wollte ich den Schriftgrad ändern.
Bei dem Datum klappt das auch, aber ich bekomme die Schriftgröße der Newsüberschrift nicht geändert.
Wie bekomme ich diese News-Sachen denn einheitlich auf einen kleineren Schriftgrad ?

Viele Grüße
Musicsurfer
Title: Re: [Mod] Latest News and Archive
Post by: Jan-Lukas on April 26, 2008, 03:54:02 PM
Wo ich hier schon mal bin  :mrgreen:
News werden ja alle angezeigt, nur das Archiv klappt bei mir nicht, was könnte da vergessen worden sein *grübel*
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on June 12, 2008, 12:02:56 AM
Hallo Harald,

... zunächst schwer zu sagen, da aber immer auf das home.html-template weitergeleitet wird ...
... habe ich den Verdacht, dass du dein archive.html-template nicht richtig angelegt hast ...
Title: Re: [Mod] Latest News and Archive
Post by: sigma. on August 09, 2008, 03:39:56 PM
I just updated to 1.7.6 and I cant seem to get the News Archive to work I get the following error

Code: [Select]
Parse error: syntax error, unexpected $end in /home/cydonian/public_html/photos/includes/template.php(101) : eval()'d code on line 227
Anyone run into this problem?
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on August 09, 2008, 04:48:08 PM
Hi Chris ...

... sorry, there is some trouble with your update ...
... but good to see, that you are using your old template ... I like it very much ...
... for your posted problem, try this ...
... http://www.4homepages.de/forum/index.php?topic=21063.msg114523#msg114523 ...
Title: Re: [Mod] Latest News and Archive
Post by: sigma. on August 10, 2008, 12:13:15 AM
Hi mawenzi,

Thanks for the reply. I tried to figure it out but I cant seem to narrow down where the missing { is. Any suggestions?
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on August 10, 2008, 12:41:38 AM
Any suggestions?

... so look at the error message ...
-> in template ... also in your archive.html ...
-> syntax error, unexpected $end ... syntax in templates it is only { and } ... and unexpected end, there must be a missig } ...

... if no success with this template ... try it again with a totaly new one ... ;)
Title: Re: [Mod] Latest News and Archive
Post by: sigma. on August 13, 2008, 02:40:04 PM
looks like when I open the site in IE every page has an error with the missing } comment. The only difference is the news archive page doesnt load at all. IE just shows "This page has errors" at the bottom left. Looks like I messed up somewhere along the road to MOD recovery. Did things too fast.

I've been searching everywhere for a missing } and I can't find one. The template can't be the issue because the line it refers to (archive.html) is the last line and I've read in most cases it never is in the html file. This is a pain.

The search continues.

| end of line |

Title: Re: [Mod] Latest News and Archive
Post by: sigma. on August 13, 2008, 06:09:36 PM
Interesting. I guess it pays to have a separate and new install of 4images on a server. Testing the mod out and Im still getting those errors. I guess it could be in the html files since im just copying the old templates from my old 1.7.1 setup.

Which would mean the code on the first page of this thread has been updated??
or its just me... which is the more likely answer :)

ignore me, i'll figure it out
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on August 13, 2008, 07:28:47 PM
... as I said ...

... try it again with a totaly new one ... ;)
Title: Re: [Mod] Latest News and Archive
Post by: sigma. on August 14, 2008, 02:48:58 AM
looks like {if} comments from the [MOD] Last comments v1 that i had embedded in the same archive.html were causing the problem. Because I dont have that MOD installed back yet, it broke the page. Which is odd to me but oh well. There were no missing }

Thanks for letting me think outloud! :)
Title: Re: [Mod] Latest News and Archive
Post by: Lunat on October 03, 2008, 10:40:41 AM
can users add comments to news in it MOD?
Title: Re: [Mod] Latest News and Archive
Post by: mawenzi on October 03, 2008, 01:21:50 PM
... in this version ... no ...
Title: Re: [Mod] Latest News and Archive
Post by: Sunny C. on January 11, 2009, 03:33:22 PM
Bekommt man das Datum des geposteten News auch irgendwie untereinander?

Am besten so:
Code: [Select]
<div class="tpdate">

<div class="tpdate_day">
04 </div>
<div  class="tpdate_month">
Dec </div>
<div  class="tpdate_year">
2008 </div>
</div>
Title: Re: [Mod] Latest News and Archive
Post by: AntiNSA2 on March 03, 2009, 05:48:19 AM
So... is there a version which allows comments? I will try to install now on 1.7.6,,,,

Wish me luck...
Title: Re: [Mod] Latest News and Archive
Post by: AntiNSA2 on March 03, 2009, 07:48:00 AM
Ok this is a great mod, it works. 2 things though..

1) if you could add a way to add comments that would be great.

2) I would like to post vidblog news. I use youtube to store my vids...  I have enabled html in the admin control panel, howver can not seem to get the embedding to function in 4images. Any idea?

Thanks!
Title: Re: [Mod] Latest News and Archive
Post by: AntiNSA2 on March 13, 2009, 11:25:33 AM
ok thanks to V@nos media mod everything is ok.

How can we show news on categories.html ???

thanks
Title: Re: [Mod] Latest News and Archive
Post by: ch-alex on March 25, 2009, 08:18:39 PM
Hi all,

first thanks a lot to Fugaziman for this simple but very effective mod.

I have added the following code to my index.php in order to be able to configure the items that are displayed per page in news archive

Code: [Select]
$archived_news_page = "5";    // Number of news articles to show per page in archive...
                              // .... change This to fixed number of articles to display per page in news archive

So the configuration part looks now as follows:

Code: [Select]
//--------------------------------------------------------
// Latest and Archive News Mod --
// --
// User configurable variables --
// You must change the first 4 variables to meet --
// your requirements:     (see notes below) --
//     $display_by_count --
//     $latest_news_day --
//     $show_news_articles --
//     $news_image --
//--------------------------------------------------------
  $display_by_count = "1";         // values 0 or 1 ....
                                   // .... change this to 0 if display by days posted
                                   // .... or 1 to display fixed number of news articles as Latest
                                 
  $latest_news_days = "10";        // Number of days news displays at Latest ....
                                   // .... change This to the number of days news shows as Latest
                               
  $show_news_articles = "3";       // Number of news articles to show ....
                                   // .... change This to fixed number of articles to display for latest news

  $archived_news_page = "5";       // Number of news articles to show per page in archive...
                                   // .... change This to fixed number of articles to display per page in news archive
                               
  $news_image = "66";              // Change This to your Latest news image id
//----------------------------------------------------

To make the varialble work you also need to adjust the following line:
Code: [Select]
$perpage = $show_news_articles;
Replace it by:
Code: [Select]
$perpage = $archived_news_page;
That's all...
Title: Re: [Mod] Latest News and Archive
Post by: AntiNSA2 on April 21, 2009, 11:28:24 AM
This is a great mod that works on categories, index and details php...

however when I try to get it to work on search.php I get the error
Code: [Select]

Notice: Undefined variable: news_type in /home/lifephotography/htdocs/search.php on line 605

Notice: Undefined variable: additional_sql_2 in /home/lifephotography/htdocs/search.php on line 624

Notice: Undefined variable: newstype in /home/lifephotography/htdocs/search.php on line 637

Notice: Undefined variable: news_type in /home/lifephotography/htdocs/search.php on line 804

If any one could tell me why it doesnt work id appreciate it.

here is my search.php
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: search.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
$templates_used 'thumbnail_bit,whos_online';
$main_template 'search';
define('GET_CACHES'1);
define('GET_USER_ONLINE'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');
include(
ROOT_PATH.'includes/search_utils.php');
include(
ROOT_PATH.'includes/shout.php');
error_reporting(E_ALL);
$org_search_keywords $search_keywords;
$org_search_user $search_user;

if (isset(
$HTTP_GET_VARS['search_terms']) || isset($HTTP_POST_VARS['search_terms'])) {
  
$search_terms = isset($HTTP_POST_VARS['search_terms']) ? $HTTP_POST_VARS['search_terms'] : $HTTP_GET_VARS['search_terms'];
  
$search_terms $search_terms == "all" 0;
}
else {
 
$search_terms 1;
}

if (isset(
$HTTP_GET_VARS['search_fields']) || isset($HTTP_POST_VARS['search_fields'])) {
  
$search_fields = isset($HTTP_POST_VARS['search_fields']) ? trim($HTTP_POST_VARS['search_fields']) : trim($HTTP_GET_VARS['search_fields']);
}
else {
  
$search_fields "all";
}

$search_cat $cat_id;

$search_id = array();

if (
$search_user != "" && $show_result == 1) {
  
$search_user str_replace('*''%'trim($search_user));
  
$sql "SELECT ".get_user_table_field("""user_id")."
          FROM "
.USERS_TABLE."
          WHERE "
.get_user_table_field("""user_name")." LIKE '$search_user'";
  
$result $site_db->query($sql);
  
$search_id['user_ids'] = "";
  if (
$result) {
    while (
$row $site_db->fetch_array($result)) {
      
$search_id['user_ids'] .= (($search_id['user_ids'] != "") ? ", " "").$row[$user_table_fields['user_id']];
    }
    
$site_db->free_result($result);
  }
}

if (
$search_keywords != "" && $show_result == 1) {
  
$split_words prepare_searchwords($search_keywordstrue);

  
$match_field_sql = ($search_fields != "all" && isset($search_match_fields[$search_fields])) ? "AND m.".$search_match_fields[$search_fields]." = 1" "";
  
$search_word_cache = array();
  
$who = ($user_info['user_level'] == GUEST) ? "guests" : (($user_info['user_level'] <= USER) ? "users" "admins");
if (count($split_words) > 1) {
  $sql "UPDATE ".SEARCH_STATS_TABLE."
   SET count = count + 1, date = "
.time().", ".$who." = ".$who." + 1
   WHERE text LIKE '"
.addslashes(str_replace("*"""$search_keywords))."' AND word = 0";
  $site_db->query($sql);
if (!$site_db->affected_rows()) {
  $sql "INSERT INTO ".SEARCH_STATS_TABLE."
          (text, date, "
.$who.")
          VALUES
          ('"
.addslashes(str_replace("*"""$search_keywords))."', ".time().", 1)";
  $site_db->query($sql);
}
}

  for (
$i 0$i sizeof($split_words); $i++) {
    if (
$split_words[$i] == "and" || $split_words[$i] == "und" || $split_words[$i] == "or" || $split_words[$i] == "oder" || $split_words[$i] == "not") {
      
$search_word_cache[$i] = ($search_terms) ? "and" $split_words[$i];
    }
    else {if (
count($split_words) == 1) {
    
  $sql "UPDATE ".SEARCH_STATS_TABLE."
        SET count = count + 1, word = 1, date = "
.time().", ".$who." = ".$who." + 1
        WHERE text LIKE '"
.addslashes(str_replace("*"""$split_words[$i]))."' AND word = 1";
    
  $site_db->query($sql);
    
if (!$site_db->affected_rows()) {
    
  $sql "INSERT INTO ".SEARCH_STATS_TABLE."
               (text, word, date, "
.$who.")
               VALUES
               ('"
.addslashes(str_replace("*"""$split_words[$i]))."', 1, ".time().", 1)";
    
  $site_db->query($sql);
    
}
}

      
$sql "SELECT m.image_id
              FROM ("
.WORDLIST_TABLE." w, ".WORDMATCH_TABLE." m)
              WHERE w.word_text LIKE '"
.addslashes(str_replace("*""%"$split_words[$i]))."'
              AND m.word_id = w.word_id
              
$match_field_sql";
      
$result $site_db->query($sql);
      
$search_word_cache[$i] = array();
      while (
$row $site_db->fetch_array($result)) {
        
$search_word_cache[$i][$row['image_id']] = 1;
      }
      
$site_db->free_result();
    }
  }

  
$is_first_word 1;
  
$operator "or";
  
$image_id_list = array();
  for (
$i 0$i sizeof($search_word_cache); $i++) {
    if (
$search_word_cache[$i] == "and" || $search_word_cache[$i] == "und" || $search_word_cache[$i] == "or" || $search_word_cache[$i] == "oder" || $search_word_cache[$i] == "not") {
      if (!
$is_first_word) {
        
$operator $search_word_cache[$i];
      }
    }
    elseif (
is_array($search_word_cache[$i])) {
      if (
$search_terms) {
        
$operator "and";
      }
      foreach (
$search_word_cache[$i] as $key => $val) {
        if (
$is_first_word || $operator == "or" || $operator == "oder") {
          
$image_id_list[$key] = 1;
        }
        elseif (
$operator == "not") {
          unset(
$image_id_list[$key]);
        }
      }
      if ((
$operator == "and" || $operator == "und") && !$is_first_word) {
        foreach (
$image_id_list as $key => $val) {
          if (!isset(
$search_word_cache[$i][$key])) {
            unset(
$image_id_list[$key]);
          }
        }
      }
    }
    
$is_first_word 0;
  }

  
$search_id['image_ids'] = "";
  foreach (
$image_id_list as $key => $val) {
    
$search_id['image_ids'] .= (($search_id['image_ids'] != "") ? ", " "").$key;
  }
  unset(
$image_id_list);
}

if (
$search_new_images && $show_result == 1) {
  
$search_id['search_new_images'] = 1;
}

if (
$search_cat && $show_result == 1) {
  
$search_id['search_cat'] = $search_cat;
}

if (!empty(
$search_id)) {
  
$site_sess->set_session_var("search_id"serialize($search_id));
}

include(
ROOT_PATH.'includes/page_header.php');

$num_rows_all 0;
if (
$show_result == 1) {
  if (empty(
$search_id)) {
    if (!empty(
$session_info['search_id'])) {
      
$search_id unserialize($session_info['search_id']);
    } else {
      
$search_id unserialize($site_sess->get_session_var("search_id"));
    }
  }

  
$sql_where_query "";

  if (!empty(
$search_id['image_ids'])) {
    
$sql_where_query .= "AND i.image_id IN (".$search_id['image_ids'].") ";
  }

  if (!empty(
$search_id['user_ids'])) {
    
$sql_where_query .= "AND i.user_id IN (".$search_id['user_ids'].") ";
  }

  if (!empty(
$search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    
$new_cutoff time() - 60 60 24 $config['new_cutoff'];
    
$sql_where_query .= "AND i.image_date >= $new_cutoff ";
  }

  if (!empty(
$search_id['search_cat']) && $search_id['search_cat'] != 0) {
    
$cat_id_sql 0;
    if (
check_permission("auth_viewcat"$search_id['search_cat'])) {
      
$sub_cat_ids get_subcat_ids($search_id['search_cat'], $search_id['search_cat'], $cat_parent_cache);
      
$cat_id_sql .= ", ".$search_id['search_cat'];
      if (!empty(
$sub_cat_ids[$search_id['search_cat']])) {
        foreach (
$sub_cat_ids[$search_id['search_cat']] as $val) {
          if (
check_permission("auth_viewcat"$val)) {
            
$cat_id_sql .= ", ".$val;
          }
        }
      }
    }
    
$cat_id_sql $cat_id_sql !== "AND i.cat_id IN ($cat_id_sql)" "";
  }
  else {
    
$cat_id_sql get_auth_cat_sql("auth_viewcat""NOTIN");
    
$cat_id_sql $cat_id_sql !== "AND i.cat_id NOT IN (".$cat_id_sql.")" "";
  }

  if (!empty(
$sql_where_query)) {
    
$sql "SELECT COUNT(*) AS num_rows_all
            FROM "
.IMAGES_TABLE." i
            WHERE i.image_active = 1 
$sql_where_query
            
$cat_id_sql";
    
$row $site_db->query_firstrow($sql);
    
$num_rows_all $row['num_rows_all'];
  }
}

if (!
$num_rows_all && $show_result == 1)  {
  
$msg preg_replace("/".$site_template->start."search_keywords".$site_template->end."/"$search_keywords$lang['search_no_results']);
}

//-----------------------------------------------------
//--- Show Search Results -----------------------------
//-----------------------------------------------------
if ($num_rows_all && $show_result == 1)  {
  
$link_arg $site_sess->url(ROOT_PATH."search.php?show_result=1");

  include(
ROOT_PATH.'includes/paging.php');
  
$getpaging = new Paging($page$perpage$num_rows_all$link_arg);
  
$offset $getpaging->get_offset();
  
$site_template->register_vars(array(
    
"paging" => $getpaging->get_paging(),
    
"paging_stats" => $getpaging->get_paging_stats()
  ));

  
$imgtable_width ceil((intval($config['image_table_width'])) / $config['image_cells']);
  if ((
substr($config['image_table_width'], -1)) == "%") {
    
$imgtable_width .= "%";
  }

  
$additional_sql "";
  if (!empty(
$additional_image_fields)) {
    foreach (
$additional_image_fields as $key => $val) {
      
$additional_sql .= ", i.".$key;
    }
  }

  
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name")."
          FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
          LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
          WHERE i.image_active = 1
          
$sql_where_query
          AND c.cat_id = i.cat_id 
$cat_id_sql
          ORDER BY "
.$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort']."
          LIMIT 
$offset$perpage";
  
$result $site_db->query($sql);

  
$thumbnails "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";

  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)) {
    if (
$count == 0) {
      
$row_bg_number = ($bgcounter++ % == 0) ? 2;
      
$thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    
$thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
    
show_image($image_row"search");
    
$thumbnails .= $site_template->parse_template("thumbnail_bit");
    
$thumbnails .= "\n</td>\n";
    
$count++;
    if (
$count == $config['image_cells']) {
      
$thumbnails .= "</tr>\n";
      
$count 0;
    }
  } 
// end while
  
if ($count 0)  {
    
$leftover = ($config['image_cells'] - $count);
    if (
$leftover >= 1) {
      for (
$i 0$i $leftover$i++) {
        
$thumbnails .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      
$thumbnails .= "</tr>\n";
    }
  }
  
$thumbnails .= "</table>\n";
  
$content $thumbnails;
  unset(
$thumbnails);
// end if
else {
// --- Start Mod: Colorsearch by KW --------------------------------------------
$show_colors 200;                                // how many colors show in table
$show_colors_lines_br 11;                       // how many colors in one line
$show_colors_size $config['colorsearch_size'];  //size from the color cells (in ACP settings)

$sql "SELECT w.word_id, w.word_text, m.word_id, COUNT(w.word_text) AS quantity
        FROM ("
.WORDLIST_TABLE." w, ".WORDMATCH_TABLE." m)
        WHERE w.word_id = m.word_id AND m.colorsearch_colors_match = 1
        GROUP BY w.word_text
        ORDER BY quantity DESC
        LIMIT 
$show_colors";
$result $site_db->query($sql);
$num_rows $site_db->get_numrows($result);

if (!
$num_rows)  {
  
$image_farbton_suche "";
}
else  {
  
$image_farbton_suche "";
  
$count 0;
  
$bgcounter 0;
  while (
$image_row $site_db->fetch_array($result)){
    if (
$count == 0) {
    
$image_farbton_suche .= "<tr> \n";
    }
    
$image_farbton_suche .= "<form method=\"post\" action=\"./search.php\"> \n";
    
$image_farbton_suche .= "<td width=\"".$show_colors_size."\" height=\"".$show_colors_size."> \n";
    
$image_farbton_suche .= "<input name=\"search_fields\" value=\"image_farbton\" type=\"hidden\"> \n";
    
$image_farbton_suche .= "<input name=\"search_keywords\" value=\"".$image_row['word_text']."\" type=\"hidden\"> \n";
    
$image_farbton_suche .= "<input name=\"show_result\" value=\"1\" type=\"hidden\"> \n";
    if (
$image_row['quantity'] > 1) {
     
$image_farbton_suche .= "<input style=\"background-color: #".$image_row['word_text']."; font-size: 1px; WIDTH: ".$show_colors_size."px; HEIGHT: ".$show_colors_size."px; border: 1px; cursor: pointer;\" type=\"submit\" value=\"\" title=\"".$lang['farbton_suche_color']." #".$image_row['word_text']."".$lang['farbton_suche_found']." ".$image_row['quantity']." ".$lang['farbton_suche_found_2']."\"> \n";
    } else {
     
$image_farbton_suche .= "<input style=\"background-color: #".$image_row['word_text']."; font-size: 1px; WIDTH: ".$show_colors_size."px; HEIGHT: ".$show_colors_size."px; border: 1px; cursor: pointer;\" type=\"submit\" value=\"\" title=\"".$lang['farbton_suche_color']." #".$image_row['word_text']."".$lang['farbton_suche_found_1']."\"> \n";
    }
    
$image_farbton_suche .= "</td> \n";
    
$image_farbton_suche .= "</form> \n";
    
$count++;
    if (
$count == $show_colors_lines_br) {
      
$image_farbton_suche .= "</tr> \n";
      
$count 0;
    }
  } 
// end while
  
if ($count 0)  {
    
$leftover = ($show_colors_lines_br $count);
    if (
$leftover >= 1) {
      for (
$f 0$f $leftover$f++) {
        
$image_farbton_suche .= "<td>&nbsp;</td> \n";
      }
      
$image_farbton_suche .= "</tr> \n";
    }
  }
  
$image_farbton_suche .= "";
// end else

$site_template->register_vars(array(
  
"image_farbton_suche" => $image_farbton_suche,
  
"lang_farbton_suche" => $lang['farbton_suche']
));
unset(
$image_farbton_suche);
// --- End Mod: Colorsearch by KW ----------------------------------------------
  
$site_template->register_vars(array(
    
"search_keywords" => format_text(stripslashes($org_search_keywords), 2),
    
"search_stats" => "<a href=\"".$site_sess->url(ROOT_PATH."search_stats.php")."\">".$lang['search_stats']."</a>",
    
"search_user" => format_text(stripslashes($org_search_user), 2),
    
"lang_search_by_keyword" => $lang['search_by_keyword'],
    
"lang_search_by_username" => $lang['search_by_username'],
    
"lang_new_images_only" => $lang['new_images_only'],
    
"lang_search_terms" => $lang['search_terms'],
    
"lang_or" => $lang['or'],
    
"lang_and" => $lang['and'],
    
"lang_category" => $lang['category'],
    
"lang_search_fields" => $lang['search_fields'],
    
"lang_all_fields" => $lang['all_fields'],
    
"lang_name_only" => $lang['name_only'],
    
"lang_description_only" => $lang['description_only'],
    
"lang_keywords_only" => $lang['keywords_only'],
    
"category_dropdown" => get_category_dropdown($cat_id)
  ));

  if (!empty(
$additional_image_fields)) {
    
$additional_field_array = array();
    foreach (
$additional_image_fields as $key => $val) {
      if (isset(
$lang[$key.'_only'])) {
        
$additional_field_array['lang_'.$key.'_only'] = $lang[$key.'_only'];
      }
    }
    if (!empty(
$additional_field_array)) {
      
$site_template->register_vars($additional_field_array);
    }
  }
  
$content $site_template->parse_template("search_form");
}
//######################## Start MOD Ajax Slideshow/Diashow with piclens #######################
$ajax_slideshow_piclens_button "";
$slideshow_rss "";
if (
$num_rows_all && $show_result == 1)  {
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name")."
        FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_active = 1
        
$sql_where_query
        AND c.cat_id = i.cat_id 
$cat_id_sql
        ORDER BY "
.$config['image_order']." ".$config['image_sort'].", i.image_id ".$config['image_sort']."
        LIMIT 
$offset$perpage";

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

if (!
$num_rows)  {
  
$slideshow_rss "";
  
$ajax_slideshow_piclens_button "";
} else {
  
$ajax_slideshow_piclens_view 1;
  
$slideshow_id $session_info['session_ip'];
  
$slideshow_id str_replace(".","",$slideshow_id);
  
$slideshow_id = ($slideshow_id -117);
  
$slideshow_time date("s");
  
$ist=0;
  
$absoluter_pfad getcwd();
  
$pfad $absoluter_pfad."/data/tmp_mods/slideshow_piclens/";
  
$directory=opendir ($pfad);
  
$deletime time()-10*60// 10 Minuten Cache-Time
  
while ($dat=readdir($directory))
  {
  if (
filetype($pfad.$dat)!="dir")
  {
  
$ist++;
  if (
filemtime($pfad.$dat)<$deletime)
  {
  @
unlink($pfad.$dat);
  }
  }
  }
  
closedir($directory);

  
$fp fopen("./data/tmp_mods/slideshow_piclens/slideshow_".$slideshow_id."".$slideshow_time.".rss""w+");
  function 
leeren($file) {
     
$datei fopen($file,"w");
     
fputs($datei,"");
     
fclose($datei);
  }
  
leeren("./data/tmp_mods/slideshow_piclens/slideshow_".$slideshow_id."".$slideshow_time.".rss"); // Datei die geleert werden soll.
  
$fp fopen("./data/tmp_mods/slideshow_piclens/slideshow_".$slideshow_id."".$slideshow_time.".rss""w+");
   
$text_ajax_slideshow_piclens "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
\n";
   $text_ajax_slideshow_piclens .= "<rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss\"> \n";
   $text_ajax_slideshow_piclens .= "<channel> \n";
   if ($config['ajax_slideshowviewer_piclens_bgsound']) {
   $text_ajax_slideshow_piclens .= "<audio url=\"".$config['ajax_slideshowviewer_piclens_bgsound']."\"/> \n";
   }
   if ($config['ajax_slideshowviewer_piclens_logo']) {
   $text_ajax_slideshow_piclens .= "<logo url=\"".$config['ajax_slideshowviewer_piclens_logo']."\"/> \n";
   }
   $text_ajax_slideshow_piclens .= "<title></title> \n";
   $text_ajax_slideshow_piclens .= "<link></link> \n";
   $text_ajax_slideshow_piclens .= "<description></description> \n";
  $count = 0;
  $bgcounter = 0;
  while ($image_slideshow_row = $site_db->fetch_array($result)) {
   $ext = get_file_extension($image_slideshow_row['image_media_file']);
   $config['ajax_slideshowviewer_piclens_Types_array'] = explode(",", $config['ajax_slideshowviewer_piclens_Types']);
   if (in_array($ext, $config['ajax_slideshowviewer_piclens_Types_array'])) {
   $ajax_slideshow_piclens_view = 1;
   show_image($image_slideshow_row);
   $text_ajax_slideshow_piclens .= "<item> \n";
   $text_ajax_slideshow_piclens .= "<title>".$image_slideshow_row['image_name']."</title> \n";
   $text_ajax_slideshow_piclens .= "<link>details.php?image_id=".$image_slideshow_row['image_id']."</link> \n";
   $text_ajax_slideshow_piclens .= "<guid>".$image_row['image_id']."</guid> \n";
   $text_ajax_slideshow_piclens .= "<media:thumbnail url=\"".$script_url."/".THUMB_DIR."/".$image_slideshow_row['cat_id']."/".$image_slideshow_row['image_thumb_file']."\" /> \n";
   if ($ext == 'flv') {
   $text_ajax_slideshow_piclens .= "<media:content url=\"".$script_url."/".MEDIA_DIR."/".$image_slideshow_row['cat_id']."/".$image_slideshow_row['image_media_file']."\" type=\"pl_video/x-flv\" /> \n";
   } else {
   $text_ajax_slideshow_piclens .= "<media:content url=\"".$script_url."/".MEDIA_DIR."/".$image_slideshow_row['cat_id']."/".$image_slideshow_row['image_media_file']."\" type=\"\" /> \n";
   }
   $text_ajax_slideshow_piclens .= "</item> \n";
   $text_ajax_slideshow_piclens .= "\n";
   }
 }
  if ($count > 0)  {
  $leftover = ($config['image_cells'] - $count);
  }
  $text_ajax_slideshow_piclens .= "</channel> \n";
  $text_ajax_slideshow_piclens .= "</rss> \n";
 fwrite($fp, $text_ajax_slideshow_piclens);
 fclose($fp);

if ($user_info['user_level'] == GUEST && $config['ajax_slideshowviewer_piclens_Show'] == "1" && $ajax_slideshow_piclens_view == "1") {
  $ajax_slideshow_piclens_button = "<img src=\"".get_gallery_image("diashow_off.gif")."\" border=\"0\" alt=\"\" />";
} elseif ($user_info['user_level'] != GUEST && $config['ajax_slideshowviewer_piclens_Show'] == "1" && $ajax_slideshow_piclens_view == "1" || $config['ajax_slideshowviewer_piclens_Show'] == "2" && $ajax_slideshow_piclens_view == "1") {
  $ajax_slideshow_piclens_button = "<a href=\"javascript:PicLensLite.start();\"><img src=\"".get_gallery_image("diashow.gif")."\" border=\"0\" alt=\"\" /></a>";
  $slideshow_rss = "./data/tmp_mods/slideshow_piclens/slideshow_".$slideshow_id."".$slideshow_time.".rss";
}
}
unset($ajax_slideshow_piclens);
}
//######################## End MOD Ajax Slideshow/Diashow with piclens #######################
//-----------------------------------------------------
//--- Show New Images ---------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "has_rss"   => true,
  "rss_title" => "RSS Feed: ".format_text($config['site_name'], 2)." (".str_replace(':', '', $lang['new_images']).")",
  "rss_url"   => $script_url."/rss.php?action=images"
));

$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
  $imgtable_width .= "%";
}

$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}

$num_new_images = 12;
$config['image_cells'] = 3;
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
        FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
        WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY i.image_date DESC
        LIMIT $num_new_images";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);

if (!$num_rows)  {
  $new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
  $new_images .= $lang['no_new_images'];
  $new_images .= "</td></tr></table>";
}
else  {
  $new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
  $count = 0;
  $bgcounter = 0;
  while ($image_row = $site_db->fetch_array($result)){
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images .= "<td class=\"imagerow\" width=\"".$imgtable_width."\" valign=\"top\">\n";

    show_image($image_row);
    $new_images .= $site_template->parse_template("thumbnail_bit");
    $new_images .= "\n</td>\n";
    $count++;
    if ($count == $config['image_cells']) {
      $new_images .= "</tr>\n";
      $count = 0;
    }
  } // end while

  if ($count > 0)  {
    $leftover = ($config['image_cells'] - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images .= "<td width=\"".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      $new_images .= "</tr>\n";
    }
  }
  $new_images .= "</table>\n";
} // end else

$site_template->register_vars("new_images", $new_images);
unset($new_images);
///--------------------------------------------------------
// Latest and Archive News Mod --
// --
// User configurable variables --
// You must change the first 4 variables to meet --
// your requirements:     (see notes below) --
//     $display_by_count --
//     $latest_news_day --
//     $show_news_articles --
//     $news_image --
//--------------------------------------------------------
  $display_by_count = "0";      // values 0 or 1 ....
                                // .... change this to 0 if display by days posted
                                // .... or 1 to display fixed number of news articles as Latest
                               
  $latest_news_days = "31";     // Number of days news displays at Latest ....
                                // .... change This to the number of days news shows as Latest
                               
  $show_news_articles = "5";    // Number of news articles to show ....
                                // .... change This to fixed number of articles to display for latest news
                               
  $news_image = "172";          // Change This to your Latest news image id
//----------------------------------------------------

$new_news = (time() - 60 * 60 * 24 * $latest_news_days);

 

  $additional_sql = "";

  if ($news_type == "latestnews") {

    if ($display_by_count) {
        $additional_sql .= "  c.image_id = '".$news_image."'";
    }
    else {
        $additional_sql .= " c.comment_date > '".$new_news."' AND c.image_id = '".$news_image."'";
        $additional_sql_2 .= "";
    }
  }

  else {
    $additional_sql .= " c.image_id = '".$news_image."'";
    $clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>&nbsp;/&nbsp;Archived News";
  }

  $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2 ;

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

  while ($row = $site_db->fetch_array($result)) {
    $news_comment_row[] = $row;
  }

  $site_db->free_result($result);
   
// This is the Paging stuff
  if ($newstype == "latestnewsall") {
       
    include(ROOT_PATH.'includes/paging.php');
    $perpage = $show_news_articles;
    $link_arg = $site_sess->url(ROOT_PATH."index.php?newstype=latestnewsall");
    $getpaging = new Paging($page, $perpage, $num_rows, $link_arg);
    $offset = $getpaging->get_offset();

    $site_template->register_vars(array(
      "paging" => $getpaging->get_paging(),
      "paging_stats" => $getpaging->get_paging_stats()
    ));
     
    $sql = "SELECT c.comment_headline, c.comment_text, c.comment_date, c.image_id
            FROM ".COMMENTS_TABLE." c
            WHERE ".$additional_sql."
            ORDER BY c.comment_date DESC" .$additional_sql_2." 
            LIMIT $offset, $perpage";

          $result = $site_db->query($sql);
          $num_rows = $site_db->get_numrows($result);
          $news_comment_row = array();
           
      while ($row = $site_db->fetch_array($result)) {
            $news_comment_row[] = $row;
          }
  }

  if (!$num_rows) {
      $news_comments = "&nbsp;&nbsp;&nbsp;<b>No New News to report within the last ".$latest_news_days." days.</b>";
  }
  else {
      $news_comments = "";
      $bgcounter = 0;

    for ($i = 0; $i < $num_rows; $i++) {
        $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;

        $site_template->register_vars(array(
            "news_comment_headline" => format_text($news_comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
            "news_comment_text" => format_text($news_comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
            "news_comment_date" => format_date($config['date_format']." ".$config['time_format'], $news_comment_row[$i]['comment_date']),
            "row_bg_number" => $row_bg_number));

        $news_comments .= $site_template->parse_template("news_comment_bit");
    }

  }
  $site_template->register_vars("news_comments", $news_comments);
  unset($news_comments);

//-----------------------------------------------------
//---End of Show Latest News   -------------------------------
//-----------------------------------------------------
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['search']."</span>";
/*
  MOD LAST COMMENTS
   START INSERT
*/
//Settings
$num = 7; //how many comments to show
$thumb_size = 150; //max dim of thumbnails in pixels
$text_len = 200; //max lenght of the text to show (bbcode and html are counted too)
//End settings

$last_comments = "";
$sql = "SELECT c.image_id, c.comment_id, c.user_id as comment_user_id, c.user_name as guest_user_name, c.comment_headline, c.comment_text, c.comment_date, i.cat_id, i.user_id, i.image_name, i.image_media_file, i.image_thumb_file".get_user_table_field(", u.", "user_name")." as user_name".get_user_table_field(", s.", "user_name")." as comment_user_name
        FROM ".COMMENTS_TABLE." c
        LEFT JOIN ".IMAGES_TABLE." i ON i.image_id = c.image_id
        LEFT JOIN ".USERS_TABLE." u ON ".get_user_table_field("u.", "user_id")." = i.user_id
        LEFT JOIN ".USERS_TABLE." s ON ".get_user_table_field("s.", "user_id")." = c.user_id
        WHERE i.image_active = 1 AND i.image_allow_comments = 1 AND i.cat_id NOT IN (".get_auth_cat_sql('auth_readcomment', 'NOTIN').") AND i.cat_id NOT IN (".get_auth_cat_sql('auth_viewcat', 'NOTIN').") AND i.cat_id NOT IN (".get_auth_cat_sql('auth_viewimage', 'NOTIN').")
        ORDER BY c.comment_date DESC
        LIMIT ".$num;
$result = $site_db->query($sql);
$bgcounter = 1;
while ($row = $site_db->fetch_array($result))
{
  $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
  if (empty($row['image_thumb_file']))
  {
    $thumb_file = ICON_PATH."/".get_file_extension($row['image_media_file']).".gif";
  }
  else
  {
    $thumb_file = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$row['cat_id']."/".$row['image_thumb_file'];
  }
  $thumb_info = @getimagesize($thumb_file);
  $width = ($thumb_info[0]) ? $thumb_info[0] : $thumb_size;
  $height = ($thumb_info[1]) ? $thumb_info[1] : $thumb_size;
  if ($width > $thumb_size && $height > $thumb_size)
  {
    $ratio = $width / $height;
    if ($ratio > 1) {
      $new_width = $thumb_size;
      $new_height = round(($thumb_size/$width) * $height);
    }else {
      $new_width = round(($thumb_size/$height) * $width);
      $new_height = $thumb_size;
    }
  }
  else
  {
    $new_width = $width;
    $new_height = $height;
  }
  $view_image = true;
  $thumb = "<img class=\"slt\" src=\"".$thumb_file."\" border=\"".$config['image_border']."\" width=\"".$new_width."\" height=\"".$new_height."\" alt=\"".$row['image_name']."\" />";
/*
  $view_image = check_permission('auth_viewcat', $row['cat_id']);
  $thumb = "<img src=\"".$thumb_file."\"".(($view_image) ? "" : " onClick=\"alert('".(($lang['auth_alert'][$cat_id]) ? $lang['auth_alert'][$cat_id] : $lang['auth_alert']['default'])."');\"")." border=\"".$config['image_border']."\" width=\"".$new_width."\" height=\"".$new_height."\" alt=\"".$row['image_name']."\" />";
*/
  $image_user_name = ($row['user_id'] != GUEST) ? $row['user_name'] : $lang['userlevel_guest'];
  $image_user_link = ($row['user_id'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;user_id=".$row['user_id']) : "";
  $comment_user_name = ($row['comment_user_id'] == GUEST) ? ((empty($row['guest_user_name'])) ? $lang['userlevel_guest'] : $row['guest_user_name']) : $row['comment_user_name'];
  $comment_user_link = ($row['comment_user_id'] != GUEST) ? $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;user_id=".$row['comment_user_id']) : "";
  $text = $row['comment_text'];
  if (strlen($text) > $text_len) {
    $text = substr($text, 0, $text_len)." ...";
  }
 
      $site_template->register_vars(array(
    "last_comments_more" => "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showcomments", "&")."\">".$lang['last_comments_more']."</a>",
    "comment_image" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?image_id=".$row['image_id'])."\" class=\"slt\">".$thumb."</a>" : $thumb,
    "comment_guest" => ($row['comment_user_id'] == GUEST && !empty($row['guest_user_name'])) ? $lang['userlevel_guest'] : "",
    "comment_image_name" => ($view_image) ? "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id'])."\" class=\"nsslt\">".stripslashes($row['image_name'])."</a>" : stripslashes($row['image_name']),
    "image_cat_name" => (check_permission('auth_viewcat', $row['cat_id'])) ? "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$row['cat_id'])."\" class=\"slt\">".$cat_cache[$row['cat_id']]['cat_name']."</a>" : $cat_cache[$row['cat_id']]['cat_name'],
    "image_user_name" =>   ($image_user_link) ? "<a href=\"".$image_user_link."\">".$image_user_name."</a>" : $image_user_name,
    "comment_user_name" => ($comment_user_link) ? "<a href=\"".$comment_user_link."\" class=\"slt\">".$comment_user_name."</a>" : $comment_user_name,
    "comment_user_id" => $row['comment_user_id'],
    "comment_headline" => format_text($row['comment_headline'], 0, $config['wordwrap_comments'], $config['bb_comments'], 0, 1),
    "comment_text" => format_text($text, $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments'], 1, 0),
    "comment_date" => format_date($config['date_format']." ".$config['time_format'], $row['comment_date']),
    "row_bg_number" => $row_bg_number
  ));
  $last_comments .= $site_template->parse_template("last_comment_bit");
}
/*
if (empty($last_comments))
{
  $last_comments = $lang['no_comments'];
}
*/
$site_template->register_vars(array(
  "lang_last_comments" => $lang['last_comments'],
  "last_comments" => $last_comments
));
/*
  MOD LAST COMMENTS
  START INSERT
*/           
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "content" => $content,
  "msg" => $msg,
  //###################### Start MOD Ajax Slideshow/Diashow with piclens #######################
  "slideshow_rss" => $slideshow_rss,
  "ajax_slideshow_piclens_button" => $ajax_slideshow_piclens_button,
//######################## End MOD Ajax Slideshow/Diashow with piclens #######################
  "clickstream" => $clickstream,
  "lang_search" => $lang['search']
));
if ($news_type == "latestnewsall") { 
  $site_template->print_template($site_template->parse_template(archive));     

else { 
  $site_template->print_template($site_template->parse_template($main_template)); 
}
include(ROOT_PATH.'includes/page_footer.php');
?>


Title: Re: [Mod] Latest News and Archive
Post by: 4ella on April 27, 2009, 09:20:37 PM
Hello everyone ,

I just finished this very nice mod but I can' t see the Latest News picture at all (nevermind I use comments HTML form to upload another, but was only curious what I made bad that I dont have there the picture when I twice put this ID number at place where I had to do put it)

2. problem -  like many other people here I can't get to archives at all, the page after the click is always reverting back to the main page. Because before every post I  publish here I read carefully all the posts in thread before,to find the solution myself with the help of the others , I noticed that it is about 5-7 posts in this topic which had exactly the same problem and I can't find here the answer or some solution for that , nobody had never responded ,  I use 1.7.6 version .
                                                                                Can somebody help me ?

another thing wanted to ask is it possible to shorten comments on home page - the same princip like last comments has in index.php ?
I would like to shorten only first page -home.html and on archives.html want to have whole article .

I m sure that this is simple because there exist many versions - shorten category , shorten last comments etc. but Im not able to do that .


I was trying to put it there the code from last comments , but it doesnt work ,

Quote
$text_len = "200"; //max lenght of the text to show (bbcode and html are counted too)

For me the best solution would be like for the Mawenzi his  AJAX Mawenzi website's shorten category descriptions with small  (+ ) button , I'm searching for this all around and I cant find it , I like it a lot .




Title: Re: [Mod] Latest News and Archive
Post by: AntiNSA2 on May 03, 2009, 09:25:24 AM
Ok On page 4 of this thread earthlyk has the same problem, which he solved by adding this code
Code: [Select]
$new_news = (time() - 60 * 60 * 24 * $latest_news_days);

$newstype = $_GET["newstype"];     //I add this line.

if ($newstype == "latestnewsall"){
    $news_type = "latestnewsall";
    }
else {
    $news_type = "latestnews";
    }

  $additional_sql = "";
  $additional_sql_2  = ""; //and add this line too.


However he also turned off the error reporting in the php.ini   ...

I cant turn it off... I need to learn it on... I am only getting these errors on search.php...   is there something I am doing wrong.
Title: Re: [Mod] Latest News and Archive
Post by: Damebi on July 12, 2009, 04:41:03 PM
THX a lot !  :D

Funktioniert wunderbar mit // works wunderfull with --> V 1.7.7.


--> http://www.damebi.at/4images/ (http://www.damebi.at/4images/)
(nicht erschrecken, bin erst seit gestern am rumcoden)
Title: Re: [Mod] Latest News and Archive
Post by: GaYan on August 14, 2009, 07:11:35 PM
is this possible with 1.7.6 "? S