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

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

0 Members and 1 Guest are viewing this topic.

TheOracle

  • Guest
Re: [MOD]Another Simple News Publishing Mod
« Reply #60 on: August 11, 2005, 09:55:48 PM »
That's odd.

What if you replace the whole news.php file with my personalized one then :

Code: [Select]

<?php

$main_template 
'news';
define('GET_CACHES'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');

//-----------------------------------------------------
//---Show Guestbook Comments---------------------------
//-----------------------------------------------------

if (isset($_POST['commentsetperpage']) || isset($_GET['commentsetperpage']))
{
$commentsetperpage = (intval($_POST['commentsetperpage']) ) ? intval($_POST['commentsetperpage']) : intval($_GET['commentsetperpage']);
if ($commentsetperpage)
{
$site_sess->set_session_var("commentperpage"$commentsetperpage);
$session_info['commentperpage'] = $commentsetperpage;
}
}

if (isset($session_info['commentperpage']))
{
$newsPerPage $session_info['commentperpage'];
} else
{
$newsPerPage 5;
}

$sql "SELECT COUNT(news_id) AS news FROM ".NEWS_TABLE;
$result $site_db->query_firstrow($sql);
$num_news $result['news'];
$site_db->free_result();

$num_rows_all = (isset($num_news)) ? $num_news 0;

$link_arg $site_sess->url(ROOT_PATH."news.php");
include_once(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page$newsPerPage$num_rows_all$link_arg);

$offset $getpaging->get_offset();

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

$sql "SELECT news_id, news_title, news_text, user_name, news_date FROM ".NEWS_TABLE." ORDER BY news_date DESC LIMIT $offset$newsPerPage";

$result $site_db->query($sql);
$news_row = array();
while ($row $site_db->fetch_array($result))
{
$news_row[] = $row;
}
$site_db->free_result($result);
$num_news sizeof($news_row);
$comments "";

if ($num_news)
{
for ($i 0$i $num_news$i++)
{
$comment_user_name htmlspecialchars($news_row[$i]['comment_user_name']);

$admin_links "";
if ($user_info['user_level'] == ADMIN)
{
$admin_links .= ($user_info['user_level'] != ADMIN) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."admin/news.php?action=addnews")."\" target=\"admin_add\">".$lang['add']."</a>&nbsp;";
$admin_links .= ($user_info['user_level'] != ADMIN) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."admin/news.php?action=editnews&amp;news_id=".$news_row[$i]['news_id'])."\" target=\"admin_edit\">".$lang['edit']."</a>&nbsp;";
$admin_links .= ($user_info['user_level'] != ADMIN) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."admin/news.php?action=removenews&amp;news_id=".$news_row[$i]['news_id'])."\" target=\"admin_edit\">".$lang['delete']."</a>";
}

$site_template->register_vars(array(
    "news_title" => "<b><span class=\"head1\">".$news_row[$i]['news_title']." - ".sprintf($lang['news_posted_by'], $news_row[$i]['user_name'], format_date($config['date_format']." ".$config['time_format'], $news_row[$i]['news_date'])) . "</span></b>",
"news_text" => format_text($news_row[$i]['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),
"admin_links" => $admin_links,
));
$comments .= $site_template->parse_template("news_bit");
// end for
}
else
{
$comments $lang['no_news'];
}

//---End Show Guestbook Comments----

$contents $site_template->parse_template("news_show");

  
$txt_clickstream $lang['news_main'];

//-----------------------------------------------------
//---Clickstream---------------------------------------
//-----------------------------------------------------
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];

if (
$getpaging->page 1)
{
$clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."news.php")."\">".$lang['news_main']."</a>".$config['category_separator'].$lang['page']." ".$getpaging->page."</span>";
}
else
$clickstream .= $txt_clickstream."</span>";

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"contents" => $contents,
  
"news_contents" => $comments,
  
"news_archives_title" => $lang['news_archives_title'],
  
"clickstream" => $clickstream
));
unset(
$contents);
$site_template->print_template($site_template->parse_template($main_template));
include(
ROOT_PATH.'includes/page_footer.php');

?>



? ;)

Offline ID25

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #61 on: August 11, 2005, 10:13:00 PM »
see at now :/
don't work...
just template other, because $main_template = 'news';
where is mistake? maybe not there...

TheOracle

  • Guest
Re: [MOD]Another Simple News Publishing Mod
« Reply #62 on: August 11, 2005, 10:19:05 PM »
What about your HTML news templates ? Are you sure you did followed the instructions by the letter ?

Offline ID25

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #63 on: August 11, 2005, 10:27:26 PM »
from the zip file i placed all templates to TEMPLATES DIR
only home.html i change to my, where i put code:
Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="4">
        <tr>
          <td class="head1" valign="top" height="20">{news_main}</td>
          <td class="head3" align="right" height="20">{news_archives}&nbsp;</td>
       
      </table>
  </tr>
</table><br/>
<div align="center">
  <table width="99%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td class="commentrow2" align="left">
        <div align="left">{news}</div>
      </td>
    </tr>
  </table>
</div>
at the place where i want to see news mod

news_show.html
news_headlines.html
news_bit.html
news.html

TheOracle

  • Guest
Re: [MOD]Another Simple News Publishing Mod
« Reply #64 on: August 11, 2005, 10:32:22 PM »
Looks good so far. Althought, I wouldn't recommend to put the {news} tag under DIV. ;)

As for the rest of the news HTML file, show me.

Offline ID25

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #65 on: August 11, 2005, 10:37:38 PM »
news.html:

Quote
{header}
<table width="640" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
      <table width="640" border="0" cellspacing="0" cellpadding="0" class="tablehead">
        <tr>
          <td colspan="4"><img src="{template_image_url}/header_top.gif" width="640" height="6" alt="" /></td>
        </tr>
        <tr>
          <td width="6"><img src="{template_image_url}/header_left.gif" width="6" height="60" alt="" /></td>
          <td width="405"><img src="{template_image_url}/header_logo.gif" width="405" height="60" alt="" /></td>
          <td width="225" align="right">
            <table border="0" cellspacing="0" cellpadding="1">
              <form method="post" action="{url_search}">
                <tr>
                  <td>
                    <input type="text" name="search_keywords" size="15" class="searchinput" />
                  </td>
                  <td>
                    <input type="submit" value="{lang_search}" class="button" name="submit" />
                  </td>
                </tr>
                <tr valign="top">
                  <td colspan="2"><a href="{url_search}" class="smalltext">{lang_advanced_search}</a></td>
                </tr>
              </form>
            </table>
          </td>
          <td align="right" width="6"><img src="{template_image_url}/header_right.gif" width="6" height="60" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
  <!-- END of HEADER-->
  <tr>
    <td class="bordercolor">
      <table width="640" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td class="tablebgcolor">
            <table width="638" border="0" cellspacing="1" cellpadding="0">
              <tr>
                <td class="navbar" height="23">
                  <table width="636" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="{template_image_url}/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
                      <td align="right">
                  <a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;
                  <a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
                 </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            <table width="638" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="150" class="row2" valign="top">
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"><img src="{template_image_url}/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_image_url}/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">{user_box}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_image_url}/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"><img src="{template_image_url}/spacer.gif" alt="" width="4" height="4" />{lang_menu}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_image_url}/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">{menu} </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_image_url}/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
                  {surfers}
              {if random_image}
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_image_url}/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_image_url}/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_image_url}/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
              {endif random_image}
                </td>
                <td width="1" class="bordercolor" valign="top"><img src="{template_image_url}/spacer.gif" alt="" width="1" height="1" /></td>
                <td width="18" valign="top"><img src="{template_image_url}/spacer.gif" alt="" width="18" height="18" /></td>
                <td width="450" valign="top">
<!-- BEGIN CONTENT -->
{contents}
<br />
                  <!-- END OF CONTENT -->
                </td>
                <td width="19" valign="top"><img src="{template_image_url}/spacer.gif" alt="" width="19" height="19" /></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table width="640" border="0" cellspacing="0" cellpadding="0" class="tablebottom">
        <tr>
          <td width="6"><img src="{template_image_url}/footer_left.gif" width="6" height="19" alt="" /></td>
          <td width="405">&nbsp;</td>
          <td width="225">&nbsp;</td>
          <td width="6"><img src="{template_image_url}/footer_right.gif" width="6" height="19" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
{footer}

TheOracle

  • Guest
Re: [MOD]Another Simple News Publishing Mod
« Reply #66 on: August 11, 2005, 10:45:19 PM »
The problem is here :

Quote

<!-- BEGIN CONTENT -->
{contents}
<br />
                  <!-- END OF CONTENT -->


replace that with :

Code: [Select]

<!-- BEGIN CONTENT -->

{if msg}<br /><b>{msg}</b><br />{endif msg}
{contents}
<br />

<!-- END OF CONTENT -->


Offline ID25

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #67 on: August 11, 2005, 10:53:14 PM »
need tags {msg} ?
ok, i put this, but not work...

my 4images version 1.7.1 - maybe there is problem?

TheOracle

  • Guest
Re: [MOD]Another Simple News Publishing Mod
« Reply #68 on: August 11, 2005, 10:56:14 PM »
That is the only possible conclusion I got so far since I use 4images v1.7 . . .

Offline ID25

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #69 on: August 11, 2005, 10:58:17 PM »
In ACP i see this:
Found: 5. Displayed: 1-.
there is mistake?

TheOracle

  • Guest
Re: [MOD]Another Simple News Publishing Mod
« Reply #70 on: August 11, 2005, 11:01:31 PM »
No mistakes has been reported regarding the tracking news from ACP. I doubt that it would be considered one.

Offline ID25

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #71 on: August 11, 2005, 11:13:56 PM »
any ideas?
how i can fix this problem with archive?
plz, help with this...

TheOracle

  • Guest
Re: [MOD]Another Simple News Publishing Mod
« Reply #72 on: August 11, 2005, 11:17:55 PM »
Well, since I already posted news.php file and that the results are the same, I can only determine that this file would need to be modified in order to match with global.php. The other possibility is that the paging system might be slightly different with v1.7.1 comparing to v1.7.

Offline ID25

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Re: [MOD]Another Simple News Publishing Mod
« Reply #73 on: August 11, 2005, 11:28:34 PM »
if i take global.php from version 1.7 and put to 1.7.1 it's ok?
or need to change something, what you say?

TheOracle

  • Guest
Re: [MOD]Another Simple News Publishing Mod
« Reply #74 on: August 11, 2005, 11:32:49 PM »
Quote

or need to change something


You'd definitely need to change something in news.php file in order to match with global.php. It cannot just simply be replaced.