Jump to content
natewlew

News Blog V1.0

Recommended Posts

This is the support thread for the News Blog V1.0.


Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites
This is the support thread for the News Blog V1.0.

 

Hi!

 

Seems like a promising contribution! :)

 

A couple of questions:

 

Does it have Anti Robot Registration Validation for the visitors input? If not, do you plan to incorporate it?

 

Does it have multi-language support in the Admin?

 

Visitors input, does it show immediately at the Front-end? If so, do you plan to add the approve first feature in the Admin?

Edited by kbking

Share this post


Link to post
Share on other sites

Looks like something I might try out.

 

I had a look at the code and install instructions and I couldn't figure out why you need to use

function tep_db_prepare_input2($string) {
if (is_string($string)) {
  return trim(stripslashes($string));
} elseif (is_array($string)) {
  reset($string);
  while (list($key, $value) = each($string)) {
	$string[$key] = tep_db_prepare_input($value);
  }
  return $string;
} else {
  return $string;
}
 }

 

It is only called once when a reply is about to be added to the DB and only on $content. It looks pretty similar to the already used tep_db_prepare_input() apart from and additional trim().

 

In addition to this I would add a few modifications like status (active, inactive) for news and replies. The replies should be set to inactive when posted and admin should receive a notification that a new reply has been added. He then can check in his admin to change the reply status.

 

And of course there should be a modification like visusal verify code to prevent automated replies but I guess that's something depending on the vvc contrib you are using to protect other pages like contact_us.

 

The multi-language support is certainly another thing to add.

 

abra


The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

 

Feedback and suggestions on my shop welcome.

 

Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.

Share this post


Link to post
Share on other sites

Thanks for your replies.

 

Does it have Anti Robot Registration Validation for the visitors input? If not, do you plan to incorporate it?

No it doesn't but, I do plan to add it.

 

Does it have multi-language support in the Admin?

I am not sure how to do that? I will have to see how I could do that.

 

Visitors input, does it show immediately at the Front-end? If so, do you plan to add the approve first feature in the Admin?

That would take the fun out of it. I could add something like that.

 

I had a look at the code and install instructions and I couldn't figure out why you need to use

The reason I did that is because the tep_db_prepare_input in the store functions replaces < with _. I wanted the comments form to allow <p>. So I took the tep_db_prepare_input form the admin functions.

 

In addition to this I would add a few modifications like status (active, inactive) for news and replies. The replies should be set to inactive when posted and admin should receive a notification that a new reply has been added. He then can check in his admin to change the reply status.

That does make sense.

 

I would also like to add configuration values but I am not sure how. If there is a tutorial somewhere please let me know.


Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites

Thanks for your reply. Then it makes sense with the tep_db_prepare_input2().

 

I took some time to check how to add those other features like multi-language and admin status change for news and comments which are very important for me as I run a dual language shop. From what I've seen and tried so far it makes sense to create three tables: news, news_description and news_replies. I've also renamed and added some more fields. Not sure if this is the way to go, it's just an attempt to have the contrib a bit more osC conform regarding naming conventions etc.

 

Once it's working to my satisfaction, I might post the package in the contrib section. Anyway, I appreciate your work so far as it gave me some basis to work from instead of inventing the whole thing myself.

 

abra

Edited by abra123cadabra

The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

 

Feedback and suggestions on my shop welcome.

 

Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.

Share this post


Link to post
Share on other sites

I'm not sure what to say but thank you.

But it needs some tweeking.

 

I'v instaled and rechecked everything several times but keep getting a premature end of headers script:news.php throught the admin.

 

heres the code:

<?php
/*
 $Id: news.php,v 1.29 2003/06/29 22:50:52 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
// create news article
 if ($HTTP_POST_VARS['new_news'] == 'new') {
$name = tep_db_prepare_input($HTTP_POST_VARS['name']);
$content = tep_db_prepare_input($HTTP_POST_VARS['content']);
 if ((empty($name)) || (empty($content))) {
	 $error = 'You must enter a value into the name and content.';
  } else {
 $date = date("Y-m-d G:i:s");
 $month_date = date("F Y");
 $sql_data_array = array('name' => $name,
						  'month_date' => $month_date,
						  'content' => $content,
						  'date_created' => $date);
  tep_db_perform(TABLE_NEWS, $sql_data_array);
  tep_redirect(tep_href_link(FILENAME_NEWS));
}
 }
// edit news article
 if ($HTTP_POST_VARS['edit_news'] == 'edit') {
  $id = (int)tep_db_prepare_input($HTTP_POST_VARS['id']);
  $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
  $content = tep_db_prepare_input($HTTP_POST_VARS['content']);
 if ((empty($name)) || (empty($content))) {
	 $error = 'You must enter a value into the name and content.';
  } else {
 $sql_data_array = array('name' => $name,
						  'content' => $content);
  tep_db_perform(TABLE_NEWS, $sql_data_array, 'update', "id = '" . (int)$id . "'");
  tep_redirect(tep_href_link(FILENAME_NEWS));
}
 }
// edit reply
if ($HTTP_GET_VARS['action'] == 'edit_reply') {
  $id = (int)tep_db_prepare_input($HTTP_POST_VARS['id']);
  $name = tep_db_prepare_input($HTTP_POST_VARS['name']);
  $content = tep_db_prepare_input($HTTP_POST_VARS['content']);
  $username = tep_db_prepare_input($HTTP_POST_VARS['username']);
 if ((empty($name)) || (empty($content))) {
	 $error = 'You must enter a value into the name and content.';
  } else {
 $sql_data_array = array('name' => $name,
						  'username' => $username,
						  'content' => $content);
  tep_db_perform(TABLE_NEWS_REPLYS, $sql_data_array, 'update', "id = '" . (int)$id . "'");
  tep_redirect(tep_href_link(FILENAME_NEWS, 'action=edit&id=' . $HTTP_GET_VARS['id']));
}
 }
// delete news article
 if ($HTTP_POST_VARS['delete'] == '1') {
 $id = (int)tep_db_prepare_input($HTTP_POST_VARS['id']);
  tep_db_query("delete from " . TABLE_NEWS . " where id= $id");
  tep_db_query("delete from " . TABLE_NEWS_REPLYS . " where news_id= $id");
 tep_redirect(tep_href_link(FILENAME_NEWS));
 }
// delete reply
 if ($HTTP_GET_VARS['action'] == 'delete_reply') {
 $id = (int)tep_db_prepare_input($HTTP_POST_VARS['id']);
  tep_db_query("delete from " . TABLE_NEWS_REPLYS . " where id= $id");
 tep_db_query('update ' . TABLE_NEWS . ' set replys = replys-1 where id = ' . (int)$HTTP_GET_VARS['id']);
 tep_redirect(tep_href_link(FILENAME_NEWS, 'action=edit&id=' . $HTTP_GET_VARS['id']));
 }
<?php
 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_NEWS);

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript" src="includes/general.js"></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php
require(DIR_WS_INCLUDES . 'header.php');
?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right">
	   <form action="<?php echo tep_href_link(FILENAME_NEWS); ?>" method="get">
	   <select name="month">
<?php
$date_query = tep_db_query("select distinct month_date from " . TABLE_NEWS . " order by month_date asc");
 while ($date = tep_db_fetch_array($date_query)) {
?>
	   <option value="<?php echo $date['month_date'] . '">' . $date['month_date']; ?></option>
<?php
}
?>
	   </select>
	   <input type="submit" value="Go">
	   </form></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
<?php
  if ($HTTP_GET_VARS['action'] == 'new') {
?>
   <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
   <form action="<?php echo tep_href_link(FILENAME_NEWS, 'action=new'); ?>" method="post">
<?php
  if ($error == true) { echo '<tr><td class="main" colspan="2"><font color="red">' . $error . '</font></td></tr>'; } 
?>
	  <tr>
	  <td class="main"><?php echo HEADING_NAME; ?></td>
			<td class="main"><input type="text" name="name" size="70"></td>
		  </tr>
		<tr valign="top">
		<td class="main"><?php echo HEADING_CONTENT; ?></td>
		<td class="main"><TEXTAREA NAME="content" COLS=70 ROWS=30></TEXTAREA></td>
		</tr>
		<tr>
		<td align="right"><input type="submit" value="Submit"><input type="hidden" name= "new_news" value="new"></td>
		<td> </td>
		</tr></form>
<?php
 } elseif ($HTTP_GET_VARS['action'] == 'edit') {
  $id = tep_db_prepare_input($HTTP_GET_VARS['id']);
  $news_query_raw = tep_db_query("select id, name, content from " . TABLE_NEWS . " where id = $id");
 $news = tep_db_fetch_array($news_query_raw);
?>
  <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
   <form action="<?php echo tep_href_link(FILENAME_NEWS, 'action=edit&id=' . $id); ?>" method="post">
<?php
  if ($error == true) { echo '<tr><td class="main" colspan="2"><font color="red">' . $error . '</font></td></tr>'; } 
?>
  <tr>
	  <td class="main"><?php echo NAME; ?></td>
			<td class="main"><input type="text" name="name" size="70" value="<?php echo $news['name']; ?>"></td>
		  </tr>
		<tr valign="top">
		<td class="main"><?php echo HEADING_CONTENT; ?></td>
		<td class="main"><TEXTAREA NAME="content" COLS=70 ROWS=30><?php echo $news['content']; ?></TEXTAREA></td>
		</tr>
		<tr>
		<input type="hidden" name="id" value="<?php echo $news['id']; ?>">
		<input type="hidden" name="edit_news" value="edit">
		<td> </td>
		<td align="left"><input type="submit" value="Edit"></form>
		<form action="<?php echo tep_href_link('news.php'); ?>" method="post">
		<input type="hidden" name="id" value="<?php echo $news['id']; ?>">
		<input type="hidden" name="delete" value="1">
		<input type="submit" value="Delete"></form></td>
		</tr>
<?php
 $reply_query = tep_db_query("select news_id from " . TABLE_NEWS_REPLYS . " where news_id = $id");
$reply = tep_db_fetch_array($reply_query);
  if ($reply == true)  { 
?>
	<tr>
	<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 $reply_query2 = tep_db_query("select * from " . TABLE_NEWS_REPLYS . " where news_id = $id");
  while ($reply2 = tep_db_fetch_array($reply_query2)) {
?>
		<form action="<?php echo tep_href_link(FILENAME_NEWS, 'action=edit_reply&id=' . $id); ?>" method="post">
		<tr>
		<td class="main"><?php echo HEADING_NAME; ?></td>
		<td class="main"><input type="text" name="name" size="70" value="<?php echo $reply2['name']; ?>"></td>
		</tr>
		<tr>
		<td class="main"><?php echo HEADING_USERNAME; ?></td>
		<td class="main"><input type="text" name="username" size="70" value="<?php echo $reply2['username']; ?>"></td>
		</tr>
		<tr>
		<td class="main"><?php echo HEADING_EMAIL; ?></td>
		<td class="main"><?php echo $reply2['email']; ?></td>
		</tr>
		<tr valign="top">
		<td class="main"><?php echo HEADING_CONTENT; ?></td>
		<td class="main"><TEXTAREA NAME="content" COLS=70 ROWS=10><?php echo $reply2['content']; ?></TEXTAREA></td>
		</tr>
		<tr>
		<input type="hidden" name="id" value="<?php echo $reply2['id']; ?>">
		<td> </td>
		<td align="left"><input type="submit" value="Edit"></form>
		<form action="<?php echo tep_href_link(FILENAME_NEWS, 'action=delete_reply&id=' . $id); ?>" method="post">
		<input type="hidden" name="id" value="<?php echo $reply2['id']; ?>">
		<input type="submit" value="Delete"></form></td>
		</tr>
		<tr>
	<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}
}
} else {
?>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"><?php echo HEADING_DATE_CREATED; ?></td>
			<td class="dataTableHeadingContent"><?php echo HEADING_NAME; ?></td>
			<td class="dataTableHeadingContent" align="right"></td>
		  </tr>
<?php
 if (isset($HTTP_GET_VARS['page']) && ($HTTP_GET_VARS['page'] > 1)) $rows = $HTTP_GET_VARS['page'] * MAX_DISPLAY_SEARCH_RESULTS - MAX_DISPLAY_SEARCH_RESULTS;
 $rows = 0;
 $products_query_raw = "select id, date_created, name, replys, content from " . TABLE_NEWS;
 if ($HTTP_GET_VARS['month'] == true) {
  $products_query_raw .= " where month_date = '" . $HTTP_GET_VARS['month'] . "'";
}
$products_query_raw .= " order by date_created DESC";
 $products_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $products_query_raw, $products_query_numrows);
 $products_query = tep_db_query($products_query_raw);
 while ($products = tep_db_fetch_array($products_query)) {
$rows++;

if (strlen($rows) < 2) {
  $rows = '0' . $rows;
}
?>
		  <tr class="dataTableRow">
			<td class="dataTableContent"><?php echo tep_date_short($products['date_created']); ?></td>
			<td class="dataTableContent"><u><?php echo '<a href="' . tep_href_link(FILENAME_NEWS, 'action=edit&id=' . $products['id'] . '&page=' . $HTTP_GET_VARS['page'], 'NONSSL') . '">' . $products['name'] . '</a></u>'; ?></td>
			<td class="dataTableContent" align="center"><?php echo HEADING_REPLIES; ?> <?php echo $products['replys']; ?> </td>
		  </tr>
<?php
 }
?>
		</table></td>
	  </tr>
	  <tr>
		<td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td class="smallText" valign="top"><?php echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
			<td class="smallText" align="right"><?php echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>
		  </tr>
		  <tr>
		  <td align="right" class="main">
		  <?php if ($HTTP_GET_VARS['update'] == 'true') { echo '<font color="green">' . HEADING_SUCCESS . '</font>   '; } elseif ($HTTP_GET_VARS['update'] == 'false') { echo '<font color="red">' . HEADING_FAILED . '</font>   '; } ?><a href="<?php echo tep_href_link('create_rss.php'); ?>"><u>Create RSS</u></a>    <?php echo '<a href="' . tep_href_link(FILENAME_NEWS, 'action=new"><u>New Article</u></a>'); ?></td>
		 </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
</table></td>
<!-- body_text_eof //-->
 </tr>
</table>
<!-- body_eof //-->
<?php
}
?>

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

would be nice if someone could tellme why

Share this post


Link to post
Share on other sites
getting a premature end of headers script:news.php

 

I am not sure what the problem is. Maybe is a server issue. I found a post where someone had a problem with wordpress and this was the reply:

try chmodding your folders 755 and the files 644 once, maybe?

 

Oh. 1 more thing, you forgot to add instuction on how to add button for rss

 

If you upload the rss.png to images/, it should show up on your storefronts news.php.


Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites
I am not sure what the problem is. Maybe is a server issue. I found a post where someone had a problem with wordpress and this was the reply:

If you upload the rss.png to images/, it should show up on your storefronts news.php.

Thank you that worked.

 

next problem;

 

when I hit create rss it tells me cant write to rss.xml cdmod needs to be777

it is 777

 

and on the page news.php the one everyone can read and write to if the hit the rss button

I get:

 

The XML page cannot be displayed

Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.

 

 

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

 

XML document must have a top level element. Error processing resource 'http://thedecoreshoppe.com/rss.xml'.

 

But believe that is the problem it the rss,xml in admin that cant write to it even though it set to 777

Share this post


Link to post
Share on other sites

I though some people would have trouble with the create_rss.php. I have a test to see if the rss.xml is writeable and wasn't sure if it would work on all servers. Download this file and replace it with your admin/create_rss.php.

 

shiplinux.com/extra/create_rss.php.txt

Edited by natewlew

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites
I though some people would have trouble with the create_rss.php. I have a test to see if the rss.xml is writeable and wasn't sure if it would work on all servers. Download this file and replace it with your admin/create_rss.php.

 

shiplinux.com/extra/create_rss.php.txt

gREAT that did the trick with the create rss.

Thank you.

 

However, It didn't fix the problem with the subscribe function. still get the same error

The XML page cannot be displayed 
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. 


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

XML document must have a top level element. Error processing resource 'http://thedecoreshoppe.com/rss.xml'.

Share this post


Link to post
Share on other sites
gREAT that did the trick with the create rss.

Thank you.

 

However, It didn't fix the problem with the subscribe function. still get the same error

 

That error means there is nothing in the rss.xml. Make sure the rss.xml permissions are writeable by your webserver (chmod 777).

Edited by natewlew

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites
That error means there is nothing in the rss.xml. Make sure the rss.xml permissions are writeable by your webserver (chmod 777).

Well I found the problem but not sure how to fix it.

When I create rss in admin with the new create_rss.php you gave me. It creates a file in the OSCommerce main folder where the catolog folder is and it names it catologrss.xml. instead of writing it to the rss.xml file in catolog folder.

 

here is the code for the create_rss.php

<?php
require('includes/application_top.php');

  //$filename = DIR_FS_DOCUMENT_ROOT . FILENAME_RSS;
//if (is_writable($filename)) {

 // open a file pointer to an RSS file
 $fp = fopen (DIR_FS_DOCUMENT_ROOT . FILENAME_RSS, "w");

 // Now write the header information
 fwrite ($fp, "<?xml version='1.0' ?><rss version='2.0'><channel>”);

 fwrite ($fp, “<title>Your Title</title>");

 fwrite ($fp, "<link>" . HTTP_SERVER . "</link>");

 fwrite ($fp, "<description>Your description</description>");

 fwrite ($fp, "<language>en-us</language>");

 fwrite ($fp, "<docs>" . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_RSS . "</docs>");

  $news_query_raw = tep_db_query("select * from " . TABLE_NEWS . " order by id desc limit 10");
   while ($content_rec = tep_db_fetch_array($news_query_raw)) {
	fwrite ($fp, "<item>");

	$headline = $content_rec['name'];
	$date = 'Date: ' . tep_date_short($content_rec['date_created']);
	$content_1 = substr($content_rec['content'], 0, 250);
	$content = strip_tags($content_1);
	if (strlen($content_rec['content']) > 250) {
		$content = $content . "....";
	}
	fwrite ($fp, "<title>$headline</title>");
	fwrite ($fp, "<pubDate>$date</pubDate>");
	fwrite ($fp, "<description>$content</description>");
	$item_link = HTTP_SERVER . DIR_WS_CATALOG . FILENAME_NEWS . "?article=" . $content_rec['id'];
	fwrite ($fp, "<link>$item_link</link>");

	fwrite ($fp, "</item>");
}

   fwrite ($fp, "</channel></rss>");
fclose ($fp);

  tep_redirect(tep_href_link(FILENAME_NEWS, 'update=true'));
// } else {
  // tep_redirect(tep_href_link(FILENAME_NEWS, 'update=false'));
// }

?>

 

so I'm totaly confused

Share this post


Link to post
Share on other sites

Your store isn't in the catalog folder. Open your admin/includes/configure.php.

 

define('DIR_FS_DOCUMENT_ROOT', '/your~path/www/');

 

Make sure yours doesn't have catalog in it and the DIR_FS_DOCUMENT_ROOT has the correct path.

 

That is weird that it would create a catalogrss.xml.


Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites
Your store isn't in the catalog folder. Open your admin/includes/configure.php.

Make sure yours doesn't have catalog in it and the DIR_FS_DOCUMENT_ROOT has the correct path.

 

That is weird that it would create a catalogrss.xml.

 

Well bless my soul...lol... that worked!

Although I had t change back to the original create_rss.php. Everything works great! I thank you!

Share this post


Link to post
Share on other sites

Nice to know that you got it working. I forget to put instructions in the read me about adding a link to your storefront.

 

Open /catalog/includes/boxes/information.php and find this line:

 

'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');

 

Change it to this:

 

'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>

<br><a href="' . tep_href_link(FILENAME_NEWS) . '">News</a>');


Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites

I have added:

 

Multi-Language support

Anti-spam

Admin reply approval

Reply Notification

Admin Configuration

 

I have add the features you requested.


Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites

I am getting a simalar error on my V 1.0 install? http://www.asapcustoms.com/catalog/rss.xml

http://www.asapcustoms.com/catalog/news.php

 

Please help - see error - I created no whitespace?

 

Whitespace is not allowed at this location.

Line: 3 Character: 271

 

fwrite (Resource id #39, “<title>Your Title</title><link>http://www.asapcustoms.com</link><description>Your description</description><language>en-us</language><docs>http://www.asapcustoms.com/catalog/rss.xml</docs><item><title>Did you know we offer shop equipment & work tools at asapcustoms</title><pubDate>Date: 01/01/2007</pubDate><description>ASAP Customs not only offers performance and body parts but also hundreds of popular tools. From now until 04/01/07 get 10% off all the items in our air tools category.</description><link>http://www.asapcustoms.com/catalog/news.php?article=1</link></item></channel></rss>

Share this post


Link to post
Share on other sites

I don't know why you are getting that error. I does seem like it is writing the information to the rss.xml.

 

If you update to 1.2 you will have a dynamic rss that you don't need to create. All you have to do is delete the news and news_replys table and replace the files you have and run the news.sql. You will only loose the two articles that you have.


Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites
I have added:

 

Multi-Language support

Anti-spam

Admin reply approval

Reply Notification

Admin Configuration

 

I have add the features you requested.

 

Thanks, Nate!

 

This is exactly what I wished for! I really appreciate your time and effort! :)

Share this post


Link to post
Share on other sites

One thing! I'm not using language_id of 1, 2 and 3 but instead language_id of 4, 5 and 1, in that order. I can see that I have to change it accordingly in the table news_description in the database. But I'm not sure about the file admin/news.php. Would you mind explain that to me, thank you!

Edited by kbking

Share this post


Link to post
Share on other sites

Open up the /catalog/admin/news.php:

$sql_data_array = array( 'news_id' => $news_id,

'language_id' => '1',

'name' => $name1,

'content' => $content1);

tep_db_perform(TABLE_NEWS_DESC, $sql_data_array);

 

$sql_data_array = array( 'news_id' => $news_id,

'language_id' => '2',

'name' => $name2,

'content' => $content2);

tep_db_perform(TABLE_NEWS_DESC, $sql_data_array);

 

$sql_data_array = array( 'news_id' => $news_id,

'language_id' => '3',

'name' => $name3,

'content' => $content3);

tep_db_perform(TABLE_NEWS_DESC, $sql_data_array);

 

You see the 'language_id' => '1'. That is the first box when you create an article. Then the next one 'language_id' => '2'. That is the second box when you create an article. If you are using 1,4 and 5. Change the 2 to a 4 and 3 to a 5.

 

You could also open the languages table with phpmyadmin and change the id's on the table.

 

Sorry I really don't know how to setup the languages. There isn't a manual that I know of? I guess I could add the language id's to the configuration table.


Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites

There is more you will have to change in the admin/news.php. Look a little lower:

$sql_data_array = array('name' => $name1,

'content' => $content1);

tep_db_perform(TABLE_NEWS_DESC, $sql_data_array, 'update', "news_id = '" . (int)$id . "' and language_id = '1'");

 

$sql_data_array = array('name' => $name2,

'content' => $content2);

tep_db_perform(TABLE_NEWS_DESC, $sql_data_array, 'update', "news_id = '" . (int)$id . "' and language_id = '2'");

 

$sql_data_array = array('name' => $name3,

'content' => $content3);

tep_db_perform(TABLE_NEWS_DESC, $sql_data_array, 'update', "news_id = '" . (int)$id . "' and language_id = '3'");

See where is says and language_id = '1'"); and and language_id = '2'"); etc... Change those numbers just like you did one the first on.

 

Now go down a little further:

$news1_query_raw = tep_db_query("select name, content from " . TABLE_NEWS_DESC . " where language_id = '1' and news_id = '" . $id . "'");

$news1 = tep_db_fetch_array($news1_query_raw);

You will find this 3 times with the language_id = 1 then 2 then three. Change those to your id's.

 

This is the only file you will have to change. Alternatively you could change the language id's with the instructions below.

 

Open the languages table with phpmyadmin and change the id's on the table. Once your in phpmyadmin click on Languages (on the left). Then click on browse (at the top). You will now see three columns. If you click on the pencil you can edit the language_id to what you what. Change 2 to 4 and 5 to 3.

Edited by natewlew

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites

I have added an update for language id's. It has update instructions inside.

 

I accidentally put 1.0 instead of 1.2. My mistake.


Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×