Snippet: cwsoft-anynews

cwsoft

Hi,

Quote from: G4 on August 05, 2014, 04:49:26 PM
Is it possible to place news items next to each other? I have included an image.
Yes this can be achieved with a customized Anynews template and some CSS rules. Some basics about Anynews templates can be found in the README at GitHub.

Cheers cwsoft

cwsoft

Hi,

cwsoft-anynews v2.13.1 stable is available at GitHub and the WebsiteBaker Add-ons repository.

Updates since last release:
- added fixes for handling of anynews Droplet parameters (special chars like <>, boolean paramters)
- thanks to jacobi22 and dbs for the bug reports

Further details can be found in the README at GitHub.

cwsoft

G4

#175
Is it possible to place news items next to each other? I have included an image.

Ruud

All options: http://php.net/manual/en/function.date.php

This would give "25 Jul" for today.
'DATE_FORMAT'            => 'j M'

Note it will use your servers "Locale" setting (language).
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

daydreamer

Got it read phpmanual it's F

daydreamer

Thanks jacobi22 changed to d/m but would like to show month as Jul not as number

Gast

look into the language file from the anynews module

Quote'DATE_FORMAT'            => 'H:i, d.m.Y'

daydreamer

How to show date as 1 JUL only? I have changed date settings it WB admin but no change

cwsoft

Hello,

cwsoft-anynews v2.13.0 stable is available at GitHub and the WebsiteBaker Add-ons repository.

Updates since last release:
- added utility function getGroupIdTypes() to display group_type_ids usable with Anynews
- updated 3rd party package Twig to latest version

The utility function getGroupIdTypes can be used to output news title and all possible Anynews group_type_ids (post_id, section_id, page_id, group_id) by adding the following code into a page/section of type code. The utility function was added to allow the easier extraction of group_ids and post_ids in newer WebsiteBaker News module versions (ids were changed from integer to a hashed value).


require_once(WB_PATH . '/modules/cwsoft-anynews/code/anynews_functions.php');
getGroupIdTypes($sort_column = "post_id", $sort_order = "ASC", $output = true);


Use this function to find out the group_ids or post_ids of specific news items you want to output with Anynews.

For details see README at GitHub.

cwsoft

daydreamer


cwsoft

#167
Hello,

cwsoft-anynews v2.12.0 stable is available at GitHub and the WebsiteBaker Add-ons repository.

Updates since last release:
- added TIMEZONE to all Anynews time placeholders (thanks to samir2000 for reporting)
- added option to define the starting news item (thanks to jacobi22 for the suggestion)

The last item allows you e.g. to display the x-th to n-th news items by defining start_news_item and max_news_items. Using negative indizes for start_news_item will start from the x-th last news, allowing you also to display the last X news items more easily.

For details see README at GitHub.

cwsoft

P.S.: Thanks to Ruud for updating the WebsiteBaker Add-on repository with the latest version

Roych

Ok, never mind I found it! LOOOL!!!

Roych

Hello

Im maybe stupid or crazy  :-P

But I can't figure out how to change the templates or any other functions! In which files?
I read the https://github.com/cwsoft/wb-cwsoft-anynews#readme

But still dont understand where do I find those files ...

I want to have some other template and need only 3 news to show up.

Thank you wery much!

cwsoft

#164
Hello,

cwsoft-anynews v2.11.0 stable is available at GitHub and the WebsiteBaker Add-ons repository.

Updates since last release:
- news created by the WB news module but not yet saved are not displayed by Anynews by default
 Thanks to samir2000 and jacobbi22 for bug reporting and analysis. As pointed out by jacobi22, the correct fix is to
 set "Active=0" in the WB-News module when a news post is created and update to 1 when saved the first time.
- updated 3rd party packages

Announcement:
Most likely I will remove the outdated and no longer maintained 3rd party jQuery "better-coda-slider" with the next cwsoft-anynews release. Shouldn't be a big issue, as it seems this slider isn't used that often and you can easily switch to the jQuery flexslider also shipped with Anynews :wink:

cwsoft

P.S.: Thanks to Ruud for updating the WebsiteBaker Add-on repository with the latest version

cwsoft

#163
Hello,

cwsoft-anynews v2.10.0 stable is available at GitHub and the WebsiteBaker Add-ons repository.

Updates since last release:
- set minimum PHP version to 5.2.4 (Twig requirement)
- added Danish language file from user fordfairlane (thanks)

cwsoft

P.S.: Also big thanks to Ruud for keeping the WebsiteBaker Add-on repository in sync with my releases - highly appreciated

cwsoft

#162
Quote from: fordfairlane on July 19, 2013, 11:16:01 AM
Here's the Danish language file
Great - thanks for your contribution. Uploaded your file to GitHub, so it will be distributed with the next cwsoft-anynews release and mentioned you in the Credit section of the README file.

Regards cwsoft

fordfairlane

Here's the Danish language file:

<?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
*/

// English module description
$module_description 'This kodestump cwsoft-anynews gør det muligt at vise nyheder poster fra WebsiteBaker news modul på ethvert sted, du ønsker. Kalder funktionen fra en kode sektion eller din skabelon index.php fil. For nærmere oplysninger se <a href="https://github.com/cwsoft/wb-cwsoft-anynews#readme" target="_blank">GitHub</a>.';

// initialize global $LANG variable as array if needed
global $LANG;
if (! isset(
$LANG) || (isset($LANG) && ! is_array($LANG))) {
$LANG = array();
}

$LANG['ANYNEWS'][0] = array(
// text outputs for the frontend
'TXT_HEADER'             => 'Seneste nyheder',
'TXT_READMORE'           => 'Læs mere',
'TXT_NO_NEWS'            => 'Ingen nyheder.',
'TXT_NEWS'               => 'Nyheder',
'TXT_NUMBER_OF_COMMENTS' => 'Antal kommentar',

// date/time format: (21:12  12/31/2012)
'DATE_FORMAT'            => 'G:i, d/m/Y'
);

daydreamer

Thanks for that should read more clearly my bad

cwsoft

#159
Hi,

have you tried the code shown in the Example section of the README I linked in my last post? It provides the code needed to render news with a user specified template.

This code is posted in the README example sections:

// customized cwsoft-anynews function call
$config = array(
    'group_id' => 8,
    'group_id_type' => 'section_id',
    'display_mode' => 4,
);
echo getNewsItems($config);


and this would be a custom version which just sets display_mode to 3 and keeps all other defaults unchanged.

$config = array(
   'display_mode' => 3,
);
echo getNewsItems($config);



Cheers

daydreamer

Ok, I'm not really up with php so not sure how to add in my template to show display mode 3. Could you show me how I can do this please?

Thanks

cwsoft

#157
Hi,

Quote from: daydreamerIs this call right?
Not really. As you call getNewsItems() without passing over the config array, the default settings are used and the stuff you have defined in the Array $config is simply ignored.

Just have a look at the code shown in the section Example of the README. Remember that you only need to define the parameters in the config array you want to change.

Cheers

daydreamer

Thanks  :-)

Is this call right?

<?php
if (function_exists('getNewsItems')) {
echo getNewsItems();
$config = array(
'group_id' => 0,
'max_news_items' => 10,
'max_news_length' => -1,
'display_mode' => 1,
'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,
);
}
?>

cwsoft

#155
Quote from: daydreamer on July 03, 2013, 11:57:25 AM
Do you have a download link for getNewsItems?
Download link is posted several times here in the forum. See post #148 (7 posts before) for example  :wink:

daydreamer

Do you have a download link for getNewsItems?

cwsoft

#153
Quote from: svsanchez on July 02, 2013, 08:50:16 AM
Hello Cwsoft, thank you for your help, I was finally able to get it to work with the getNewsItems thing instead of the previous one!
Good to here you solved it.

I highly recommend to use getNewsItems over the old and deprecated displayNewsItems due to the more flexible and less error prone configuration. The old displayNewsItems call became more and more clumbsy with each new feature, while maintaining backward compatibility at the same time :|

A function or method with more than 3-4 Parameters is a strong sign for the need of some refactoring. First Anynews code from fienieg had no parameters and needed to be manually copied into a code section or template index.php file. My initial Anynews Code Snippet module has grown from from 6 to 13 optional configuration options over it's entire life cycle :wink:

Cheers