WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
PLEASE NOTE: Please delete any possible existing previous Anynews module via the WebsiteBaker backend BEFORE installing the new version, as the database names have changed.
- for less advanced/experienced wb-users: unclearity if this is a totally new version, just an update or a new module possibly resulting in a chaotic maze of moduleversions and variations
Dear stefek, ... redirecting me to google kinda pisses me off as it suggests you think i am choosing the easy way and whitout thinking just putting in nonsense questions, this kind of behaviour here does not do much good to the reputation of the whole community.
A name change takes place most of the times in case of forking. AnyNews is a well known and long lasting module, so a name change should have a real purpose. If this version differs very much from the previous ones, you could see it as a fork, leaving regular AnyNews as it is.
for less advanced/experienced wb-users: unclearity if this is a totally new version, just an update or a new module possibly resulting in a chaotic maze of moduleversions and variations
<?phpdisplayNewsItems(1,5,-1,5,'AUTO',true,'<a><br />')?>
{% for news in newsItems %}<a href="{{ news.LINK }}"><strong>{{ news.TITLE }}</strong></a><br />{{ news.CONTENT_SHORT}}<br /><br />{% endfor %}
<p>Sa. 15.12.2012, 16.00 Uhr<br />Amtshauskeller Frdbg.<br />Eintritt frei</p>
Sa. 15.12.2012, 16.00 Uhr<br />Amtshauskeller Frdbg.<br />Eintritt frei
Sa. 15.12.2012, 16.00 UhrAmtshauskeller Frdbg.Eintritt frei
So it seems that the "<br />" Tag is striped althought it is allowed.
displayNewsItems(1,5,-1,5,'AUTO',true,'<a><br>')
Woow,that was easy. Sometimes one thinks to complicated.Thanks marmot, it works like a charm.Matthias
This parameter should not contain whitespace. strip_tags() sees a tag as a case-insensitive string between < and the first whitespace or >. It means that strip_tags("<br/>", "<br>") returns an empty string.
if (function_exists('displayNewsItems')) { displayNewsItems( $group_id = 0, $max_news_items = 2, $max_news_length = 40, $display_mode = 1, $lang_id = 'AUTO', $lang_filter = true, $strip_tags = true, $allowed_tags = '<p><a>', $custom_placeholder = false, $sort_by = 1, $sort_order = 1, $not_older_than = 0, $group_id_type = 'group_id' );
<div class="mod_anynews"> <h2>{{ lang.TXT_HEADER }}</h2> {% for news in newsItems %} <p> <strong>{{ news.TITLE }} ({{ news.POSTED_WHEN }})</strong> </p> {{ news.CONTENT_SHORT}} {% if news.CONTENT_LONG %} <a href="{{ news.LINK }}">{{ lang.TXT_READMORE }}</a> {% endif %} <hr /> {% else %} {{ lang.TXT_NO_NEWS }} {% endfor %}</div>
<?php/** * Code snippet: cwsoft-anynews * * This code snippets grabs news entries from the WebsiteBaker news * module and displays them on any page you want by invoking the function * displayNewsItems() via a page of type code or the index.php * file of the template. * * This file contains the English language output. * * LICENSE: GNU General Public License 3.0 * * @platform CMS WebsiteBaker 2.8.x * @package cwsoft-anynews * @author cwsoft (http://cwsoft.de) * @copyright cwsoft * @license http://www.gnu.org/licenses/gpl-3.0.html*/// Czech module description$module_description = 'Tento modul cwsoft-anynews umožňuje zobrazovat vaše aktuality ze systému WebsiteBaker na jakémkoliv místě. Funkci můžete použít v sekci Code na jakékoliv stránce nebo ve vaší šabloně v souboru index.php. Detaily viz <a href="https://github.com/cwsoft/wb-cwsoft-anynews#readme" target="_blank">GitHub</a>.';// initialize global $LANG variable as array if neededglobal $LANG;if (! isset($LANG) || (isset($LANG) && ! is_array($LANG))) { $LANG = array();}$LANG['ANYNEWS'][0] = array( // text outputs for the frontend 'TXT_HEADER' => 'Aktuality', 'TXT_READMORE' => 'číst více', 'TXT_NO_NEWS' => 'Nejsou k dispozici žádné aktuality.', 'TXT_NEWS' => 'Novinky', 'TXT_NUMBER_OF_COMMENTS' => 'Počet komentářů', // date/time format: (9:12 PM, 12/31/2012) 'DATE_FORMAT' => 'H:i, j.n.Y');
<?php if (function_exists('displayNewsItems')) { displayNewsItems( $group_id = 0, $max_news_items = 3, $max_news_length = 40, $display_mode = 2, $lang_id = 'AUTO' ) ; } ?>
Here is a Czech translation
Also, for some reason the $max_news_length is not working for me.
The parameter $display_mode = 2; will only show the news TITLE in a list view and not the news text. Hence the parameter $max_news_length = XX; is not effective for this display mode. Set display mode to 1 and try again.If you run into the same issue with display_mode = 1, please try to add the parameter $strip_tags = false to your Anynews function call. See Anynews parameter description at GitHub for details.If the above proposals don't work for you, please report back in the forum so we can fix your issue.Cheers cwsoft
<div class="mod_anynews"> {% if newsItems %} <ul> {% for news in newsItems %} <li><a href="{{ news.LINK }}"><strong>{{ news.POSTED_WHEN }} | {{ news.TITLE }}</strong><br />{{ news.CONTENT_SHORT}}</a></li> {% endfor %} </ul> {% else %} {{ lang.TXT_NO_NEWS }} {% endif %}</div>
<div class="mod_anynews"> {% if newsItems %} <ul> {% for news in newsItems %} <li> <a href="{{ news.LINK }}"> <strong>{{ news.POSTED_WHEN }} | {{ news.TITLE }}</strong><br /> {{ news.CONTENT_SHORT | slice(0,20) }} {% if news.CONTENT_SHORT | length > 20 %} ... {% endif %} </a> </li> {% endfor %} </ul> {% else %} {{ lang.TXT_NO_NEWS }} {% endif %}</div>
Great module, but I want the anynews droplet for display latest news on specific wysiwyg pages, not only on "code" pages. Any ideas? I think it must be very simple droplet, but I not php programmer.
@danaFirst, I recommend NOT to modify the template files shipped with Anynews. Better create a copy of the original template ("display_mode_2.htt" --> "display_mode_5.htt") and modify the copy (remember to adapt $display_mode to the number of your template).The actual truncate implementation was done by the WebsiteBaker community, but never fully tested for all possible use cases (e.g. multibyte encoding, malformed HTML/XML ...). Basic idea was not to cut HTML tags and single words. My initial implementation was to strip off tags and truncate plain text, which is much easier but less comfortable Could you please check the following in your code: a) enter PLAIN text into WB News short news filed: "this is some text, just to test" b) set $max_news_length = 10 --> results in: "this..." c) set $max_news_length = 11 --> results in: "this is..."*snip*
I think I have figured out where the problem is.
Here is Russian translation.
No, my idea is to make a droplet, which calls displayNewsItems(), and possibility for the user to include [[cwsoft-anynews]] to wysiwyg for placing news on the some page.
// include cwsoft-anynews coderequire_once(WB_PATH . '/modules/cwsoft-anynews/include.php');// execute Anynewsob_start();displayNewsItems( $group_id = 0, $max_news_items = 10, $max_news_length = -1, $display_mode = 4, $lang_id = 'AUTO', $strip_tags = true, $allowed_tags = '<p><a><img>', $custom_placeholder = false, $sort_by = 1, $sort_order = 1, $not_older_than = 0, $group_id_type = 'group_id', $lang_filter = false);$output = ob_get_contents();ob_end_clean();// return Anynews outputreturn $output;