Main
Index
Search
Posts
Who's
Online
Log
In

Home: Discontinued/Classic Products: Article Manager 1:
Last three articles

 

 


steve_e
User

Oct 5, 2006, 7:38 AM

Post #1 of 13 (5490 views)
Shortcut
Last three articles Can't Post

Hi -
This is probably very lazy and I should figure it out myself, but I'm finding it difficult to see how to do this:

I want the last three articles published to show up on my front page. Not one from each category, just the last three dated articles from a specified subset of categories.

Sometimes they may all be from one category, sometimes spread across two or three. I'd like also to be able to say which categories I want them to be taken from and which I don't.

Does that make sense?

Regards, Steve.


ross
Staff / Moderator


Oct 5, 2006, 10:40 AM

Post #2 of 13 (5484 views)
Shortcut
Re: [steve_e] Last three articles [In reply to] Can't Post

Hi Steve.

Thanks for posting!

There are a couple different options here. The first is that you could use an include on your front page that does a search and returns the most recent articles in your system. You can even tell this search to only look in a specific set of articles. Now, the articles that appear will keep themselves updated as you add to your site. To change what categories are use though, you would need to update the include on your template.

The second option would be to use the featured article box in your Article Editor. This one would also use an include on your front page, however, it would be set to just display the articles that are set as featured. You would change the articles that appear by unchecking the old ones and checking off new ones.

How does that sound? If you let me know which option you like best, I can break it down into more detail. I look forward to hearing from you Smile.
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com

Hire me!  Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/



steve_e
User

Oct 6, 2006, 2:21 AM

Post #3 of 13 (5474 views)
Shortcut
Re: [ross] Last three articles [In reply to] Can't Post

Hi Ross -
Thanks for this. The first option sounds best to me - if you don't mind posting some detail I'd be grateful. I'll have a play around in the meantime, but although I can see how to limit the search to particular categories from the documentation, I can't immediately see how to search by date within those categories!

Regards, Steve.


ross
Staff / Moderator


Oct 8, 2006, 8:58 AM

Post #4 of 13 (5455 views)
Shortcut
Re: [steve_e] Last three articles [In reply to] Can't Post

Hi Steve.

Thanks for getting back to me!

You’ll find that Article Manager is already set to sort the articles based on date, so that part should be happening already. To get a list of the three most recent articles from a specific set of categories showing up, you’ll just need to put a variation of the following include on your page:


Code
<!--#include virtual=”/cgi-bin/artman/exec/search.cgi?search=1&template=search/recent_articles.html&cat=1,2,3,4,5,6


Now, the reason I say a variant of this is because you’ll need to make a few adjustments. First off, make sure the path to your search engine is accurate. Second, the list of categories you want to search through. Have a look at this part:

cat=1,2,3,4,5,6

Just change the list of numbers to the category numbers you wanted to search in. You can find out a category’s number by going to the Category editor and clicking modify for the category. On the page that comes up, have a look at the URL. It’s going to look something like this:

www.yoursite.come/cgi-bin/artman/exec/admin.cgi?cat_edit=7

That 7 at the end is the category number. You can have as many numbers in your list as you like.

One last thing is the template= part. The reason I have that in there is because you’ll want these results to be using a template that only shows the articles instead of all the extra things like category list and headlines file that a search results page shows. I have attached a sample copy of the template I normally use for this kind of setup. Just upload that to your /templates/search folder and you should be good to go.

Does that all make sense? Give it a shot and let me know how you make out Smile.
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com

Hire me!  Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Attachments: recent_articles.html (3.30 KB)


steve_e
User

Oct 9, 2006, 12:25 PM

Post #5 of 13 (5439 views)
Shortcut
Re: [ross] Last three articles [In reply to] Can't Post

Hi Ross -
Thanks for this. I'm feeling a bit stupid at the moment - can't quite make it work. I don't use ssi includes very often (most of my site is php) so I don't know if I've done everything properly.

I've got the contents of your attached file in the search folder with the name recent_articles.html. I've got a file called indexinclude3.shtml in my site's root folder with this line in it:

<!--#include virtual=”/cgi-bin/interact/exec/search.cgi?search=1&template=search/recent_articles.html&cat=1,2,3,4,5,6 -->

(my article manager directory is called interact for reasons too ancient to bring to mind now...).

I assume I need to give the file an shtml extension as it's using includes?

I've tried a number of variations of this, and also tried a php include, and I've had a number of different responses, but nothing giving a simple list of recent articles. I'm pretty clueless about this sort of thing though, so I'm happy for you to get exasperated!

The effect I'm getting at the moment is nothing - the source file doesn't show any evidence of the search script.

Regards, Steve.


Donna
Staff / Moderator


Oct 9, 2006, 3:39 PM

Post #6 of 13 (5436 views)
Shortcut
Re: [steve_e] Last three articles [In reply to] Can't Post

Hi Steve,

If you're using a PHP include, try this:

<?php include('/full/server/path/to/search.cgi?search=1&template=search/recent_articles.html&cat=1,2,3,4,5,6'); ?>

Make sure that for the full server path, you're using the full path from the root of the server, usually something like /users/home/www/html/ and so on.

One thing I notice in your quoted code is that you're missing the closing " from the end. So, it would be:

<!--#include virtual="/cgi-bin/interact/exec/search.cgi?search=1&template=search/recent_articles.html&cat=1,2,3,4,5,6" -->

And yes, as you mentioned, that code would require a .shtml extension.

Let me know if you're still having trouble. :)

Donna

--
support@interactivetools.com


steve_e
User

Oct 10, 2006, 10:39 AM

Post #7 of 13 (5432 views)
Shortcut
Re: [Donna] Last three articles [In reply to] Can't Post

Hi Donna -
Thanks for this. Crikey, wasn't expecting it to be this involved when I started!

I haven't been able to make the SSI line work at all. I don't know if there's something strange about my server setup, but it just 'disappears' the line, no matter what combination of paths etc I give it.

The php line I have been able to make work - it seems that when you run a script in a php include line, you need to give a url rather than a path. So the line I've got currently looks like this:

<?php
include('http://mysite.info/cgi-bin/interact/exec/search.cgi?search=1&template=search/recent_articles.html&cat=2,5,8');
?>

I have no idea why that's the case but my host referred me to this php functions page when I was trying to work it out with them:
http://uk.php.net/manual/en/function.include.php

Now - I have a page which generates latest articles. The only thing I hope you can help me with now is that what I actually need is for it to find the last three articles from WHATEVER category rather than the last three articles from each category. So, as is the case with me, I only want it to look at categories 2,5 and 8, and then to draw out whatever the last three categories were. Sometimes all three might be from category 2, sometimes there might be two from 5 and 1 from 8.

Is it possible to modify Scott's template to do that?

Sorry.... Tongue

Regards, Steve.


ross
Staff / Moderator


Oct 10, 2006, 11:25 AM

Post #8 of 13 (5430 views)
Shortcut
Re: [steve_e] Last three articles [In reply to] Can't Post

Hi Steve.

Glad to hear back from you Smile.

We are actually really close to the end here so there shouldn’t be much more left to get this going.

I am a little confused though because from the include you are using actually seems like it should be doing what you are describing.

By adding in the cat=2,5,8 at the end there, you are telling the search to only happen in categories 2,5 and 8. When this happens, the articles returned will be restricted to those 3 categories.

From the sounds of it though, you are saying the articles still come back from all categories. Could you confirm that for me so I know I am trouble shooting the right thing?
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com

Hire me!  Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/



steve_e
User

Oct 10, 2006, 11:39 AM

Post #9 of 13 (5426 views)
Shortcut
Re: [ross] Last three articles [In reply to] Can't Post

Hi Ross -
(Whoops, apologies - think I referred to you as Scott above. Don't know where that came from!)

That's not exactly correct. It's choosing articles from only those three categories. (Actually it's only chosen articles from two, but I'm assuming that's because the third category doesn't have any articles since last year)

But it's taken ten of them. Now that I look at them more closely, everything is in date order (rather than three from each as I previously suggested).

So I guess what I'm asking is for a parameter that will restrict the search to three rather than ten - sorry, I should have checked that more closely!

Regards, Steve.


ross
Staff / Moderator


Oct 10, 2006, 1:08 PM

Post #10 of 13 (5423 views)
Shortcut
Re: [steve_e] Last three articles [In reply to] Can't Post

Hi Steve.

Thanks for clearing that up Smile.

To have only 3 articles returned, you would just need to add the following to your query:

perpage=3

It would look like this:

http://mysite.info/cgi-bin/interact/exec/search.cgi?search=1&template=search/recent_articles.html&cat=2,5,8&perpage=3

Nice and easy eh? Give this a shot and let me know what you think Smile.
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com

Hire me!  Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/



steve_e
User

Oct 10, 2006, 2:05 PM

Post #11 of 13 (5420 views)
Shortcut
Re: [ross] Last three articles [In reply to] Can't Post

That's perfect, thanks Ross!

I've got one question, which isn't important so don't worry if you don't have time to answer. I've got rid of all the things I don't need in your template file. But I can't get rid of the 'next' template cell code without getting an error. I can get rid of the text and link so it's no problem. I'm just wondering why it seems to be necessary to retain the template insert lines.

Regards, Steve.


ross
Staff / Moderator


Oct 10, 2006, 3:29 PM

Post #12 of 13 (5417 views)
Shortcut
Re: [steve_e] Last three articles [In reply to] Can't Post

Hi again Steve.

What is actually happening here is the templatecells on any template are all required so they always need to be there. Like you had already noticed though, you can remove the HTML that is between the templatecells though. Another option is that you can actually remove template inserts. Each group of template cells has a template insert and if you remove that, regardless of the HTML in the template cells, they will do nothing.

Either option will work so you should be good to go. Keep me up to date though Smile.
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Product Specialist
support@interactivetools.com

Hire me!  Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/



steve_e
User

Oct 11, 2006, 8:18 AM

Post #13 of 13 (5394 views)
Shortcut
Re: [ross] Last three articles [In reply to] Can't Post

Hah! Perfect. Thanks very much Ross, I'm all done. Got the last three articles coming up all nicely formatted. Thanks for all the help!

As your advertising says, great product and excellent friendly support. Laugh

Best wishes,
Steve.