Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Article Manager v1.0


RobAnderson

Recommended Posts

just one question though,

 

How can i align the text displayed in the articles and authors boxes, to the right?

Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Link to comment
Share on other sites

Hi Kristofer, in response to:

just one question though,

 

How can i align the text displayed in the articles and authors boxes, to the right?

To right align the text entries in the Authors box (presuming it's set in the configuration to display as a list, not a drop-down), in catalog/includes/boxes/authors.php, replace line 37 with:

      $info_box_contents[] = array('align' => 'right', 'text' => $authors_list);

To right align the text entries in the Articles box, in catalog/includes/boxes/articles.php, replace line 179 with:

  $info_box_contents[] = array('align' => 'right', 'text' => $new_articles_string . $all_articles_string . $topics_string);

That should fix them ;-)

 

Rob

Link to comment
Share on other sites

Hey Rob...

 

First off, great contrib. This is a very good example of just how versatile osCommerce really is. Good Job.

 

I have a few suggestions for you...

 

1. Article Submission

It would be a great feature to have for those that would use it. Should have the choice to have Admin review of all submissions before the artcile gets posted.

 

2. Authors Listing Page

Just a simple list with some basic stats about the Author, such as name, number of Articles written/published, link to Authors article listing page, etc.

 

3. More Information about the Author

I like the idea of having an Image associated with the Author, whether it be a photo or graphic. I would also like to see things like location of Author, Company Name (if any), email address, contact info, etc.

 

Let me know what you think.

 

-R

Link to comment
Share on other sites

I thought of a few more suggestions...

 

4. Most Viewed or Top 10 Article/Topic List

 

5. Conditions for long Articles.

If the Article runs long, it would be a great feature to limit the number of lines/words per page and have the rest of the article show up on additional pages. Otherwise, the length of the Article can cause the page itself to get very long and starts to effect page layout.

 

6. Featured Articles and/or Topics.

An additional Content box that would appear on a given page, lets say index.php, that would have the Article Title, Author, Publish Date and a truncated peice of the beginning of the article.

 

7. A Printer-friendly link on the Article Page to view and print the Article.

 

If I think of anymore, I will post them.

 

-R

Link to comment
Share on other sites

Hi all,

 

Just downloaded the new updated articles manager and installed to new ms2.

 

works well, BUT I have found some bugs..

 

I have created one topis and two SUB TOPICS and this is what I get.

 

Warning: Division by zero in c:\program files\easyphp1-7\www\new_install\articles.php on line 139

 

line 139 has:

$width = (int)(100 / MAX_DISPLAY_TOPICS_PER_ROW) . '%';

where is the MAX_DISPLAY_TIPIC_PER_ROW?

 

I can't find it..

 

 

 

test 23

Edited by Salvo
Link to comment
Share on other sites

Salvo...

 

You are right, I got the same error while testing. When a "parent" Topic has 2 or more Sub-Topics, you get the "Division By Zero" error.

 

Here is why it happens and how to fix it...

 

REASON:

The section of code that causes the error is trying to calculate using a Configuration Value that IS NOT there.

 

There is no MAX_DISPLAY_TOPICS_PER_ROW as a configuration option included with this contrib. Yet, that is what its trying to use to calculate.

 

SOLUTION:

 

Run the folowing MySQL statement to INSERT the MAX_DISPLAY_TOPICS_PER_ROW configuration option...

INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'Topics To List Per Row', 'MAX_DISPLAY_TOPICS_PER_ROW', '3', 'How many Topics to list per row?', 456, 4, now(), now(), NULL, NULL);

That will fix the error.

 

davidturetsky...

 

Yes, this can be used as a News Center. Some renaming of the Heading Titles and you should be good to go. As far as content display on the main page, I suggested that possibility earlier. Depending on your experience level, you could probably add this option yourself. The information is in the database, its just a matter of extracting the data and displaying it.

 

Hope this helps.

 

-R

Link to comment
Share on other sites

Hi Salvo, in response to your bug:

I have created one topis and two SUB TOPICS and this is what I get.

 

Warning: Division by zero in c:\program files\easyphp1-7\www\new_install\articles.php on line 139

 

line 139 has:

$width = (int)(100 / MAX_DISPLAY_TOPICS_PER_ROW) . '%';

where is the MAX_DISPLAY_TIPIC_PER_ROW?

 

I can't find it..

This is a bug. Thanks for finding it ;-)

 

I hadn't tested below the level of sub-topics (bad Robert), and on the third or deeper levels, you will get the error you mentioned.

 

The recommended fix is in catalog/articles.php, comment out or delete lines 133 to 145, i.e. the ones shown below:

//    $number_of_topics = tep_db_num_rows($topics_query);
//
//    $rows = 0;
//    while ($topics = tep_db_fetch_array($topics_query)) {
//      $rows++;
//      $tPath_new = tep_get_path($topics['topics_id']);
//      $width = (int)(100 / MAX_DISPLAY_TOPICS_PER_ROW) . '%';
//      echo '                <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_ARTICLES, $tPath_new) . '">' . tep_image(DIR_WS_IMAGES . $topics['topics_image'], $topics['topics_name'], SUBTOPIC_IMAGE_WIDTH, SUBTOPIC_IMAGE_HEIGHT) . '<br>' . $topics['topics_name'] . '</a></td>' . "\n";
//      if ((($rows / MAX_DISPLAY_TOPICS_PER_ROW) == floor($rows / MAX_DISPLAY_TOPICS_PER_ROW)) && ($rows != $number_of_topics)) {
//       echo '              </tr>' . "\n";
//       echo '              <tr>' . "\n";
//      }
//    }

As MAX_DISPLAY_TOPICS_PER_PAGE is no longer used, you can safely ignore it.

 

That should enable the sub-sub-topic page, description and any articles to load properly.

 

One other thing I noticed is that there is a broken image in the top right-hand corner of any sub-sub-topic page. This was not intended as any topic images should only be enabled through additions in the WYSIWYG Editor.

 

So, if this is bugging you, here's the fix:

 

In catalog/articles.php, line 92, replace:

            <td valign="top" class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $topic['topics_image'], $topic['topics_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

with

            <td valign="top" class="pageHeading" align="right"></td>

This effectively removes the broken image reference but leaves the cell intact.

 

Hope this helps, thanks for your feedback

 

Regards, Rob

 

P.S. I will accumulate a few more bugs before rolling this fix into the next version. For others that have installed version 1.0 or 1.1, then these fixes are only necessary if you intend to have levels deeper than one sub-topic. Otherwise, you will probably never see them.

Link to comment
Share on other sites

Thanks Randy, for your alternative solution to Salvo's problem.

Here is why it happens and how to fix it...

 

REASON:

The section of code that causes the error is trying to calculate using a Configuration Value that IS NOT there.

 

There is no MAX_DISPLAY_TOPICS_PER_ROW as a configuration option included with this contrib. Yet, that is what its trying to use to calculate.

 

SOLUTION:

 

Run the folowing MySQL statement to INSERT the MAX_DISPLAY_TOPICS_PER_ROW configuration option...

 

CODE 

INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('', 'Topics To List Per Row', 'MAX_DISPLAY_TOPICS_PER_ROW', '3', 'How many Topics to list per row?', 456, 4, now(), now(), NULL, NULL);

 

That will fix the error.

Gotta love this forum, spoilt for choice!

 

I guess it depends on whether you need topic links from within the sub-topic pages or whether you intend to rely on the Articles Box for navigation. Your fix would enable them in the page, mine would remove them.

 

As I haven't given much thought as to how these would be formatted, and the fact that I deliberately stripped topic images out of the articles page (or thought I had), means that the normal categoreis/image type layout may not work so well in this case.

 

Plenty of room for others to contribute ideas...

 

Regards, Rob

Link to comment
Share on other sites

Looks like I found another issue with the sub-Topic Listing. After the above fix is applied, the Sub-Topics are listed without error. But, if you click on the Sub-Topic Link, you are taken to the All Articles page.

 

If you mouseover the Sub-Topic, you will see the link URL displayed in the status bar of your browser. There, it shows a link URL of...

 

http://www.domainname.com/catalog/articles.php?cPath=3

 

I have searched throughout the code for this contrib and cannot find any reference to $cPath anywhere. So where is this coming from?

 

Any ideas?

 

-R

Link to comment
Share on other sites

Hi Randy, thanks a lot for your considered feedback. I'm overwhelmed with the response so far and the great ideas keep coming ;-)

 

Here are some quick responses to your suggestions:

1. Article Submission

It would be a great feature to have for those that would use it. Should have the choice to have Admin review of all submissions before the artcile gets posted.

This is an interesting one, because my orginal intention was to have only articles posted by the site administrator or selected contributors (in which case the administrator would input them). I didn't see the contribution going the way of a"community" newsboard, like PHP-Nuke, but...

 

I may leave this for someone who wants this as a variation, e.g Article Contributor?? Still if it was built in as an option, then you could take it or leave it I guess.

2. Authors Listing Page

Just a simple list with some basic stats about the Author, such as name, number of Articles written/published, link to Authors article listing page, etc.

Yes, this is a definite and was in fact next on my list of enhancements. So look for this in Version 2, but please if anybody wants to offer this as an add-on, please do so in the meantime. My thoughts are to add in a meta-description field in the authors_info table (to support languages) and use this as an abstract in the same way that I do for articles. Shouldn't be too difficult.

 

Question: where to link from, the Authors box (messy if using drop-down) or the Articles box (probably better, e.g. Author List). Thoughts?

3. More Information about the Author

I like the idea of having an Image associated with the Author, whether it be a photo or graphic. I would also like to see things like location of Author, Company Name (if any), email address, contact info, etc.

This is possible right now by using the WYSIWG Editor and the Author description field. Admittedly, it is not laid out prescriptively, so you would have to do all the formatting yourself, but it does support images, links, etc.

 

As for building in more fields for the Author, the advantage would be that it makes it easier for people to add and keep consistent, but it then limits the flexibility with which you may choose to display it. Always trying to find that balance!!!

4. Most Viewed or Top 10 Article/Topic List

Good idea. Probably a bit beyond my skills at the moment unless I can find a good contribution to copy from (which is all I really do anyway!). Know of any like this?

 

Also, where would you see this being displayed. As a module to plonk anywhere?

5. Conditions for long Articles.

If the Article runs long, it would be a great feature to limit the number of lines/words per page and have the rest of the article show up on additional pages. Otherwise, the length of the Article can cause the page itself to get very long and starts to effect page layout.

Hmmm, hadn't thought of that! Again, great idea and I could see the use for it. Any suggestions of contributions that do similar things? I know how the article listing works now in terms of splitting article lists up over several pages, but that works on records, not charachters within a record.

6. Featured Articles and/or Topics.

An additional Content box that would appear on a given page, lets say index.php, that would have the Article Title, Author, Publish Date and a truncated piece of the beginning of the article.

Yes, good idea for a module. And given we have an already made article abstract, it would be just a matter of using a random function to choose an appropriate article. I'll put this on my list for Version 2.

 

Another thought I had kinda related was to merge Article reviews with Product reviews using the same box..

7. A Printer-friendly link on the Article Page to view and print the Article.

Thought about this too, but put it down for later. I'm pretty handy with style sheets so could develop a print media version or alternatively look at modifying the excellet PDF datasheet to display the article in PDF format. Now that would be cool!

Fair bit of development time for either one...When will I sleep?

 

Here's an ideas for anybody with search engine experience. How to incorporate the option to search either products, articles or both in the search feature (simple and/or advanced). Any takers??

 

Great ideas, keep them coming.

 

My priority is on fixing bugs at the moment, but I will definetly incorporate all ideas I can into the next major upgrade (Version 2 - won't be before end of year sorry).

 

Cheers, Rob

Link to comment
Share on other sites

Hi Randy, in response to your hunt for cPath:-)

Looks like I found another issue with the sub-Topic Listing. After the above fix is applied, the Sub-Topics are listed without error. But, if you click on the Sub-Topic Link, you are taken to the All Articles page.

 

If you mouseover the Sub-Topic, you will see the link URL displayed in the status bar of your browser. There, it shows a link URL of...

 

http://www.domainname.com/catalog/articles.php?cPath=3

 

I have searched throughout the code for this contrib and cannot find any reference to $cPath anywhere. So where is this coming from?

$cPath in this case should be $tPath (I renamed everything I could to try and distinguish between categories c and topics t), but is generated from the wrong function, i.e. it is using the generic tep_get_path instead of tep_get_topic_path on line 138 of catalog/articles.php, i.e.

 

      $tPath_new = tep_get_path($topics['topics_id']);

should be

      $tPath_new = tep_get_topic_path($topics['topics_id']);

 

Try that. It does now generate a proper link to the child topic with no cPath in the URL.

 

As mentioned earlier, I think the formatting of these links is poor and not well suited for moving between article topics. An alternative is to try my fix and do away with these links altogether.

 

Rob

 

P.S. Do you guys really need three or more levels of articles???

Link to comment
Share on other sites

$cPath in this case should be $tPath (I renamed everything I could to try and distinguish between categories c and topics t), but is generated from the wrong function, i.e. it is using the generic tep_get_path instead of tep_get_topic_path on line 138 of catalog/articles.php, i.e.

 

 ? ? ?$tPath_new = tep_get_path($topics['topics_id']);

should be

 ? ? ?$tPath_new = tep_get_topic_path($topics['topics_id']);

 

Try that. It does now generate a proper link to the child topic with no cPath in the URL.

Woudnt, this have been fixed anyway, when those lines were deleted with your earlier fix?

 

Yeh, anyway, thanks for that allignment stuff, worked really well.

 

Its a great mod,

 

Thanks again

 

Kristofor

Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Link to comment
Share on other sites

Hi David, regarding your question:

Yes, excellent contrib. Also, could you purpose this as a news center as well? And, have the ability to publish content to the main page, or an articles page.

I see no reason why not. In fact, based on other feedback, I'm getting a strong indication that a range of different modules might be in order to display articles in a range of different ways, e.g. simple articles listing for Home Page news feature, or Top 10 articles including number of times viewed.

 

I will look at developing a few of these for Version 2 in the New Year. I simply don't have the time at the moment unfortunately.

 

However, the basis of a module is in the catalog/articles_new.php page. You would just need to chop out the article listing part and then format it to suit. It could then be included in your Home Page quite easily.

 

Regards, Rob ;-)

Link to comment
Share on other sites

Hi Kristofer, regarding your query:

Woudn't, this have been fixed anyway, when those lines were deleted with your earlier fix?

Yes it would. This fix is only required if you wish to display links to child-topics. Otherwise, just delete or comment them out and you won't have to worry about it.

 

Glad to hear your alignment is sorted ;-)

 

Rob

Link to comment
Share on other sites

Rob... That was it. The Sub-Topic Link issue is fixed.

Excellent, I haven't had much experience with deep sites and multiple levels, so this was new for me (hence my shallow testing ;-).

 

Just curious, I noticed there aren't similar links from the top level topics nor links going up to parent levels, so how useful is this (or have I hacked the default page too much - never did get my head around how it worked entirely!!!)

 

Rob

Link to comment
Share on other sites

Hello!

 

This is a great contribution and I absolutely love it! A big thank you to our article contributor Rob!

 

Ok everything seems to work fine on catalog site (implemented changes previously mentioned).

 

Only 1 problem - a bug maybe?

 

When i try and delete a Topic folder with an article in it I get the following error message:

 

1146 - Table 'shop.table_additional_article_images' doesn't exist

delete from TABLE_ADDITIONAL_ARTICLE_IMAGES where articles_id = '2'

[TEP STOP]

 

I cannot figure out why this is happening - I did use your sql file and phpmyadmin "successfully" inserted it into the database?

 

Any ideas?

 

BTW Thanx again Rob! and other members for great contrib/trouble shooting!

 

Regards

 

Jiten

Link to comment
Share on other sites

Hi Jiten, in response to the problem deleting a topic:

Only 1 problem - a bug maybe?

 

When i try and delete a Topic folder with an article in it I get the following error message:

 

1146 - Table 'shop.table_additional_article_images' doesn't exist

delete from TABLE_ADDITIONAL_ARTICLE_IMAGES where articles_id = '2'

[TEP STOP]

I cannot figure out why this is happening - I did use your sql file and phpmyadmin "successfully" inserted it into the database?

 

Any ideas?

Yes this is a bug.

 

To fix, in admin/includes/functions/articles.php, delete line 307, i.e.

    tep_db_query("delete from " . TABLE_ADDITIONAL_ARTICLE_IMAGES . " where articles_id = '" . (int)$article_id . "'");

That should enable topics that contain articles to be deleted successfully.

 

Thanks for your help.

 

Regards, Rob

 

P.S. I'll roll this into v1.2 soon.

Link to comment
Share on other sites

Hi Lonnie, regarding plans for searching...

Is there currently a way or plans to make a way for the articles to be searchable?  I am going to use it as a knowledgebase and this would be the only thing missing.

I am working on this now and it will be along the lines of the products search, e.g. via a Search Articles box (optional) or a more advanced Search Articles page (with options to filter searches by topics, authors and dates).

 

Basically a hack of the MS2 search facility ;-)

 

I've done most of it, just need to tidy up a few things (search results) and test.

 

Before I post, do you or others have any requests for what would be included in the search results, e.g. I'm thinking Article Name (duh), Author and Date Added. Do we need Topic and an Article Abstract?? Also, should I make these options that you can turn on or off in the admin like the basic article listing?

 

Thoughts appreciated.

 

Rob ;-)

Link to comment
Share on other sites

Hey Rob...

 

In regards to searching, I think it should search EVERYTHING! This includes all Topics, Articles, Authors and associated descriptions and Titles. The more info that can be included in the search, the more comprehensive the result. And no, I don't think these should be controlled in Admin. It should be a given that everything gets searched.

 

Just my $.02

 

-R

Link to comment
Share on other sites

Is this search going to provided via an infobox? If there is a choice I would vote for having a page with a search box at the top and the article folders below. Also a back button would be great for the article pages. I picture something like the image below (search box was taken from Invision Board). Just an idea.

 

article_manager.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...