Code Snippet: Display news items, anywhere

doc

Hi Konrad,

have a look at the Readme file coming along with Anynews. Guess the last two options sort_order and sort_by are your friend.

Regards Christian

sparkdigital

Great stuff, thanks.

If I have multiple news pages and assign group = 0 in the snippet, what is the order of the news items based on? It seems to display them randomly but I would like to display the top news item from each individual news page.

Is there any way of doing this?

Thanks,

Konrad

Ruud

If you have multiple News pages you will need to use the group id.
Create a group for every newspage to use, and use the first parameter to show only that group.

It works fine for multilanguage sites. (used it like that before)
Groups like "Dutch news, English News, etc.."

Ruud

[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

sparkdigital

How does this snippet deal with the possibility that there are more than one news pages? Can I specify which page I want to display the news items from?

Thanks,

Konrad

daydreamer


Ruud

The 4th parameter should be set to 1.
2 means you will get a list of links only.

Quotedisplay_mode...    1:=details (default); 2:=unsorted list; 3-99 (custom template: /htt/custom_output_display_mode_X.htt)

Ruud
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

daydreamer

This is what I have but no short description is showing?

<?php display_news_items(0, 5, 50, 2, 'Latest News', 'read more', 'no news yet', '<a>', 'do not show publish date', '1', '1'); ?>

mr-fan

http://addons.WebsiteBaker.org/modules/anynews/help/help_en.html

try and learn about this snippet and you can get the output of the newsmodule that you want... :wink:

regard martin

daydreamer

Sorry this is all new to me, I need to show

5 posts
News Title
Short Description max 40 length
read more

What code would I need in my index.php

Many Thanks

Argos

Quote from: mr-fan on February 19, 2009, 10:56:16 AM
hi,

try it with two sections .....

first section take the "latest news" - modul from here....
http://www.websitebakers.com/pages/modules/listings/section-pages/latest-news.php

it shows the last news-post full...

second section take the anynews for the links to the rest of the news.... :wink:

I think the question was how to let the anynews module start with the second latest item, instead of the latest one...
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Ymmot

Hi all.
Thanks a lot for a great forum and dedicated community. :)
I am a fairly new user off website baker, I like it a lot!
I tweaked some files here and there and got most working like I want it.

Now to the topic:
What I would like with anynews is the ability to show news starting from news item X!

On the front page I would like to show one news item with text and 5 more with just links.

But with the code here under the first full will be the same as the first in the second group.

Any way to work around or any way it´s possible to add to the anynews code?


if (function_exists('display_news_items'))
{
display_news_items(0, 1, 230, 1, 'Latest News', 'show full news text', 'uups, no news available', true, '<a><img>', true, ' (Y-m-d)', 2, 1);

display_news_items(0, 5, 0, 2, 'More News', 'show full news text', 'uups, no news available', true, '<a><img>', true, ' (Y-m-d)', 2, 1);
}


Thanks for any tips and help!

doc

Hello,

the bug should be fixed in the latest version available on the WB Add-ons repository.

Regards Christian

babsy

#240
ok, i tried to look through the old code, but i really don´t see what code is for the picture, so if anyone knows, please let me know!

doc

Hello,

need to check if the striptags options are missing for the short text in the last version of Anynews.

Regards Christian

babsy

hi.... i just updated, and my picture dissapeared, so now its. just text??
is it not possible in the latest update to have the picture in the small text??

Maarten8

Quote from: doc on January 26, 2009, 03:12:00 PM
Hello,

yes, simply add a WYSIWYG section and a code section to a page. Then call the Anynews function from the code section. This way you do not need to touch your template. Details about section can be found on the WB help site:
http://help.websitebaker.org/pages/en/basic-docu/working-with-wb/page-administration/manage-sections.php

Regards Christian

Thanks it totally works  :mrgreen:

doc

Hello,

yes, simply add a WYSIWYG section and a code section to a page. Then call the Anynews function from the code section. This way you do not need to touch your template. Details about section can be found on the WB help site:
http://help.websitebaker.org/pages/en/basic-docu/working-with-wb/page-administration/manage-sections.php

Regards Christian

Maarten8

Is it possible to put the anynews in a WYSIWYG page?
So if you make a new page and use as type WYSIWYG.
Because I would like it at the frontpage only (so no use to put it in template) and I kinda need to have a WYSIWYG page for some other users.

thanks.

doc

#234
Hello,

just released Anynews v0.34 on the WebsiteBaker Add-ons repository.

This version fixes a bug which made it impossible to make use of the custom output template files like: custom_output_display_mode_X.htt (X for a number between 3 and 99). Thanks to Erpe for reporting.

Further details can be found in the Readme file.

Delete any previous version and install the latest version afterwards.

Have fun
Christian

saiborg

#233
Sorry, but im toooooo silly,

i can´t implement the code....i already changed some code in the anynews/include.php
but i can´t make the $max_news_length shorter

if (function_exists('display_news_items')) {
   display_news_items($max_news_length);
}



an what do i habe to change that there ist not the full short text, only thirty to fourty letters....

$group_id = 0, $max_news_items = 10, $max_news_length = -0, $display_mode = 1,         $header_text = 'Aktuel', $readmore_text = 'weiter lesen', $no_news_text = 'no news available yet...',         $strip_tags = true, $allowed_tags = '<a>',        $display_publish_date = false, $date_time_format = ' (g:i A, m/d/Y)',        $sort_by = 1, $sort_order = 1)

Thank you for your help

Saiborg
(sorry for my english)
schaut doch mal vorbei

[url="http://www.microott.de"]http://www.microott.de[/url]

doc

Hello,

should be doable with the latest version of anynews released recently on the addon repository.

You can style the output of anynews by modifying the HTML templates included in the folder /htt of anynews as described in the README file.

Regards Christian

Xagone

is there a way to link the title header to the news it's showing (when it's only 1 group)?

like in there http://www.votreespace.net/pages/nouvelles.php
the "derniere realistion" is another news in a subsection, other than making the link manualy in the call, can we activate a link to the group?

because something like this :
if (function_exists('display_news_items')) {
   display_news_items(0,10,50, 2,'<a href="/pages/nouvelles/derniere-realisations.php">Dernières mise-a-jour</a>', 'Voir...', 'oups, aucunes mise a jour');
}
do not seam to work.
Xagone Inc. (formerly VotreEspace)
[url="http://xagone.com/"]http://xagone.com/[/url]

Maarten8

Quote from: Argos on January 13, 2009, 10:22:18 AM
Quote from: Maarten8 on January 13, 2009, 10:14:44 AM
Is it possible to add it to a page?
Like if I go pages > add page?
If no, is it possible to just show it on only one page?
Sure, make a code section and put the snippet in there. I recommend using the code2 module: http://www.websitebakers.com/pages/admin/core-replacements/code-2.php. It's more versatile than the default code module.

Woah thanks for the fast response :-D

Argos

Quote from: Maarten8 on January 13, 2009, 10:14:44 AM
Is it possible to add it to a page?
Like if I go pages > add page?
If no, is it possible to just show it on only one page?
Sure, make a code section and put the snippet in there. I recommend using the code2 module: http://www.websitebakers.com/pages/admin/core-replacements/code-2.php. It's more versatile than the default code module.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Maarten8

Is it possible to add it to a page?
Like if I go pages > add page?
If no, is it possible to just show it on only one page?

(really nice module btw)

Maarten