Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
March 21, 2010, 06:00:06 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
WB 2.8.1 veröffentlicht!
Download und weitere Informationen gibt es
hier
.
110567
Posts in
15967
Topics by
9310
Members
Latest Member:
stevenris10
WebsiteBaker Community Forum
English
Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
(Moderators:
Argos
,
BerndJM
)
Code Snippet: Display news items, anywhere
Pages:
1
...
10
11
[
12
]
13
14
...
19
Author
Topic: Code Snippet: Display news items, anywhere (Read 65536 times)
doc
Offline
Posts: 3581
Code Snippet: Anynews
«
Reply #275 on:
April 14, 2009, 10:05:42 PM »
Hello,
just released
v0.71
of the Anynews code snippet on the Website Baker
Add-ons repository
.
The
Readme file
was updated accordingly and explains the parameters to use.
Modifications with respect to previous version:
~ moved language specific text outputs (e.g. read more, date/time format settings) to language files
- removed parameters: $header_text, $readmore_text, $no_news_text, $date_time_format
+ removed support for outdated function call
display_news_items()
+ use
displayNewsItems()
instead
+ added option to output news in random order ($sort_by = 4 as requested in the German forum)
Installation / Update:
Delete a previous version via the WB backend. Then install the latest version from the backend.
Remember to adapt your function parameters in code sections and/or the index.php file of your template!!!
Old parameter list:
Code:
<?php
<?
php displayNewsItems
(
$group_id
,
$max_news_items
,
$max_news_length
,
$display_mode
,
$header_text
,
$readmore_text
,
$no_news_text
,
$strip_tags
,
$allowed_tags
,
$show_publish_date
,
$date_time_format
,
$sort_by
,
$sort_order
,
$not_older_than
);
?>
?>
New parameter list:
Code:
<?php
displayNewsItems
(
$group_id
,
$max_news_items
,
$max_news_length
,
$display_mode
,
$lang_id
,
$strip_tags
,
$allowed_tags
,
$show_publish_date
,
$sort_by
,
$sort_order
,
$not_older_than
);
?>
If you use custom template files, check and replace the following placeholders:
Code:
{ARG_HEADER_TEXT} --> {TXT_HEADER}
{ARG_READMORE_TEXT} --> {TXT_READMORE}
{ARG_NO_NEWS_TEXT} --> {TXT_NO_NEWS}
Requirements:
+ Requires Website Baker 2.7 or higher
+ the old function call display_news_items is no longer supported use displayNewsItems instead
+ check the parameter function
As usual, your feddback, suggestions etc. are welcome.
Regards Christian
«
Last Edit: April 14, 2009, 11:34:37 PM by doc
»
Logged
doc
Offline
Posts: 3581
Re: Code Snippet: Display news items, anywhere
«
Reply #276 on:
April 15, 2009, 09:18:26 PM »
Hello,
just released
v0.80
of the Anynews code snippet on the Website Baker
Add-ons repository
.
The
Readme file
was updated accordingly and explains the parameters to use.
Modifications with respect to previous version (v0.70 / v0.71):
+ $group_id supports multiple groups (default:= 0 all groups, X:= group X, for multiple groups: array(2,4,5) )
+ $lang_id = 'AUTO' first checks language in URL (e.g /EN/ --> domain.com/pages/en/page.php) than in LANGUAGE constant
Installation / Update:
Delete a previous version via the WB backend. Then install the latest version from the backend.
Note:
If you have want to upgrade from a version older than v0.70, you need to update your functions calls and templates as explained in
this post
.
Regards Christian
Logged
doc
Offline
Posts: 3581
Code Snippet: Anynews
«
Reply #277 on:
April 17, 2009, 09:09:33 PM »
Hello,
just released
v0.92
of the Anynews code snippet on the Website Baker
Add-ons repository
.
The
Readme file
is up to date.
Main changes:
- removed legacy support for outdated Website Baker 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 Website Baker versions 2.6.x or lower has expired with Anynews v0.90. Since Anynes v0.90 you need Website Baker 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
«
Last Edit: April 19, 2009, 10:54:35 AM by doc
»
Logged
abidan
Offline
Posts: 102
Re: Code Snippet: Display news items, anywhere
«
Reply #278 on:
April 25, 2009, 11:00:22 PM »
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?
Logged
doc
Offline
Posts: 3581
Re: Code Snippet: Display news items, anywhere
«
Reply #279 on:
April 26, 2009, 06:08:32 PM »
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
Logged
abidan
Offline
Posts: 102
Re: Code Snippet: Display news items, anywhere
«
Reply #280 on:
April 26, 2009, 06:10:02 PM »
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
Logged
eazybaker
Offline
Posts: 5
Re: Code Snippet: Display news items, anywhere
«
Reply #281 on:
May 06, 2009, 08:40:06 PM »
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.
Code:
<?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:
Logged
doc
Offline
Posts: 3581
Re: Code Snippet: Display news items, anywhere
«
Reply #282 on:
May 06, 2009, 08:56:36 PM »
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
Regards Christian
«
Last Edit: May 06, 2009, 09:12:14 PM by doc
»
Logged
eazybaker
Offline
Posts: 5
Re: Code Snippet: Display news items, anywhere
«
Reply #283 on:
May 07, 2009, 12:03:15 PM »
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
«
Last Edit: May 07, 2009, 12:43:16 PM by eazybaker
»
Logged
D72
Offline
Posts: 89
Re: Code Snippet: Display news items, anywhere
«
Reply #284 on:
May 07, 2009, 01:47:36 PM »
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?
Logged
doc
Offline
Posts: 3581
Re: Code Snippet: Display news items, anywhere
«
Reply #285 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 Website Baker 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: D72
Is 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: D72
Is 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: D72
Is 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
Logged
doc
Offline
Posts: 3581
Anynews v0.93
«
Reply #286 on:
May 07, 2009, 07:22:00 PM »
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
Logged
D72
Offline
Posts: 89
Re: Code Snippet: Display news items, anywhere
«
Reply #287 on:
May 07, 2009, 07:43:30 PM »
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...
Logged
eazybaker
Offline
Posts: 5
Re: Code Snippet: Display news items, anywhere
«
Reply #288 on:
May 07, 2009, 08:33:16 PM »
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 Website Baker backend? Guess it should be EE.php but I haven´t found one yet.
Yes Estonia language file exists for the Website Baker backend and its EE not EST,so i made mistake,sry abot that
Logged
doc
Offline
Posts: 3581
Re: Code Snippet: Display news items, anywhere
«
Reply #289 on:
May 08, 2009, 12:05:34 AM »
Hi,
@eazybaker:
Quote from: eazybaker
Yes Estonia language file exists for the Website Baker 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
@D72:
Quote from: D72
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.
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: D72
Also, 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
Logged
eazybaker
Offline
Posts: 5
Re: Code Snippet: Display news items, anywhere
«
Reply #290 on:
May 08, 2009, 08:04:37 AM »
Quote from: doc on May 08, 2009, 12:05:34 AM
Hi,
@eazybaker:
Quote from: eazybaker
Yes Estonia language file exists for the Website Baker 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
Regards Christian
Yes,becaue i didnt looked into website backer languages folder before
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
Logged
doc
Offline
Posts: 3581
Re: Code Snippet: Display news items, anywhere
«
Reply #291 on:
May 08, 2009, 08:52:23 AM »
Hi,
@eazybaker: WB is following the
ISO 3166-1
language codes (2 characters).
Regards Christian
Logged
doc
Offline
Posts: 3581
Anynews v0.94 released
«
Reply #292 on:
May 08, 2009, 03:49:21 PM »
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
«
Last Edit: May 08, 2009, 03:51:09 PM by doc
»
Logged
Deleen
Offline
Posts: 4
Re: Code Snippet: Display news items, anywhere
«
Reply #293 on:
May 20, 2009, 02:59:35 PM »
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?
Logged
Deleen
Offline
Posts: 4
Re: Code Snippet: Display news items, anywhere
«
Reply #294 on:
May 20, 2009, 03:08:48 PM »
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
Logged
doc
Offline
Posts: 3581
Re: Code Snippet: Display news items, anywhere
«
Reply #295 on:
May 26, 2009, 03:56:50 PM »
Hello,
just released
v1.00
of the Anynews code snippet on the Website Baker
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.
Code:
<?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
«
Last Edit: May 26, 2009, 05:37:03 PM by doc
»
Logged
Ruud
Development Team
Offline
Posts: 1273
[[droplets]]
Re: Code Snippet: Display news items, anywhere
«
Reply #296 on:
May 26, 2009, 04:16:07 PM »
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
Logged
Show your WB site in the WebsiteBaker Professionals Showcase
|
ALLWWW Webdesign Oosterhout
|
WB Module ontwikkeling
doc
Offline
Posts: 3581
Re: Code Snippet: Display news items, anywhere
«
Reply #297 on:
May 26, 2009, 05:40:00 PM »
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.
«
Last Edit: May 26, 2009, 05:51:24 PM by doc
»
Logged
Luisehahne
Development Team
Offline
Posts: 2257
Do not two job at once
Re: Code Snippet: Display news items, anywhere
«
Reply #298 on:
May 26, 2009, 05:49:59 PM »
Hi,
or look at this
YCodaSlider 3.0
Copyright (c) 2009 Massimiliano Balestrieri
Examples and docs at:
http://maxb.net/blog/
greetings
Dietmar
Logged
Beobachte, Höre zu und lerne, 6. Lehrsatz DINOTOPIA
doc
Offline
Posts: 3581
Anynews v1.10 released
«
Reply #299 on:
May 31, 2009, 03:05:03 PM »
Hi,
just released
v1.10
of the Anynews code snippet on the Website Baker
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_displ
ay_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:
Code:
$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:
Code:
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
«
Last Edit: May 31, 2009, 03:30:11 PM by doc
»
Logged
Pages:
1
...
10
11
[
12
]
13
14
...
19
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
=> Security Announcements
=> Documentation
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> Help & Support
=> Modules
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
=> jQuery
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
=> Archive (posts up to 2007)
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> Hilfe/Support
=> Module & Snippets
=> Templates & Design
=> Tutorials
=> jQuery
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
Loading...