• [Mod] Latest News and Archive 5 0 5 1
Currently:  

Author Topic: [Mod] Latest News and Archive  (Read 183087 times)

0 Members and 1 Guest are viewing this topic.

Offline rcole82

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • rcole82's starbucks gallery
[Mod] Latest News and Archive
« Reply #15 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

Offline Fugaziman

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • http://www.1024x768wallpapers.com
[Mod] Latest News and Archive
« Reply #16 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
Please take time to visit us at ...
http://www.1024x768wallpapers.com
And don't forget to leave a comment or message.

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
[Mod] Latest News and Archive
« Reply #17 on: April 25, 2003, 02:31:45 AM »
The paging Fugaziman????

Offline Fugaziman

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • http://www.1024x768wallpapers.com
[Mod] Latest News and Archive
« Reply #18 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
Please take time to visit us at ...
http://www.1024x768wallpapers.com
And don't forget to leave a comment or message.

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
thanks
« Reply #19 on: April 27, 2003, 04:36:53 AM »
Big thanks :P  :P

Offline Fugaziman

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • http://www.1024x768wallpapers.com
[Mod] Latest News and Archive
« Reply #20 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
Please take time to visit us at ...
http://www.1024x768wallpapers.com
And don't forget to leave a comment or message.

Offline mantra

  • Sr. Member
  • ****
  • Posts: 358
    • View Profile
    • DREAM WITH MANTRA
you cooll
« Reply #21 on: April 28, 2003, 02:23:49 AM »
you coolllll man, thank's. :D  :D  :D  :D  :D  :D

Offline tmacisnbr1

  • Newbie
  • *
  • Posts: 32
    • View Profile
[Mod] Latest News and Archive
« Reply #22 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

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[Mod] Latest News and Archive
« Reply #23 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...

Offline Fugaziman

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • http://www.1024x768wallpapers.com
[Mod] Latest News and Archive
« Reply #24 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:
Please take time to visit us at ...
http://www.1024x768wallpapers.com
And don't forget to leave a comment or message.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Re: [Mod] Latest News and Archive
« Reply #25 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.

Offline Fugaziman

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • http://www.1024x768wallpapers.com
Thanks
« Reply #26 on: May 17, 2003, 10:04:28 PM »
Thanks Chris

have amended post
Fugaziman
Please take time to visit us at ...
http://www.1024x768wallpapers.com
And don't forget to leave a comment or message.

Offline weezle

  • Newbie
  • *
  • Posts: 15
    • View Profile
[Mod] Latest News and Archive
« Reply #27 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

Offline Fugaziman

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
    • http://www.1024x768wallpapers.com
[Mod] Latest News and Archive
« Reply #28 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
Please take time to visit us at ...
http://www.1024x768wallpapers.com
And don't forget to leave a comment or message.

Offline weezle

  • Newbie
  • *
  • Posts: 15
    • View Profile
[Mod] Latest News and Archive
« Reply #29 on: May 22, 2003, 11:10:55 PM »
Thanks ,for your help,
News Mod is still working, its very nice.

Greetings
Marco