Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
February 12, 2012, 08:47:18 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Interested in joining the WebsiteBaker team?
For more Information read
here
or on our
new website
.
149626
Posts in
21098
Topics by
7537
Members
Latest Member:
lotte2
WebsiteBaker Community Forum
English
Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
(Moderator:
Argos
)
Code Snippet: Display news items, anywhere
Pages:
1
...
13
14
[
15
]
16
17
...
21
Go Down
Author
Topic: Code Snippet: Display news items, anywhere (Read 100239 times)
aldus
Offline
Posts: 1238
Re: Code Snippet: Display news items, anywhere
«
Reply #350 on:
September 02, 2009, 08:51:17 AM »
Hello bikerider
I'm pretty sure that there are error-messages if you try to set the PHP-Error-Reporting-Level to "E_ALL".
Some copy and paste errors, as the function is named "displayNewsItems" ..
Code:
<?php
if(
function_exists
(
'displayNewsItems'
)) {
displayNewsItems
(
0
,
5
,
50
,
1
,
""
,
"mehr lesen"
,
"aktuell gibt es keine news..."
,
false
);
} else {
echo
'Requires code snippet anynews (WB addons repository) to display news here.'
;
}
?>
Regards
Aldus
Logged
bikerider
Offline
Posts: 19
Re: Code Snippet: Display news items, anywhere
«
Reply #351 on:
September 02, 2009, 10:27:43 AM »
sorry - twice...
thank you so much!!!
Logged
snark
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #352 on:
September 04, 2009, 11:44:50 PM »
Anyone who knows wether I can use the anynews for the mediablog module
Logged
micklan
Offline
Posts: 1
Re: Code Snippet: Display news items, anywhere
«
Reply #353 on:
September 05, 2009, 11:35:20 AM »
Hi!
Why i receive the "’" syntax in news instead of " ' " character ?
Thanks you!
«
Last Edit: September 05, 2009, 12:11:47 PM by micklan
»
Logged
tiesy
Offline
Posts: 123
Re: Code Snippet: Display news items, anywhere
«
Reply #354 on:
September 11, 2009, 10:21:04 AM »
I´ve a problem with allowed tags and didn´t find a solution:
The tag-brackets (<,>) will be replaced with "<" or ">". So, if I allow some tags, the sourcecode is shown in the output.
I use wb2.8 and the newest version of anynews.
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #355 on:
September 11, 2009, 10:28:05 AM »
Have you tried the 'strip_tags' and 'allowed_tags' options of the
displayNewsItems()
method?
Code:
strip_tags... true:=remove tags from short and long text (default:=true); false:=don´t strip tags
allowed_tags... tags not striped off (default:='<p><a><img>')
See included help files for details.
Logged
tiesy
Offline
Posts: 123
Re: Code Snippet: Display news items, anywhere
«
Reply #356 on:
September 11, 2009, 12:04:45 PM »
Hi WebBird!
Yes, I did. This is my snippet in a code-section:
if (function_exists('displayNewsItems')) {
displayNewsItems(2, 2, 200, 5, DE, true,'<p><a><img>', 1, 0);
}
I also tried "false" instead of "true". The problem is the same.
Do you see any mistake?
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #357 on:
September 11, 2009, 12:40:14 PM »
Cannot reproduce this error. Use "false" instead of "true" and wrap DE in quotes, please.
Code:
if (function_exists('displayNewsItems')) {
displayNewsItems(2, 2, 200, 5, 'DE', false,'<p><a><img>', 1, 0);
}
Also, you use a custom template, so please try to replace 5 with 1 for testing. (Which means "details".)
Logged
doc
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #358 on:
September 11, 2009, 03:30:17 PM »
Hi,
maybe consider to write your anynews function calls as follows (helps to keep track of the various parameters).
Code:
<?php
if (
function_exists
(
'displayNewsItems'
)) {
displayNewsItems
(
$group_id
=
2
,
$max_news_items
=
2
,
$max_news_length
=
200
,
$display_mode
=
5
,
$lang_id
=
'DE'
,
$strip_tags
=
false
,
$allowed_tags
=
'<p><a><img>'
,
$custom_placeholder
=
false
,
$sort_by
=
4
,
$sort_order
=
1
,
$not_older_than
=
0
);
}
?>
You should check $display_mode (5 uses a custom template) and the last two parameters.
Doc
Logged
tiesy
Offline
Posts: 123
Re: Code Snippet: Display news items, anywhere
«
Reply #359 on:
September 11, 2009, 04:56:44 PM »
Hi Doc & WebBird,
thanks for your help. I´ve tested your solutions, changed true to false, but the problem stays on. Could it have something to do with the installed php-version?
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #360 on:
September 14, 2009, 11:55:35 AM »
Quote from: tiesy on September 11, 2009, 04:56:44 PM
Could it have something to do with the installed php-version?
Which is...?
Is the HTML correct on the News page itself?
Logged
tiesy
Offline
Posts: 123
Re: Code Snippet: Display news items, anywhere
«
Reply #361 on:
September 15, 2009, 08:47:36 AM »
Yes, I´ve made no changes in the html-code on news-section. It´s a fresh wb-installation. The php-version is 4.3.9.
I know, that php5 is required for wb 2.8., but exept of anynews it works without any problems.
Logged
joep
Offline
Posts: 3
Re: Code Snippet: Display news items, anywhere
«
Reply #362 on:
September 15, 2009, 10:16:04 AM »
I have a question.
I use this code:
Code:
displayNewsItems(array(10,11, 12, 13, 14), 5, 0, 0, false);
I don't know much abouth anynews yet!!
What i trie to achief is a block with new items from several groups, showing only the title of the post.
So not the date, or the dots on the bottom. And not the title (Latest News).
It worked with this code:
Code:
$group = 9; // Specify the Group(id) you want to read the news from
global $database;
$query = "SELECT post_id,title,group_id,link FROM ".TABLE_PREFIX."mod_news_posts WHERE group_id = $group ORDER BY position DESC LIMIT 0, 3;";
/*This limits the results to max 5, so if you want it to be 10, make it LIMIT 0, 10. The first number defines the starting point, and the second the max/end of the results */
$error = mysql_error();
if (!$result = mysql_query($query)) {
print "$error";
exit;
}
while($data = mysql_fetch_object($result)){
$title = $data->title;
$id = $data->post_id;
$link = $data->link;
echo '<li><a href="'.WB_URL.'/pages/'.$link.PAGE_EXTENSION.'">'.$title.'</a>'.$short.'</li>'; // the loop
}
echo "</ul>"; // end of the loop
the problem with this code is that it only works with one group.
the link to my page is :
http://www.studiozi.com/wb
Thanq in advanced
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #363 on:
September 15, 2009, 11:48:29 AM »
Yes, it works only for one group. (Or use 0 for "get from all groups".)
What is the question?
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #364 on:
September 15, 2009, 11:49:05 AM »
Quote from: tiesy on September 15, 2009, 08:47:36 AM
Yes, I´ve made no changes in the html-code on news-section. It´s a fresh wb-installation. The php-version is 4.3.9.
I know, that php5 is required for wb 2.8., but exept of anynews it works without any problems.
I've tried with PHP 4.4.9, but I still can't reproduce the error. Can you show us?
Logged
joep
Offline
Posts: 3
Re: Code Snippet: Display news items, anywhere
«
Reply #365 on:
September 15, 2009, 05:17:55 PM »
My question is.
Is it possible to use multiple groups. for example group 3 and 4.
I have 8 groups.
7 of them i want to use.
Maybe i can use somkind of array??
Logged
doc
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #366 on:
September 15, 2009, 05:30:31 PM »
@joep:
You can define all groups ($group_id = 0), a single group ($group_id = x) or a collection of groups ($group_id = array(3,4)). Details about the possible function parameters are provided in the
Readme file
of the module. A function call with two groups can be found in section "Example for a customized call:" of the Readme.
Please make sure you are using the latest version of anynews.
Doc
Logged
tiesy
Offline
Posts: 123
Re: Code Snippet: Display news items, anywhere
«
Reply #367 on:
September 16, 2009, 08:32:38 AM »
Hi WebBird,
no, I can´t for the moment, it´s not public yet. But I made some screenshots, where you can see, what happens.
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #368 on:
September 16, 2009, 09:10:09 AM »
Well, on the screenshot the strip_tags param is set to true, which means "strip all tags", and the lang_id is still not enclosed in quotes.
Logged
tiesy
Offline
Posts: 123
Re: Code Snippet: Display news items, anywhere
«
Reply #369 on:
September 16, 2009, 09:34:19 AM »
It makes no difference, if I change the parameter from true to false. Language in quotes or not is all the same. I think it has to do with the server-setup.
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #370 on:
September 16, 2009, 09:50:00 AM »
Yes, I'd say it's the most probable explanation. Anyway, I don't know what to look for.
Logged
aldus
Offline
Posts: 1238
Re: Code Snippet: Display news items, anywhere
«
Reply #371 on:
September 16, 2009, 10:41:03 AM »
Hello
As far as i can reproduce this bug it has to do within the max-char restriction, e.g. 200 chars,
in the short-message as the function "wordwrap2" converts htmlentities ... so the brakets became
"<" and ">" - also the quotes to "e ...
To avoid this i've add
Code:
<?php
$restore
= array (
'<'
=>
"<"
,
'>'
=>
">"
,
'"e;'
=>
"\""
);
$temp
[
0
] =
str_replace
(
array_keys
(
$restore
),
array_values
(
$restore
),
$temp
[
0
]);
?>
to the function "wordwrap2" in the bottom of the include.php,
but i'm pretty sure that were are more elegant ways to solve this.
Kind regards
Aldus
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #372 on:
September 16, 2009, 11:27:06 AM »
Ah. This also explains the problem "micklan" has with ’. Funny that I can't reproduce it... I'll try to find a solution. Thank you very much Aldus!!!
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #373 on:
September 16, 2009, 12:49:33 PM »
I also found that it is ... uhm ... "not nice" if there are any opening HTML tags in the remaining text, so I worked on a solution to close these tags, too. I'm not very happy with the code, but if it works, it's better than leaving it as is.
Can someone please do some tests with the
include.php
attached?
Edit: Removed attachment
«
Last Edit: September 24, 2009, 06:34:35 PM by WebBird
»
Logged
tiesy
Offline
Posts: 123
Re: Code Snippet: Display news items, anywhere
«
Reply #374 on:
September 22, 2009, 09:19:54 AM »
Hi WebBird,
I have tested your include.php an it works as you explained. Many thanks for that.
It´s better than before, but not a real solution for the problem. Now it cuts all news-entries even if to long html-commands found in only one news-entry.
I don´t know how to make it, but the anynews-function "max_news_length" should not count the characters of html-tags and not replace the brackets in principle.
Logged
Pages:
1
...
13
14
[
15
]
16
17
...
21
Go Up
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
-----------------------------
English
-----------------------------
=> Help & Support
-----------------------------
General
-----------------------------
=> WebsiteBaker Website Showcase
-----------------------------
English
-----------------------------
=> Modules
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
-----------------------------
General
-----------------------------
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
-----------------------------
General
-----------------------------
=> Security Announcements
-----------------------------
Deutsch (German)
-----------------------------
=> Hilfe/Support
-----------------------------
General
-----------------------------
=> Documentation
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
=> Module & Snippets
-----------------------------
English
-----------------------------
=> Archive (posts up to 2007)
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Deutsch (German)
-----------------------------
=> jQuery
=> Tutorials
=> Templates & Design
-----------------------------
English
-----------------------------
=> jQuery
-----------------------------
Bakery (WB shop module)
-----------------------------
=> Bakery English
=> Bakery Deutsch
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.9
===> Announcements
===> Help/Support
===> Suggestions
-----------------------------
Deutsch (German)
-----------------------------
=> WebsiteBaker 2.9
===> Ankündigungen
===> Hilfe/Support
===> Vorschläge
-----------------------------
English
-----------------------------
===> Software bugs
-----------------------------
Deutsch (German)
-----------------------------
===> Softwarefehler
=====> Module / Extensions
-----------------------------
English
-----------------------------
=====> Modules / Extensions
-----------------------------
Deutsch (German)
-----------------------------
===> Erfahrungs und Testberichte
-----------------------------
KeepInTouch (Multi Contact Module)
-----------------------------
=> KeepInTouch English
=> KeepInTouch Deutsch
Loading...