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

Offline cwsoft

  • Posts: 605
Snippet: cwsoft-anynews
« on: February 11, 2012, 10:58:51 AM »
Hello,

this post is to inform you about my trial to revive the support for the code snippet cwsoft-anynews (formerly known as Anynews).

Background information:
I took over responsibility for my previous modules "Anynews", "Addon File Editor" and "Postits" in February 2012, after maintenance has stagnated for more than 2 years and "modified" versions with small adaptions for latest WebsiteBaker or jQuery versions, and/or backwards incompatible changes (e.g. Anynews versions with changed function parameters) were spread around via the forum by other community members.

As a consequence, I "forked" my own modules (starting from the last official released version) at GitHub to give them a new home with a public repository for better code and feature request tracking and easier possibilities for contributions (via GitHub fork/pull mechanism etc.), instead of the very user unfriendly way of searching the forum for "patches" and "latest versions". With the initial releases at GitHub, I increased the major module version number to the next higher integer number to make the "fork" and the new start of maintenance support "visible".

Since February 2012, I pushed more than 60 commits to GitHub and added 46k and removed 31k lines of code (including external plugins like Twig, file header changes etc.).

From February to September 2012 the following new features were included:
 - updated jQuery file inclusion to work with newer WB versions
 - added new jQuery slider plugin: "Flexslider"
 - made jQuery Plugins customizable without touching external plugin files
 - moved all hardcoded Anynews output to template files
 - fixed broken sort by comments feature added by another forum member
 - added option to filter news not only by group but also by: page, section, and post id
 - added option to filter news by page language
 - introduced the much more flexible template parser Twig
 - updated all templates to Twig
 - reworked entire README

Name change: "Anynews" --> "cwsoft-anynews"
In July 2012, I started to rename all my supported modules from "Module name" into "cwsoft-module-name". Since September 2012 all my modules stick to this naming convention.

The name change is finally a result of all the work I put into the "forked Anynews module" since February 2012, plus some branding with my domain cwsoft.de, plus the fact that "outdated" module versions (not supporting WB 2.8.x) are still listed at AMASP without having control of updating the content as my request for a new AMASP account was refused, while receiving funny PMs or E-mails at the same time asking me to update those outdated modules.

Beside the name change, I dropped support for outdated PHP and WebsiteBaker versions. Hence modules following the "cwsoft-module-name" naming convention do need PHP 5.2.2 or higher and WebsiteBaker 2.8.x (starting from 2.8.2) as minimum requirement. Apart from that and the name change, nothing will change for you as a user or customer (beside the fact that you should uninstall a previous version so not to have two versions side by side). The modules are still published under the GNU GPL license and will be offered for free (as in free beer).

The sum of all that made me finally believe that a name change (including my branding cwsoft) is well justified. At the end it is the decision of the module author (which it's me) to choose an appropriate module name :wink:

Further information and downloads
 - Module README
 - WebsiteBaker download packages
 - View or report known issues

Feel free to contribute to the cwsoft-anynews module using GitHubs fork and pull mechanisms.

Cheers
cwsoft
« Last Edit: September 09, 2012, 06:45:05 PM by cwsoft »

Offline mdemaree99

  • Posts: 102
Re: Codesnippet: Anynews
« Reply #1 on: February 11, 2012, 09:57:11 PM »
Please update the jquery  to use the normal 1.3.2 file vs modified file.

Currently if another module uses the real jquery 1.3.2 functions there are compatibility issues due to the differences..

Offline cwsoft

  • Posts: 605
cwsoft-anynews - next steps
« Reply #2 on: February 11, 2012, 10:12:23 PM »
Hello,

plans for the next release are:
 - remove jquery 1.3.1 version shipped with the module and use the WB version instead (WB 2.8.2 --> jQuery 1.7)
 - check compatibility of jQuery plugins with jQuery 1.7
 - check for alternative plugins supporting jQuery 1.7+
 - remove jQuery support from Anynews if no alternative slider working with jQuery 1.7 is found

Cheers

P.S.:  Seems the jQuery coda-slider plugin is no longer actively maintained (last commit 2009, required jQuery 1.3.1). Due to massive API changes from jQuery 1.3 to 1.7, I doubt that the coda-slider plugin will work with jQuery 1.7 without massive changes. So if I do not find a compatible plugin, I tend to remove it from Anynews.
« Last Edit: September 09, 2012, 09:58:49 AM by cwsoft »

Offline cwsoft

  • Posts: 605
cwsoft-anynews
« Reply #3 on: February 12, 2012, 01:03:59 AM »
Hello,

cwsoft-anynews ships with the third Party JQUERY Plugin Coda-slider, which seems no longer be actively developed. The Last Update was 2009 and requires jQuery 1.3.1. WB 2.8.2 ships with jQuery 1.7, which is incompatible to 1.3.1.

The question is, how many people Out there are Using this anynews feature and how many of the People using this Feature have issues? Is there an alternative for Coda-slider, licensed under GPL and Running with JQuery 1.7+?

Are there any cracks Out there willing to Update the Coda slider jQuery stuff? The answers will help to figure Out if this Feature will be Removed with the next version or Not.

Cheers
« Last Edit: September 07, 2012, 09:20:34 PM by cwsoft »

Offline kweitzel

  • WebsiteBaker Org e.V.
  • **
  • Posts: 6983
  • Gender: Male
Re: Codesnippet: Anynews
« Reply #4 on: February 12, 2012, 12:34:26 PM »
I personally do use AnyNews but without the coda slider. The second one mostly because I never got it working to my satisfaction  :roll:

Cheers

Klaus

jacobi22

  • Guest
Re: Codesnippet: Anynews
« Reply #5 on: February 12, 2012, 03:02:26 PM »
i used coda-slider in my test-space - with jquery 1.71, no Problems


Offline mdemaree99

  • Posts: 102
Re: Codesnippet: Anynews
« Reply #6 on: February 13, 2012, 05:39:46 AM »
I am using the Anynews with coda slider

The update will be great and should get rid of many of the compatibility issues with other modules.

Another nice to have as  long as the coda slider is working.
Can you change the input box to match up with the height  for the Short: description?
Allows users to know exactly how much room they have to work with when building a slide.

I originally modified my anynews for the height and ideally I would change width also, but this changes up the editor up a little to much for my taste.

I did have one issue.  After changing the height, it seems I get an error message(everything works correctly even with error to m knowledge) when I change the title of the slide.  Not sure if they are related, but only started getting message after I changed height of short description. 

[gelöscht durch Administrator]
« Last Edit: February 13, 2012, 05:42:19 AM by mdemaree99 »

Offline cwsoft

  • Posts: 605
cwsoft-anynews v2.1.0 ALPHA (FOR TESTING PURPOSE ONLY)
« Reply #7 on: February 15, 2012, 10:22:01 PM »
Hi,

uploaded a first ALPHA version of the upcoming cwsoft-anynews version 2.1.0 on GitHub

The version is written for the WB 2.8.x series only, starting from WB 2.8.2 and intended to be tested by more experienced users at a first place. The version is NOT YET ready for productive sites.

Apart from code restructuring, the handling of Javascript files was modified to make use of the mechanismns introduced with WebsiteBaker 2.8.1/2.8.2. In addition two new jQuery sliding effects were added: "coda-slida-2.0" and "flexslider" (set display_mode = 3,4 or 5).

To make the jQuery slida effect working, one needs to add the following code into the head section of the index.php of the frontend template:

Code: [Select]
<?php
if (function_exists('register_frontend_modfiles')) {
register_frontend_modfiles('css');
register_frontend_modfiles('jquery');
register_frontend_modfiles('js');
?>


Note: CSS styling and parameters of the slida effects can be modified by the files located in folders css and javascript. The jQuery plugin files in the folder thirdparty should not be modified unless there is a real need for it.

Feedback welcome.

Cheers
« Last Edit: September 07, 2012, 09:21:34 PM by cwsoft »

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3086
  • Gender: Female
Re: Codesnippet: Anynews
« Reply #8 on: February 15, 2012, 10:41:56 PM »
a little hint:
if (function_exists('register_frontend_m odfiles')) {
is never needed since 2.8.1. The funktion is included in the core now and always available for templates.  8-)
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"You have to take the men as they are… but you can not leave them like that !" :-P
Das tägliche Stoßgebet: Oh Herr, wirf Hirn vom Himmel !

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #9 on: February 15, 2012, 11:06:40 PM »
Well I know, but as all templates shipped with WB 2.8.2 und 2.8.3 still include this, I decided to copy it over.
Its easier for me to explain to search for that code in the template and refer to Default templates, than trying to teach the right way off doing it :-)

Cheers
« Last Edit: September 07, 2012, 09:22:01 PM by cwsoft »

Offline cwsoft

  • Posts: 605
cwsoft-anynews 2.1.0 - which jQuery slider plugin to implement ??
« Reply #10 on: February 19, 2012, 07:53:38 PM »
Hello,

I want to update the jQuery sliding/fading effect for the upcoming cwsoft-anynews version 2.1.0.

So far anynews ships with a jQuery effect called better-coda-slider, which is a free rebuild of the commercial Panic - Coda slider. As the "better-coda-slider" has a lot of dependencies to other jQuery plugins and is no longer actively developed, I decided to drop it in favour of another jQuery plugin.

So far I have reviewed the following candidates:
 - flexslider (my favorite so far, Open Source, last update Oct. 2011)
 - coda-slider-2.0 (GPL, but last update 2009)
 - innerfade (simple plugin, but last update from 2008)

Before I pick one jQuery slider plugin, I would like to ask YOU, if YOU:
 - know a better slider which is actively maintained, licensed under GNU (or equivalent), works with jQuery 1.7
 - want to share your expertise in styling the slider to look good in Anynews (e.g. buttons, boxes, ...)

If you want to suggest another slider which fulfills above requirements and/or want to add your hands on the final CSS layout for the slider shipped with the upcoming cwsoft-anynews (credits will be given), please post in this thread or send me a PM.

Deadline for your suggestions and/or help offers is 26th Feb. 2012 (one week from now). After that date I will carry on with the development of cwsoft-anynews v2.1.0.

Cheers

P.S.: To get an impression of how jQuery effects will be integrated into Anynews 2.1.0, you may want to download and test the first ALPHA version announced in post 7 of this thread. The ALPHA version includes all slider effects except the innerfade slider mentioned above.
« Last Edit: September 07, 2012, 09:22:43 PM by cwsoft »

Offline mdemaree99

  • Posts: 102
Re: Codesnippet: Anynews
« Reply #11 on: February 20, 2012, 04:27:02 AM »
Flexslider looks good as long as it works with Anynews.  I only see it working with images.
Already a fan of codaslider...
Couldn't get the link to innerfade work.

Another simple jq option is  http://bxslider.com/
Not sure on the last time it was updated though.

Offline dbs

  • Betatester
  • **
  • Posts: 8819
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: Codesnippet: Anynews
« Reply #12 on: February 20, 2012, 08:57:14 AM »
Old and good are also cycle-plugin http://jquery.malsup.com/cycle/.
I use it for Anynews.

Another is jcarousellite http://www.gmarwaha.com/blog/2007/08/09/jcarousel-lite-a-jquery-plugin/
Used as Bakery-Item-Slider.

Both works with jquery 1.7.1, supports pause on mouseover, endless scroll and more.

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #13 on: February 20, 2012, 04:18:48 PM »
Hello,

thanks for your feedback so far, see my comments below.

Quote from: mdemaree99
Flexslider looks good as long as it works with Anynews.  I only see it working with images.
As flexslider is already implemented in Anynews 2.1.0 ALPHA, it should work (display_mode = 4).

Quote from: mdemaree99
Already a fan of codaslider...
Guess you are talking about coda-slider-2.0 - right?
Only issue I have with this plugin is that it seems not actively maintained (last update from Oct. 2009).

Quote from: mdemaree99
Couldn't get the link to innerfade work.
The link posted below works for me. Maybe do a Google search for "innerfade jQuery".

Quote from: dbs
Old and good are also cycle-plugin
Thanks for the link, will have a look on this plugin.

Quote from: dbs
Another is jcarousellite
As this Plugin is not actively maintained (last update 2007) I doubt it will make it into cwsoft-anynews.

Cheers
« Last Edit: September 07, 2012, 09:23:31 PM by cwsoft »

Offline cwsoft

  • Posts: 605
cwsoft-anynews v2.1.0 STABLE - Released
« Reply #14 on: February 29, 2012, 06:10:57 PM »
Hi,

just released cwsoft-anynews V2.1.0 STABLE at GitHub. The latest version requires WebsiteBaker 2.8.2 (recommended last stable 2.8.x version) und PHP 5.2.2 (recommended last stable 5.3.x version).

Changes compared to cwsoft-anynews v2.0.0
Third party code was moved into a separate subfolder. Integration of custom Javascript or jQuery plugins was simplified. The additional jQuery slider effect plugin "flexslider" was added as alternative to the outdated "better-coda-slider" distributed with Anynews.

Location and naming of template files have changed from /htt/custom_display_mode_X.htt to /templates/display_mode_X.htt. The Anynews cheat sheet template providing an overview of all Anynews template placeholders is now displayed via $display_mode = 99 (before $display_mode = 4). The HTML output of the Anynews template files is now wrapped in a div with class mod_anynews to avoid clashes with other modules, templates or WebsiteBaker CSS definitions.

Links
README

Cheers cwsoft
« Last Edit: September 07, 2012, 09:26:00 PM by cwsoft »

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Codesnippet: Anynews
« Reply #15 on: March 03, 2012, 10:27:04 PM »
Nice to see someone actively maintaining this often used snippet. Thanks for your efforts.

It would be nice to see offical section support added to it, besides groups support. There is a hack somewhere on the forums that shows how to use AnyNews with section ID, but that never made it into the official module. I believe few people use groups in News, most people would just use separate sections to show News about different subjects.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline cwsoft

  • Posts: 605
cwsoft-anynews v2.2.0 RC1 - available
« Reply #16 on: March 04, 2012, 08:47:08 PM »
Hello,

issued a first release candidate (RC1) of the upcoming cwsoft-anynews v2.2.0 at GitHub.

This version includes three improvements and additional features requested by forum users:
 1. the hardcoded "no news available" text can now be styled or removed via Anynews template files
 2. the flag $lang_filter allows to remove news entries not matching the defined $lang_id
 3. values of group_id can now be linked to group_id, page_id, section_id or post_id

Apart from that a bug in the language file inclusion of v2.1.0 was fixed.

The cwsoft-anynews v2.2.0 function signature has changed as follows:
The last two parameter are new and where added to the end of the function to not break older Anynews function calls. Paramter $group_id_type defaults to "group_id", paramter $lang_filter to false, which is the default behaviour of previous Anynews versions.

Code: [Select]
<?php
function displayNewsItems(
  
$group_id 0,                  // IDs of news to show, matching defined $group_id_type (default:=0, all news, 0..N, or array(2,4,5,N) to limit news to IDs matching $group_id_type)
  
$max_news_items 10,           // maximal number of news shown (default:= 10, min:=1, max:= 999)
  
$max_news_length = -1,          // maximal length of the short news text shown (default:=-1 => full news length)
  
$display_mode 1,              // 1:=details (default); 2:=list; 3:=coda-slider; 4:flexslider; 4-98 (custom template: display_mode_X.htt); 99:=cheat sheet
  
$lang_id 'AUTO',              // language file to load and lang_id used if $lang_filer = true (default:= auto, examples: AUTO, DE, EN)
  
$strip_tags true,             // true:=remove tags from short and long text (default:=true); false:=don´t strip tags
  
$allowed_tags '<p><a><img>',  // tags not striped off (default:='<p><a><img>')
  
$custom_placeholder false,    // false:= none (default), array('MY_VAR_1' => '%TAG%#', ... 'MY_VAR_N' => '#regex_N#' ...)
  
$sort_by 1,                   // 1:=position (default), 2:=posted_when, 3:=published_when (only WB 2.7), 4:= random order, 5:=number of comments
  
$sort_order 1,                // 1:=descending (default), 2:=ascending
  
$not_older_than 0,            // 0:=disabled (default), 0-999 (only show news `published_when` date <=x days; 12 hours:=0.5)
  
$group_id_type 'group_id',    // type used by group_id to extract news entries (supported: 'group_id', 'page_id', 'section_id', 'post_id')
  
$lang_filter false            // flag to enable language filter (default:= false, show only news from a news page, which language fits $lang_id)
);

Setting $lang_filter = true shows only news items added from a news page which LANGUAGE type matches $lang_id. If no news page exist for this LANGUAGE, all news entries will be shown instead.

Feedback welcome.

Cheers
« Last Edit: September 07, 2012, 09:27:06 PM by cwsoft »

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Codesnippet: Anynews
« Reply #17 on: March 04, 2012, 08:53:12 PM »
Looks very nice. Great to see the section-ID, page-ID and post-ID support added!
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline cwsoft

  • Posts: 605
cwsoft-anynews - translation needed
« Reply #18 on: March 05, 2012, 07:18:39 PM »
Hi,

forgot to mention that I do need some help in updating some cwsoft-anynews text outputs into the following languages: Estonian (EE.php), French (FR.php), Dutch (NL.php), Serbian (RS.php) for Anynews 2.2.0 stable.

English phrases which needs to be translated into languages above:
a) "For details please visit " GitHub. (GitHub needs no translation)
b) "Number of comments"

Would be great if a native speaker could review the cwsoft-anynews language files listed above for possible misspelling or grammar issues. You can post your translation/updates in this thread or send me a PM.

Thanks in advance
cwsoft
« Last Edit: September 07, 2012, 09:28:29 PM by cwsoft »

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Codesnippet: Anynews
« Reply #19 on: March 05, 2012, 09:10:38 PM »
Will do for Dutch.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #20 on: March 05, 2012, 10:59:52 PM »
@argos: thanks for your offer, looking forward to implement the updated NL files
« Last Edit: September 07, 2012, 09:28:47 PM by cwsoft »

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Codesnippet: Anynews
« Reply #21 on: March 06, 2012, 10:20:24 PM »
Here's the Dutch language file:

Code: [Select]
<?php
/**
 * Code snippet: anynews
 *
 * This code snippets grabs news from the WB news module database
 * 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 Dutch language output.
 * 
 * LICENSE: GNU General Public License 3.0
 * 
 * @platform    CMS WebsiteBaker 2.8.x
 * @package     anynews
 * @author      cwsoft (http://cwsoft.de)
 * @translation forum member Dave (ak D72), Argos
 * @version     2.2.0
 * @copyright   cwsoft
 * @license     http://www.gnu.org/licenses/gpl-3.0.html
*/

// Dutch module description
$module_description 'Snippet om nieuwsberichten te tonen op elke pagina die u maar wilt. Functie kan opgeroepen worden vanuit de template of een code-sectie. Meer informatie is te vinden op <a href="https://github.com/cwsoft/wb-anynews" target="_blank">GitHub</a>.';

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

$LANG['ANYNEWS'][0] = array(
// text outputs for the frontend
'TXT_HEADER' => 'Laatste nieuws'
'TXT_READMORE' => 'Lees meer'
'TXT_NO_NEWS' => 'Geen nieuws beschikbaar.',
'TXT_NEWS' => 'Nieuws'
'TXT_NUMBER_OF_COMMENTS' => 'Aantal reakties'

// date/time format: (9:12 PM, 31-12-2012)
'DATE_FORMAT' => ' (d-m-Y, H:M)'
);
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #22 on: March 07, 2012, 05:34:57 PM »
Thanks Argos, highly appreciated.
« Last Edit: September 07, 2012, 09:30:02 PM by cwsoft »

Offline mdemaree99

  • Posts: 102
Re: Codesnippet: Anynews
« Reply #23 on: March 07, 2012, 07:09:13 PM »
Is anybody else is having issues with the new module using the sliders?

In both the coda and flex sliders I get about a 5 second delay / lag before the slider starts working.
Had similar issues in previous version with coda, but it wasn't as bad (maybe 1-2 sec)

I have included the screen shots.  Top is initial image that is shown for about 5 sec on coda and a little longer in flexslider.  It may be the same time, but seems longer with nothing showing on the screen.

After a little testing..I thought this may be tied to the interval or duration, but changing values just seemed to shorten or lengthen after the slider actually appeared.  Still had about a 5 sec delay.  Are these scripts really this slow?  Possible compress to run faster?  Any other values I may be missing?

On a side note..I was was looking at the js files.  Great notes and love the idea of separating the custom js from the 3rd party js.  However...The custom aspects of the coda slider are located in 3rd party folder.
Would suggest separating a few of the settings to the custom js file.



 




[gelöscht durch Administrator]

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #24 on: March 07, 2012, 07:36:32 PM »
Hi,

could you please provide the infos listed at the bottom of the cwsoft-anynews README file? In addition please provide details on your browser, browser version. A link to a live side would be helpfull if available.

Tested cwsoft-anynews with Firefox 10.2 with better-coda-slider and flexslider at one page. Both news show up immediatelly and react independant of each other without issues. If you are using more than one slider effect per page, try to reduce it to one sliding effect per page and check if that solves your issue. Don't know if files included via jQuery $.insert plugin are cached, as done with files included e.g. via link statements in the head section of a HTML file. If you still experience issues, try to check the loading / request time with browser tools like Firebug to identify the bottle neck.

Quote
Great notes and love the idea of separating the custom js from the 3rd party js.  However...The custom aspects of the coda slider are located in 3rd party folder.
Thanks. Unfortunatelly, the old "better-coda-slider" is not build as jQuey plugin and not maintained by the developer anymore. If someone wants to create a plugin from the files included, please do so. Will than update my files accordingly. I keept the "better-coda-slider" mainly for backwards compatibility, but would recommend to switch to flexslider instead. As alternative you may want to implement another jQuery plugin, which should be fairly simple with the updated cwsoft-anynews version :wink:

Cheers

[gelöscht durch Administrator]
« Last Edit: September 07, 2012, 09:30:56 PM by cwsoft »