| Author |
Message |
afxback
Joined: 11 Nov 2005 Posts: 123
|
|
How to EXCLUDE the last post from include code? |
|
Hello,
Anybody could help me if there is a solution to Exclude the last post automaticly from include code?
This is because I generally have multiple includes from the same categories in the same page as below, for example:
Include code 1
<?
$number = "1";
$template = "Default";
$category = "1,2,3,4,5,6";
include $cutepath.'/show_news.php';
?>
Include code 2
<?
$number = "5";
$template = "Headlines";
$category = "1,2,3,4,5,6";
include $cutepath.'/show_news.php';
?>
I want the first include display the last post only in normal order with Default template and short story...
While, the second include must show just "Headlines" from last (5) number of posts. So I dont want the last post shown repeatedly on one page and col...
How could you solve this?
Thanks in advance
|
|
| Thu Jul 10, 2008 11:48 pm |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
scottdallas

Joined: 04 May 2006 Posts: 1808 Location: US |
|
|
|
You mean the lasts posts from your entire news database? If so I think you need $sort = array('date', 'ASC'); to sort from Oldest to Newest and then you need to use include codes similar to this:
Include code 1:
 |  | <?
$number = "1";
$template = "Default";
$sort = array('date', 'ASC');
$category = "1,2,3,4,5,6";
include $cutepath.'/show_news.php';
?> |
Include code 2
 |  | <?
$number = "5";
$skip = "1";
$template = "Headlines";
$sort = array('date', 'ASC');
$category = "1,2,3,4,5,6";
include $cutepath.'/show_news.php';
?> |
That should show the oldest post with default template, then show 5 headlines excluding the very last one (so no news repeats) because of the $skip variable
I hope I understood and answered you correctly 
_________________ www.scottdizzle.com uses cnr
last update: 07-22-08: 8:30 pm |
|
| Fri Jul 11, 2008 1:29 am |
|
 |
afxback
Joined: 11 Nov 2005 Posts: 123
|
|
|
|
Thank you dear Scottdallas,
I do not want the "oldest" post shown in any of my includes. I need both includes show the latest and newest posts from the selected categories. I tried your solution but in my first include code, it displays the oldest post from 4 years ago!
I just want to exclude the latest post from being shown repeatedly in the second include. I mean the second include code must display 5 latest posts except the "newest" one!
again thank you.
any other solution will be appreciated.
[b]UPDATE:[/b]
Solved! I really did not know the very functions of "skip".
It works without any change in the sortings...
Thank you dear scott.
|
|
| Fri Jul 11, 2008 7:34 am |
|
 |
robp07
Joined: 15 Jun 2008 Posts: 21
|
|
|
|
Hey,
Is it possible to have a {big-avatar} along with the normal size {avatar}. So the 1st news item shows this big image, but when it isnt new any more goes back to the normal {avatar} size.
It would be easy-enough in the templates, but what code would I need to change to implement it?
Cheers!
|
|
| Sun Jul 13, 2008 10:40 pm |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 1808 Location: US |
|
|
|
 |  | Solved! I really did not know the very functions of "skip". |
ah yes good i'm glad you figured out what you need!
And robp07, good question although I don't think it is relevant to this thread. Can you post it again in the Help section? You'll probably get a better response.
_________________ www.scottdizzle.com uses cnr
last update: 07-22-08: 8:30 pm |
|
| Mon Jul 14, 2008 12:41 am |
|
 |
robp07
Joined: 15 Jun 2008 Posts: 21
|
|
|
|
It is slightly relevant
But yeh it will probaly be seen more in its own thread!
|
|
| Mon Jul 14, 2008 11:23 am |
|
 |
|