Code Snippet: Display news items, anywhere

doc

Hi,

first of all, please try to raise your question in the correct module thread. The module thread for discussion are normally linked on AMASP or the WebsiteBaker Addons repository.

Now to your question. Have you checked out the Coda Slider stuff integrated since Anynews v1.00? This should give you a good starting point for Javascript driven News output. If you have already a working JS script, maybe post the link so other users may be able to pick it up and to create a working demo.

Regards Christian

Maybe a forum administrator can move this thread into the Anynews thread.

mylesk42

Hi everybody,

Has anyone tried to have a News scroller in DHTML to show news via the AnyNews module and to keep the linking to the news itself ?

Regards

doc

#300
Hi,

just released v1.10 of the Anynews code snippet on the WebsiteBaker Add-ons repository.
The English Readme file is up to date, the Dutch one is outdated and needs to be updated.

Applied changes:
Added some more default placeholder which can be used in the output (e.g. {DISPLAY_NAME}, {USERNAME}, {GROUP_TITLE} ... The full list of placeholders available can be found in the template file: custom_output_display_mode_4.htt ($display_mode:=4).

More advanced feature:
The function parameter $show_publish_date was replaced with the new parameter $custom_placeholder which allows users to define their own placholder variables by regular expression. If the regular expression matches, additional placeholders are avaialbe for usage in the template files. Details about this can be found in the README file.

If you have used $show_publish_date = false to hide the publish dates, just remove   the placeholder {PUBLISH_WHEN} from your template filed (folder /htt) to achieve the same effect.

Example:
$custom_placeholder:= array('IMG_LINK' => '%img%', 'MY_VAR' => '#(test)#i')

The code above searches the long and short news content for optional image tags (%img%) and text string 'test' (#(test)#i). Assuming, the news long text field contains two image tags and both, short and long text field contains the string 'test', the following additional placeholders can be used inf the template files:

LONG_IMG_LINK_1, LONG_IMG_LINK_2
SHORT_MY_VAR_1, LONG_MY_VAR_1


User defined variable names (e.g. MY_VAR turns into: PREFIX_MY_VAR_INDEX, where PREFIX is LONG/SHORT for long or short content field).

Have fun
Christian

Luisehahne

Hi,

or look at this

YCodaSlider 3.0

Copyright (c) 2009 Massimiliano Balestrieri
Examples and docs at: http://maxb.net/blog/

greetings
Dietmar
Note: Once the code has been generated, it is easy to debug. It's not a bug, it's a feature!

doc

#298
Hi Ruud,

seems jqueryfordesigners.com had some server problems. Tried it some seconds ago and the demo seems to work again.: http://jqueryfordesigners.com/demo/coda-slider.html

The Anynews Coda Slider output is very close to the one posted at jqueryfordesigners.com. Just give it a try on a local test environment, it isn´t that much work to set it up  :-)

Regards Christian

P.S.: In case it does not work, I can send you a link with the pure HTML files for the Coda Slider demo.

Ruud

Sounds great,

Quote from: doc on May 26, 2009, 03:56:50 PM
The latest version includes a new display options ($display_option = 3) which uses jQuery and some JQuery-Plugins developed by Ariel Flesler to display news with the Coda Slider Effect.

Do you have a demo of this one somewhere? (could use it for a new article on my site)

Ruud
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

doc

#296
Hello,

just released v1.00 of the Anynews code snippet on the WebsiteBaker Add-ons repository.
The English Readme file is up to date, the Dutch one needs to be updated.

Changes:
The latest version includes a new display options ($display_option = 3) which uses jQuery and some JQuery-Plugins developed by Ariel Flesler to display news with the Coda Slider Effect.

To use this option, one needs to add an additional code line into the index.php file of your template.
<?php include_once(WB_PATH '/modules/anynews/coda-slider.inc.php'); ?>

This mode does also work with Javascript disabled, but without visual effect in that case.

Have fun
Christian

Deleen

Forgot my problem - i found a asolution, the character setup was to short - is news leght was 50 - if i set it heigher, it works :) .

Greats, Kathleen

Deleen

Hello,

i am also start to use anynews in my project. By the way - these picture Problem is also on my side.
Soon as i have a Picture in the short test it is break. I put the outputfilter to "false" and i try with "true" and allow <img>-tag.

I have already the newest version. I saw - this problem was nemes in the tread - but i couls not found real solution. So please - can somebody help?

doc

#293
Hello,

just released v0.94 of Anynews which includes the Dutch language file and the Dutch README file contributed by the forum member Dave (ak D72). Funny to see a Dutch README before a German one  :-)

Dave, thank you very much for your support - highly appreciated.

Regards Christian

doc

Hi,

@eazybaker: WB is following the ISO 3166-1 language codes (2 characters).

Regards Christian

eazybaker

Quote from: doc on May 08, 2009, 12:05:34 AM
Hi,

@eazybaker:
Quote from: eazybakerYes Estonia language file exists for the WebsiteBaker backend and its EE not EST,so i made mistake,sry abot that
Strange, I found no EE.php in the WB /language folder. But anyway, thanks for your contribution  :wink:
Regards Christian

Yes,becaue i didnt looked into website backer languages folder before :wink:

i found this http://en.wikipedia.org/wiki/Estonian_language and there are only et,and est,but i have seen ee also on many translated scripts,so i think its ok :-)

doc

Hi,

@eazybaker:
Quote from: eazybakerYes Estonia language file exists for the WebsiteBaker backend and its EE not EST,so i made mistake,sry abot that
Strange, I found no EE.php in the WB /language folder. But anyway, thanks for your contribution  :wink:

@D72:
Quote from: D72In order to truncated the titles of anyNews, i shall check this out. I'm not sure about my mysql and database skills, but maybe the the include.php page explains enough for me. I'm certainly give it a try.
Check out php.net to give it a try. If you fail with your attempts, simply show what you tried and ask for help in this thread.

Quote from: D72Also, are you still in the need of a Dutch translation?
Sure, so far German, English and Estonian language is supported by default. Just translate DE.php or EN.php (what ever fits best) to NL.php. Please send me a PM once you are done and I will add your translation to the module.

Quote from: D72... Nice module, but for a beginner... a pain in the ass...
Fully agree. The snippet started with a few options but has grown over time. Any kind of help (e.g. with the README file etc.) is therefore welcome. Sometimes it is hard for a "developer" to write a documentation which fits the needs of the "end users".

Regards Christian

eazybaker

Quote
You can add all English news to its own group and all Estonian news to another group. Than you can set the first parameter of Anynews to show one of the groups depending on your page / section.
Regards Christian

thank you,i didnt know about this,because i make my first website with WebsiteBaker


Quote from: doc on May 07, 2009, 06:51:36 PM
Hi,

@eazybaker:
Thanks for the language file. By the way. Does a Estonia language file exists for the WebsiteBaker backend? Guess it should be EE.php but I haven´t found one yet.

Yes Estonia language file exists for the WebsiteBaker backend and its EE not EST,so i made mistake,sry abot that


D72

Quote from: doc
Hi,
...
Regards Christian

Hello Christian,
Thanks for answering.
In order to truncated the titles of anyNews, i shall check this out. I'm not sure about my mysql and database skills, but maybe the the include.php page explains enough for me. I'm certainly give it a try.
About getting headlines by anyNews of the EventCalender...
I will ask this question in the topic of Event Calendar. Maybe someone in there got a brilliant idea.

Also, are you still in the need of a Dutch translation?
I thought it allready has a Dutch file in it.
Wich files should be translated? Only translate EN.php to a NL.php ?
Otherwise, count me in to translate it for you.
It's a good exercise for me to get AnyNews better... Nice module, but for a beginner... a pain in the ass...

doc

Hello,

just released Anynews v0.93 which includes the Estonian language file contributed by the forum member eazybaker.
At eazybaker - thanks for your contribution, highly appreciated.

Regards Christian

doc

Hi,

@eazybaker:
Thanks for the language file. By the way. Does a Estonia language file exists for the WebsiteBaker backend? Guess it should be EE.php but I haven´t found one yet.

Quote from: eazybaker... but can i modify it somehow to display only news from that language what i choose???
You can add all English news to its own group and all Estonian news to another group. Than you can set the first parameter of Anynews to show one of the groups depending on your page / section.

@D72:
Quote from: D72Is it possible to get the title truncated to a certain amount?
Sure, but you need to adapt the Anynews code to achieve that. Check for line 187 in the file include.php. This line needs to be adapted e.g. with substr to truncate the title after XX characters.

Quote from: D72Is it possible to show the latest events from Event Calendar
Well the tool is called anynews not anyeventcalendar, so the answer is no. However, you could copy Anynews rename it to anycalendar and adapt the database queries to fetch content from the calendar table.

Quote from: D72Is there any way to grab the latest 4 events with AnyNews?
Yes and the HowTo is explained in the README file of the module.

Regards Christian

D72

Hello, i've got two questions.

  • Is it possible to get the title truncated to a certain amount?
  • Is it possible to show the latest events from Event Calendar
On a website i use 'Event Calendar' and the module it self doesnt have the possibility to show the latest
events listed in a block.
Is there any way to grab the latest 4 events with AnyNews?

eazybaker

#284
Quote from: doc on May 06, 2009, 08:56:36 PM

If you have created a new Anynews language file, please add it as XX.txt file to this thread and I will add it with a next release of Anynews.

Regards Christian

Hi,tnx i got it working.

Also is it possible to modify it like: when i click on english,it display only news i added to this language,when i click on estonian,then it display only estonian news???
now i have all news i posted on two languages,but can i modify it somehow to display only news from that language what i choose???

Added Estonian language file for anynews as attachment

thank you

[gelöscht durch Administrator]

doc

#283
Hello,

please check out the latest Anynews version, which includes a feature to automatically detect the language from the URL or from the page or section language defined via WB. Details about this feature can be found in Section C of the Anynews README file.

To make this feature working for languages other than German or English, you need to create a Anynews language file for your language and copy it to the Anynews language folder. Currently supported languages are: German (DE.php) and English (EN.php).

If you have created a new Anynews language file, please add it as XX.txt file to this thread and I will add it with a next release of Anynews.

By the way, Anynews language files in other languages like Dutch etc. are also appreciated  :wink:

Regards Christian

eazybaker

Quote from: Ruud on October 21, 2008, 02:28:55 PM
I've done this by using 2 news groups. Dutch / English
I didn't set the language in the pages, but used a /pages/en/ or /pages/nl/ page structure.


<?php
$url 
$_SERVER['REQUEST_URI'];
if (
function_exists('display_news_items'))  {
  if (
strrpos($url,"/en/"))  {
    
display_news_items(1,3,-1,1,"Latest news","read more","No news available",false); 
  } else {
    
display_news_items(2,3,-1,1,"Laatste nieuws","verder lezen","geen nieuws beschikbaar",false); 
  }

?>



Ruud

Hi,i tried that code,but its not working for me,because i use estonian and english language on my site,so
my question is,how i must modify that code to make it work?
thank you :-)

My  Page structure looks like this:

abidan

Hmmmmmmmmm i think it must have been me doing something wrong (probably due to 2 glasses of wine lol) because when i tried it all again this morning it all worked!!!! strange

Thanks for advice anyway :)

doc

Hi,

please update your function call to the latest version available. The stuff like 'read more' etc. is no longer supported.
The function parameters are described in the Anynews README file. If not already done, please update to version 0.92 of Anynews.

Regards Christian

abidan

Hi

I am having trouble getting the array function to work with this module. This is what I am putting into my index file to show in my menu:
<?php
            displayNewsItems(array(1,3,4,6,7,8,9), 5, 50, 2,
                  '<h2 class="rightmenu"><a href="/pages/articles-tutorials.php">Latest Articles</a></h2>', 'read more', 'no articles available', false, '<a>', false, '', 1, 1);
              ?>
This should show the related groups news items in the array i have specified, but whenefver i use the array functions instead of eitehr 0 for all or X for a particular group it returns "no articles avaliable" even thoug htere are news groups with the numbers in the array?

I simply cant get the array part to work? has anyone got any ideas?

doc

#278
Hello,

just released v0.92 of the Anynews code snippet on the WebsiteBaker Add-ons repository.
The Readme file is up to date.

Main changes:
- removed legacy support for outdated WebsiteBaker versions 2.6.x and below (requires WB 2.7 or higher to work)
- reworked the parameter sanity checks and moved routine into functions file
- removed surrounding <p> tags from {CONTENT_SHORT} placeholder (added '<p>' to allowed tag list)
- code clean up
- replaced old function calls in file comment blocks with the new call (v0.91)
- removed obsolete variables and debug information (v0.92)

The support of Anynews for WebsiteBaker versions 2.6.x or lower has expired with Anynews v0.90. Since Anynes v0.90 you need WebsiteBaker 2.7 or higher as minimum requirement for Anynews.

Installation / Update:
Delete any previous version via the WB backend. Then install the latest version.

Note:
If you want to upgrade from an Anynews version older than v0.70, you need to update your functions calls and templates as explained in this post.

Regards Christian