WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Snippet: cwsoft-anynews
  • Print
Pages: 1 ... 5 6 [7] 8 9 10   Go Down

Author Topic: Snippet: cwsoft-anynews  (Read 322339 times)

Offline cwsoft

  • Posts: 605
Re: Snippet: cwsoft-anynews
« Reply #150 on: July 02, 2013, 07:51:22 AM »
Hi,

multilingual output with anynews is a bit tricky, but doable.

First I would switch to the more easy configuration options using getNewsItems shown in the README. The old displayNewsItems function needs to have all parameters in the right order, which is not the case in your example. If you want stick to the old function, follow the instructions for Anynews <2.8 linked in the README (section configuration).

Create one news page with the WB news module for each language you have or create one group for each language. Then call Anynews for each language using  set lang_id = 'LANG' and the group or sectionID for the individual language.

Another option is to organize your URL to include the language flage (e.g. mydomain/EN/news.php). In this case you can try the Anynews flag lang_filter = true and lang_id = 'AUTO' combination to let Anynews choose the language file depending on the URL language fragment.

Cheers
« Last Edit: July 02, 2013, 08:13:22 AM by cwsoft »
Logged

Offline svsanchez

  • Posts: 589
Re: Snippet: cwsoft-anynews
« Reply #151 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!
Logged

Offline cwsoft

  • Posts: 605
Re: Snippet: cwsoft-anynews
« Reply #152 on: July 03, 2013, 07:10:56 AM »
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
« Last Edit: July 03, 2013, 12:09:22 PM by cwsoft »
Logged

daydreamer

  • Guest
Re: Snippet: cwsoft-anynews
« Reply #153 on: July 03, 2013, 11:57:25 AM »
Do you have a download link for getNewsItems?
Logged

Offline cwsoft

  • Posts: 605
Re: Snippet: cwsoft-anynews
« Reply #154 on: July 03, 2013, 12:06:13 PM »
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:
« Last Edit: July 03, 2013, 12:09:46 PM by cwsoft »
Logged

daydreamer

  • Guest
Re: Snippet: cwsoft-anynews
« Reply #155 on: July 03, 2013, 02:06:28 PM »
Thanks  :-)

Is this call right?

Code: [Select]
<?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,
);
}
?>
Logged

Offline cwsoft

  • Posts: 605
Re: Snippet: cwsoft-anynews
« Reply #156 on: July 03, 2013, 03:46:26 PM »
Hi,

Quote from: daydreamer
Is 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
« Last Edit: July 03, 2013, 03:50:23 PM by cwsoft »
Logged

daydreamer

  • Guest
Re: Snippet: cwsoft-anynews
« Reply #157 on: July 03, 2013, 08:37:54 PM »
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
Logged

Offline cwsoft

  • Posts: 605
Re: Snippet: cwsoft-anynews
« Reply #158 on: July 03, 2013, 09:20:50 PM »
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:
Code: [Select]
// 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.
Code: [Select]
$config = array(
    'display_mode' => 3,
);
echo getNewsItems($config);


Cheers
« Last Edit: July 03, 2013, 09:23:23 PM by cwsoft »
Logged

daydreamer

  • Guest
Re: Snippet: cwsoft-anynews
« Reply #159 on: July 04, 2013, 11:26:37 AM »
Thanks for that should read more clearly my bad
Logged

Offline fordfairlane

  • Posts: 2
Re: Snippet: cwsoft-anynews
« Reply #160 on: July 19, 2013, 11:16:01 AM »
Here's the Danish language file:

Code: [Select]
<?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'
);
Logged

Offline cwsoft

  • Posts: 605
Re: Snippet: cwsoft-anynews
« Reply #161 on: July 19, 2013, 05:56:31 PM »
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
« Last Edit: July 19, 2013, 05:58:09 PM by cwsoft »
Logged

Offline cwsoft

  • Posts: 605
cwsoft-anynews v2.10.0 available
« Reply #162 on: July 21, 2013, 11:11:52 PM »
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
« Last Edit: July 21, 2013, 11:17:44 PM by cwsoft »
Logged

Offline cwsoft

  • Posts: 605
cwsoft-anynews v2.11.0 released
« Reply #163 on: March 03, 2014, 05:54:15 PM »
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
« Last Edit: March 03, 2014, 07:22:31 PM by cwsoft »
Logged

Offline Roych

  • Betatester
  • **
  • Posts: 573
  • Gender: Male
cwsoft-anynews Template change
« Reply #164 on: April 09, 2014, 10:25:28 PM »
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!
Logged

Offline Roych

  • Betatester
  • **
  • Posts: 573
  • Gender: Male
Re: Snippet: cwsoft-anynews
« Reply #165 on: April 09, 2014, 10:30:18 PM »
Ok, never mind I found it! LOOOL!!!
Logged

Offline cwsoft

  • Posts: 605
cwsoft-anynews v2.12.0 released
« Reply #166 on: May 16, 2014, 07:21:42 AM »
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
« Last Edit: May 16, 2014, 07:26:34 AM by cwsoft »
Logged

daydreamer

  • Guest
Re: Snippet: cwsoft-anynews
« Reply #167 on: June 02, 2014, 08:22:21 PM »
Thanks for the updates :D
Logged

Offline cwsoft

  • Posts: 605
cwsoft-anynews v2.13.0
« Reply #168 on: July 15, 2014, 06:11:45 PM »
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).

Code: [Select]
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
Logged

daydreamer

  • Guest
Re: Snippet: cwsoft-anynews
« Reply #169 on: July 25, 2014, 12:39:16 PM »
How to show date as 1 JUL only? I have changed date settings it WB admin but no change
Logged

Offline jacobi22

  • Betatester
  • **
  • Posts: 5920
Re: Snippet: cwsoft-anynews
« Reply #170 on: July 25, 2014, 12:52:49 PM »
look into the language file from the anynews module

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

daydreamer

  • Guest
Re: Snippet: cwsoft-anynews
« Reply #171 on: July 25, 2014, 01:10:22 PM »
Thanks jacobi22 changed to d/m but would like to show month as Jul not as number
Logged

daydreamer

  • Guest
Re: Snippet: cwsoft-anynews
« Reply #172 on: July 25, 2014, 01:14:32 PM »
Got it read phpmanual it's F
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Snippet: cwsoft-anynews
« Reply #173 on: July 25, 2014, 01:15:44 PM »
All options: http://php.net/manual/en/function.date.php

This would give "25 Jul" for today.
Code: [Select]
'DATE_FORMAT'            => 'j M'
Note it will use your servers "Locale" setting (language).
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

Offline G4

  • Posts: 91
Re: Snippet: cwsoft-anynews
« Reply #174 on: August 05, 2014, 04:49:26 PM »
Is it possible to place news items next to each other? I have included an image.
« Last Edit: August 07, 2014, 08:58:20 PM by G4 »
Logged

  • Print
Pages: 1 ... 5 6 [7] 8 9 10   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Snippet: cwsoft-anynews
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2