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

Offline mdemaree99

  • Posts: 102
Re: Codesnippet: Anynews
« Reply #25 on: March 08, 2012, 01:02:48 AM »
I tested like you did and just put the slider on a page by itself.
Along with testing 3 other templates I still get a lag.  However I am noticing I may have some errors in my templates.  They are working fine in the actual website, but when I created the testing area  things aren't quite loading up correctly for some reason.  (code sections are looking funny)  Fine on rest of my pages.  Not sure what is up.


Testing site:
Main page is www.jlarlington.org/jlabaker and has the biggest lag.
Tons of stuff on this page so I can see why it takes a big, but nothing else seems to load up slow.
I made a few test pages for Anynews here:
http://www.jlarlington.org/jlabaker/pages/testing/anynews-testing.php

Test pages aren't to bad, but just the module by itself.
Test 1 is the fastest with the CSS
Templates do have the testing to see if something contains data. 
I believe that has given a few modules problems..
Code: [Select]
<?php
        ob_start
();
        
show_menu2(0SM2_CURR+1SM2_CURR+1);
        
$childmenu ob_get_contents();
        
ob_end_clean();
?>


Test 2 and 3 are about the same.
I put the PHP info in the test area as well.  I was able to get the php version, but wow it is running slow.
Not quite sure why it is taking forever to load. 

For the time being I put a small work around in.  I changed overflow to hidden in the better-coda-slider.css
By updating the   .scroll  thescroll-bar so it just appears 1st slide is active longer than the rest and then the arrows appear.  Just need to tweak for final output.

.scroll {
   height: 150px;
   width: 450px;
   overflow: hidden;
   overflow-x: hidden;
   position: relative;
   clear: left;
   background: #FFF url(images/content_gradient.gif) repeat-x scroll left bottom;



Detailed error description (what happens, what have you tried ...)
- lag..of 2-5 sec before slider is active

Anynews version (go to WebsiteBaker section Add-ons / Info / Anynews)
Anynews 2.2.0-RC2


PHP version

PHP Version 5.2.11

System    
Windows NT IIS01801 5.2 build 3790    
Know the windows server is a big killer for me..

WebsiteBaker version
Revision 1528
Admin version 1.6

WebsiteBaker frontent template
- Custom templates - Initial glassbury and simplecss.

Changes you made to WebsiteBaker
- No changes to WebsiteBaker, but had to make a minor change to library-admin due to the windows server.

Browsers:
Firefox 3.6.24 and Internet explorer 8 and 9


Thanks for the info on firebug.  I was searching the web for online items to speed it see where the bottleneck was.  Always good when the solution is free.l

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #26 on: March 08, 2012, 06:53:02 PM »
@mdemaree99

Thanks for the exhaustive details.

Quote from: mdemaree99
I put the PHP info in the test area as well.  I was able to get the php version, but wow it is running slow.
My browser required 15 seconds to display the PHP info (which you never should t make public by the way) from your website. On my website it takes about 560 micro seconds to display the PHP info, which is a factor of 26. So yes, there is something wrong on your site.

According the Firebug Network protocoll, your main page (the one with the biggest lag) has a lot of HTTP request (43) and needs about 14 seconds to load all files. Your main site needs 8s until the DOM is ready, which is the trigger to fire up the jQuery stuff. So before the jQuery slider starts working, it takes at least 8s time to load all the content of your main site. To load all Javascript and CSS files takes about 6s.

The "better-coda-slider" consumes 7 HTTP requests (5 to load the original JS and CSS files) and another two for the customized JS and CSS. In total the "better-coda-slider" consumes around 4.4 seconds loading time. Flexslider needs less requests and resources. As the "better-coda-slider" tries to be unobstrusive, it displays the slider icons (left, right arrows) only if Javascript is enabled AND the DOM is ready. This could be used as a sort of visual measure for load optimization.

I doubt that Anynews is the real issue maker here. I would contact your webhosting company and ask for advice. The long loading time until the PHP infos are displayed and the 8s to get the DOM ready seems quite long. If you want to have a sort of protocoll with elements, requests, file size and loading time, you can use other online services as well, such as http://analyze.websiteoptimization.com

Sorry, think I can't really help you on that issue.

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

Offline cwsoft

  • Posts: 605
cwsoft-anynews v2.2.0 STABLE - released
« Reply #27 on: March 09, 2012, 08:39:45 PM »
Hello,

just released cwsoft-anynews V2.2.0 STABLE at GitHub.

Minimum requirements:
 - WebsiteBaker 2.8.2 (recommended last stable 2.8.x version)
 - WebsiteBaker news module installed
 - PHP 5.2.2 (recommended last stable 5.3.x version)

Updates since cwsoft-anynews v2.1.0
 1. hardcoded "no news available" text can now be customized from the template files
 2. new flag $lang_filter allows to remove news entries not matching the defined $lang_id
 3. now possible to filter news by group_id, page_id, section_id or post_id
 4. included updated Dutch language file (thanks to forum user Argos)

Cheers
« Last Edit: September 07, 2012, 09:32:18 PM by cwsoft »

Offline sky writer

  • Posts: 926
Re: Codesnippet: Anynews
« Reply #28 on: April 11, 2012, 02:57:32 AM »
One of the features I like about the News module is the pagination.  But I have a site where there are a bunch of News sections which we want to show combined on one page, so AnyNews seems perfect EXCEPT it does not paginate, so we either have to choose the number of news items we want to allow on the page (for example 10) and then anything older than that is no longer accessible, or we have to set the limit to zero so that all (could be hundreds) news items show.

Is there any way that this pagination feature could be integrated into AnyNews?

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #29 on: April 11, 2012, 08:54:22 AM »
Hello,

Quote from: sky writer
Is there any way that this pagination feature could be integrated into AnyNews?
Of course, everything can be integrated :wink:

The easiest way without modifying the Anynews code itself is to create a custom template, which implements one of the free available jQuery Paginator Plugins.

Create a template with jQuery Smart-Paginator Plugin:
 1. download jQuery Smart Paginator
 2. copy the CSS and Javascript files to cwsoft-anynews/thirdparty/smartpaginator
 3. create a copy cwsoft-anynews/templates/display_mode_4.htt --> e.g. display_mode_5.htt
 4. adapt CSS / JS inclusion to load the paginator files
 5. change Anynews template according the Smart Paginator example (smartpaginator.htm)

Another option is to organize the news you want to display in groups and to use the WebsiteBaker news module instead of cwsoft-anynews.

Hope this helps.

Cheers
« Last Edit: September 07, 2012, 09:33:16 PM by cwsoft »

daydreamer

  • Guest
Re: Codesnippet: Anynews
« Reply #30 on: May 01, 2012, 03:43:31 PM »
Thanks for the update of anynews, one question is it possible to truncate the title?

Thanks

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #31 on: May 01, 2012, 08:31:42 PM »
Hi,

Quote from: daydreamer
... one question is it possible to truncate the title?
Without touching the code, this can be realized with a custom Anynews template implementing one of the available jQuery truncate plugins. Reciept for implementation similar to this post.

Another option is to add this feature to your cwsoft-anynews module code by wrapping the PHP function substr around this code line as shown below (replace X with numbers of characters to show):
Code: [Select]
'TITLE' => substr(($strip_tags) ? strip_tags($row['title']) : $row['title'], 0, X),

Future planning:
With the next major cwsoft-anynews release (most likely with WB 2.9 if not covered by the core itself), Anynews will provide a more flexible customization using a config object instead of optional function parameters and switch the template engine to something more flexible, allowing loops, if statements or truncation in the template itself (switched to Template engine Twig with cwsoft-anynews v2.3.0). This step should solve most "architectural limitations" of todays Anynews snippet.

For the time beeing, you have to implement one of the two solutions above by your own - sorry  :wink:

Update 16th May 2012
Since cwsoft-anynews v2.3.0, the above feature request can easily be realized via a customized template:
Code: [Select]
{{ news.TITLE | slice(0,X) }}

Cheers
« Last Edit: September 07, 2012, 09:35:13 PM by cwsoft »

Offline marmot

  • Posts: 1103
Re: Codesnippet: Anynews
« Reply #32 on: May 01, 2012, 09:20:36 PM »
Hi,
Thanks for the update of anynews, one question is it possible to truncate the title?
I made this droplet for truncating the shorttext of news module without using jQuery. Maybe you can adapt it for your needs.

regards

daydreamer

  • Guest
Re: Codesnippet: Anynews
« Reply #33 on: May 01, 2012, 10:24:48 PM »
Thanks guys for the help

daydreamer

  • Guest
Re: Codesnippet: Anynews
« Reply #34 on: May 01, 2012, 10:33:49 PM »
@cwsoft this works great

Code: [Select]
'TITLE' => substr(($strip_tags) ? strip_tags($row['title']) : $row['title'], 0, X),
Thanks

Offline cwsoft

  • Posts: 605
cwsoft-anynews v2.3.0 STABLE - released
« Reply #35 on: May 05, 2012, 02:43:32 PM »
Hello,

just released cwsoft-anynews v2.3.0 STABLE at GitHub.

This release replaces the outdated phplib template parser with the more flexible, fast, maintained and well documented template parser Twig. For convenience, Twig is distributed with cwsoft-anynews (thirdparty folder). All templates where updated and work like in previous releases.

The more flexible template parser allows to implement most of the recent requested features by the template itself and hence without touching the module code. If you want to learn more about Twig, visit http://twig.sensiolabs.org/doc/templates.html

Infos & Download
 - README
 - download latest installation package
 - view or post known issues

Feedback welcome.

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

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Codesnippet: Anynews
« Reply #36 on: May 06, 2012, 10:25:02 PM »
Hello,
I have a suggestion to make which will make this snippet even more user friendly.

In file include.php
LINE 75

suggestion:
Code: [Select]
<?php // ignore opening tag

$loader = new Twig_Loader_Filesystem(array(WB_PATH.'/templates/' .TEMPLATE'/anynews'dirname(__FILE__) . '/templates'));

and 83 ff.

Code: [Select]
<?php // ignore opening tag
/**
 * Load Anynews Twig template specified via $display_mode
 */
 
if (file_exists(WB_PATH.'/templates/' .TEMPLATE'/anynews/display_mode_' $display_mode '.htt')) {
$tpl $twig->loadTemplate('display_mode_' $display_mode '.htt');
}elseif (file_exists(dirname(__FILE__) . '/templates/display_mode_' $display_mode '.htt')) {
$tpl $twig->loadTemplate('display_mode_' $display_mode '.htt');
} else {
$tpl $twig->loadTemplate('display_mode_1.htt');
}

The snippet will look into my template (the template of the page) first, before it will look into the templates/ directory of anynews. Thus you have the opportunity to even ship the "skin" (template) of anynews together with the WebsiteBaker-template.


Kind regards,
Christian
« Last Edit: May 06, 2012, 10:27:01 PM by Stefek »
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #37 on: May 06, 2012, 11:44:46 PM »
Hello,

thanks for your suggestion.

Not too sure if this is really a benefit with respect to "simplicity" in mind or adds more confusion for new users (e.g. CSS is still one single file located in anynews/css). I also doubt that there are many use cases for this feature (at least in this form).

Anyway, if more users do see a need for this feature and request to implement it, I will think about adding it to one of the next Anynews release.

cwsoft
« Last Edit: September 07, 2012, 09:36:56 PM by cwsoft »

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Codesnippet: Anynews
« Reply #38 on: May 06, 2012, 11:52:12 PM »
OK.

I got it implemented since some time.
The new template engine supports the inclusion from different sources even better.

Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3084
  • Gender: Female
Re: Codesnippet: Anynews
« Reply #39 on: May 07, 2012, 02:02:41 AM »

suggestion:
Code: [Select]
<?php // ignore opening tag

$loader = new Twig_Loader_Filesystem(array(WB_PATH.'/templates/' .TEMPLATE'/anynews'dirname(__FILE__) . '/templates'));

// and 83 ff.

/**
 * Load Anynews Twig template specified via $display_mode
 */
if (file_exists(WB_PATH.'/templates/' .TEMPLATE'/anynews/display_mode_' $display_mode '.htt')) {
$tpl $twig->loadTemplate('display_mode_' $display_mode '.htt');
}elseif (file_exists(dirname(__FILE__) . '/templates/display_mode_' $display_mode '.htt')) {
$tpl $twig->loadTemplate('display_mode_' $display_mode '.htt');
} else {
$tpl $twig->loadTemplate('display_mode_1.htt');
}

to make it a little bit more easy... ;-)
Code: [Select]
<?php

$loader = new Twig_Loader_Filesystem(array(WB_PATH.'/templates/'.TEMPLATE.'/anynews'dirname(__FILE__).'/templates'));
// throws an exception if a given directory not exists

// and 83 ff.

try{
$tpl $twig->loadTemplate('display_mode_'.$display_mode.'.htt');
}catch(Twig_Error_Loader $e){
// if first loadTemplate() fails, catch exception and try to load default template
$tpl $twig->loadTemplate('display_mode_1.htt');
}

only if really no template file is found, an exception will be thrown.
Why not use the possibilities of OOP...  ;-)
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 Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Codesnippet: Anynews
« Reply #40 on: May 07, 2012, 04:04:16 PM »
Cool Werner,
that's even better.

// EDIT

But there is still a problem with the implementation.
Not any TEMPLATE will have the 'anynews' directory and it's not possible to make in mandatory within TEMPLATEs in order to run the anynews snippet (not anyone will like the idea to "patch" his TEMPLATE in order to use the snippet).

How can I code a statement that the $loader should add the WB_PATH.'/templates/'.TEMPLATE.'/anynews' directory at the beginning at the array ONLY if the directory exists?
Using my current knowledge I wold do it in this way:

Code: [Select]
<?php // ignore opening php tag

/**
 * Create Twig template object and configure it
 */
require_once (WB_PATH.'/include/Twig/Twig/Autoloader.php');
Twig_Autoloader::register();
$aLoaderDir = array(dirname(__FILE__) . '/templates');
if(
file_exists(WB_PATH.'/templates/' .TEMPLATE'/anynews')){
// put TEMPLATE.'/anynews' Directory at the beginning of array if it exists
array_unshift($aLoaderDirWB_PATH.'/templates/' .TEMPLATE'/anynews');
}

$loader = new Twig_Loader_Filesystem($aLoaderDir);



but I am sure there is another way, more convenient and cleaner.

KR,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3084
  • Gender: Female
Re: Codesnippet: Anynews
« Reply #41 on: May 07, 2012, 04:26:32 PM »
A little bit shorter:   ;-)

Code: [Select]
<?php // ignore opening php tag

/** Create Twig template object and configure it  */

/* from WB2.8.x Rev.1687 the Twig_autoloader ist activated by default
   so it [u][b]never[/b][/u] should be loaded or registered explicite! 

// require_once (WB_PATH.'/include/Twig/Twig/Autoloader.php');
// Twig_Autoloader::register();
*/
try{
$loader = new Twig_Loader_Filesystem(WB_PATH.'/templates/'.TEMPLATE.'/anynews');
$loader->addPath(dirname(__FILE__).'/templates');
}catch(Twig_Error_Loader $e) {
$loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/templates');
}


Have a look inside the class documentation (or the classes itself). You will find an endless bunch of possibilities. ;-)
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 Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Codesnippet: Anynews
« Reply #42 on: May 07, 2012, 04:33:36 PM »
It seems the AnyNews module/snippet is becoming more advanced and complex than the News module itself... Isn't it better to put the effort into the core module itself? It could use a whole lot of improvement, like custom fields, pagination in backend, image support, more flexible backend and frontend ordering, etc.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Codesnippet: Anynews
« Reply #43 on: May 07, 2012, 04:47:33 PM »
Thanks Werner. That's what I thought should be possible.
Quote
Have a look inside the class documentation (or the classes itself). You will find an endless bunch of possibilities
I will.

@Argos
I think the Modules will evolve into the right direction soon.

Kind Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3084
  • Gender: Female
Re: Codesnippet: Anynews
« Reply #44 on: May 07, 2012, 05:27:24 PM »
It seems the AnyNews module/snippet is becoming more advanced and complex than the News module itself...

Jurgen, thats right. And it's really good in this way.
The Basic module provides the Basics...  and other Modules extends them.
It's the sense of modular design.
In future WB shall become much more modular then now. - but with clear rules how to do and a predefined structure too -
 
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 Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Codesnippet: Anynews
« Reply #45 on: May 07, 2012, 05:37:00 PM »
I really meant that the News module input/backend options and flexibility are getting less attention than output/frontend options, which is for me the wrong focus. The core module lacks powerful possibilities, and is essentially the same as it was in version 2.6.4, when I first started working with WB. Again and again I find myself struggling with missing essential features in WB. I am seriously testing Wordpress and other systems now because I cannot move forward with WB in certain directions. It's perfect for rather simple, semi-static sites, but above that it's lacking severely in ithe kind of flexibility and power I need for bigger clients.

But that's another matter, we should not really discuss here. It's great to see AnyNews being developed.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #46 on: May 07, 2012, 06:31:58 PM »
Hi,

@Stefek: Details about Twig (including all the hints from Werner below like try, except, multiple templates) can be found in the Twig PDF (129 pages). As starting point, just work through the official documentation

Quote from: argos
It seems the AnyNews module/snippet is becoming more advanced and complex than the News module itself.
Regarding complexity. Anynews was developed with the main audience of "medium to advanced users" in mind. Regarding flexibility. Anynews was designed to aggregate news from the WB news module in various ways in order to display them in the frontend with more design and layout possibilities than offered by the WB news module.

Quote from: argos
It's great to see AnyNews being developed.
For the WB 2.8.x series, I do not plan to add much new features to cwsoft-anynews (v2.3.0), unless there is a huge demand and push from the user base and a sound reason for doing so. So cwsoft-anynews is not really developed but maintained :wink:

Quote from: argos
I really meant that the News module input/backend options and flexibility are getting less attention than output/frontend options
Some forum posts indicate that for WB 2.9, there will be a entirely rewrite of the News module, with much for features, better user experience and much more :wink: Lets see if cwsoft-anynews will still have a niche in WB 2.9 eco system.

Cheers
« Last Edit: September 07, 2012, 09:38:05 PM by cwsoft »

Offline cwsoft

  • Posts: 605
cwsoft-anynews v2.4.0 STABLE released
« Reply #47 on: May 08, 2012, 05:55:06 PM »
Hello,

just released cwsoft-anynews v2.4.0 STABLE at GitHub.

Updates since cwsoft-anynews v2.3.0
 1. added compatibility fix for the upcoming WB 2.8.3 hotfix (thanks to ruebenwurzel for the notice)
    (Background: with WB 2.8.3 SVN #1688, Twig is part of the WB core and will be registered by default)
 2. this release ensures that Anynews works on WB 2.8.2 and all 2.8.3 versions as usual

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

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Codesnippet: Anynews
« Reply #48 on: June 06, 2012, 03:46:18 PM »
Small but important Dutch language file fix:

Change line:
'DATE_FORMAT'            => '  (d-m-Y, H:M')
into:
'DATE_FORMAT'            => ' d-m-Y, H:i'

An 'M' stands for 'month', while an 'i' stands for 'minutes'. An i is of course required here, instead of an M.

I also left out the () and the leading space in that line. It's markup, and should be added in the template files if wanted.
« Last Edit: June 06, 2012, 09:33:12 PM by Argos »
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline cwsoft

  • Posts: 605
Re: cwsoft-anynews
« Reply #49 on: June 06, 2012, 07:38:53 PM »
Hi Argos,

thanks for your notice. Already fixed this on Github, so it will be issued with the next Anynews version.

I basically just copied over your initial Dutch language files you posted here without further checking. According the PHP date manual, H:M should be replaced with H:i, not as you proposed with [H:m]  :wink:
[EDIT by argos: I changed my post above to prevent mistakes]

Not too sure about your proposal to move the () to the template instead of the data format. Will see if I change it or keep it as it was up to know since the very first releases of Anynews.

Cheers
« Last Edit: September 07, 2012, 09:38:51 PM by cwsoft »

 

postern-length