Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 27, 2012, 01:06:14 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter
hier
und auf unserer
neuen Webseite
.
155557
Posts in
21715
Topics by
7737
Members
Latest Member:
gx-world
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
...
14
15
[
16
]
17
18
...
21
Go Down
Author
Topic: Code Snippet: Display news items, anywhere (Read 104790 times)
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #375 on:
September 22, 2009, 09:23:14 AM »
This is much more effort I can find the time for at the moment.
Logged
doc
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #376 on:
September 23, 2009, 06:46:29 PM »
Hi,
did a quick
Google search
and found some working code examples (within the first 10 matches or so).
Doc
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #377 on:
September 23, 2009, 06:51:57 PM »
I will have a look at it when I have some free time. (Not within the next weeks.)
Edit: Please take a look at version 1.12. Is this okay?
«
Last Edit: September 24, 2009, 06:33:53 PM by WebBird
»
Logged
tiesy
Offline
Posts: 124
Re: Code Snippet: Display news items, anywhere
«
Reply #378 on:
September 25, 2009, 04:44:24 PM »
Hi WebBird,
thanks for the new version, but I can´t see a difference. It´s the same behavior as in 1.11:
The short-text is only shown correctly on frontpage, when the number of caracters are set high enough to show the hole short-text. If the short-text has more caracters than set in the code-secton, HTML-brackets are shown on frontpage.
Vielleicht nochmal auf deutsch, weil verständlicher: Ich sehe zu 1.11 keine Änderung. Die Kurztexte werden über das anynews-snippet nur dann korrekt dargestellt, wenn die Anzahl der Zeichen so hoch eingestellt wird, dass auf jeden Fall der gesamte Kurztext damit abgedeckt wird. Irgendwie passiert der Fehler also beim Zählen der Zeichen und Abschneiden des Kurztextes.
Das Problem ist, dass man ja dem Anwender schlecht vorschreiben kann, bloß keine Formatierungen im Kurztext vorzunehmen.
«
Last Edit: September 25, 2009, 05:12:21 PM by tiesy
»
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #379 on:
September 28, 2009, 09:20:47 AM »
Can you provide me a complete test case, please? (Post "Short Text" as HTML Code here for Copy&Paste.)
Logged
tiesy
Offline
Posts: 124
Re: Code Snippet: Display news items, anywhere
«
Reply #380 on:
October 02, 2009, 10:08:55 AM »
Hi WebBird,
that is the anynews-snippet in my code-section:
echo "<h4>Neueste Beiträge</h4>";
if (function_exists('displayNewsItems')) {
displayNewsItems(2, 2, 260, 5,'DE' ,'true' ,'<p><a><img>' , 1, 0);
}
and here is the html-output:
<h4>Neueste Beiträge</h4><div class="anynews">
<h5>Demokratie, Verfassung, Interessenvermittlu
ng</h5>
<p><p><img width="50" hspace="5" height="57" align="left" alt="" src="
http://www.politik.uni-osnabrueck.de/cms/media/marx.jpg
" />Was unter dem Begriff Demokratie zu verstehen ist, darüber gehen nicht nur im Alltagsverständnis die Meinungen auseinander. Auch in der Wissenschaft gibt es ganz unterschiedliche Vorstellungen. <a href="
http://www.politik.uni-osnabrueck.de/cms/pages/de/forschung/politik-der-deutschen-vereinigung/kampf-um-die-finanzierung-der-deutschen-einheit.php
">Die Begriffe numerische Demokratie,</a> deliberative Demokratie und Verhandlungsdemokra
tie bezeichnen <a href="
http://www.politik.uni-osnabrueck.de/cms/pages/de/forschung/politik-der-deutschen-vereinigung/kampf-um-die-finanzierung-der-deutschen-einheit.php
">prinzipiell unterschiedliche</a> Verfahren zur Herstellung und Legitimation verbindlicher kollektiver Entscheidungen.</p></p>
<p><a href="
http://www.politik.uni-osnabrueck.de/cms/pages/posts/demokratie-verfassung-interessenvermittlung-7.php
">weiterlesen</a></p>
<hr>
<h5>Im Osten nichts Neues </h5>
<p><p><a href="
http://www.spiegel.de
" target="_blank">Die Berichte der Bundesregierung zum Stand der Deutschen Einheit vermitteln eine ambivalente Botschaft</a>. Nur wer sie in Serie liest, erkennt einen seit Jahren anhaltenden Grundtenor. Er besagt, dass es, abgesehen von einer Vielzahl gefeierter Einzelprojekte, nichts Neues zu berichten gibt: Stillstand im Osten lautet letztlich das Fazit.</p></p>
<p><a href="
http://www.politik.uni-osnabrueck.de/cms/pages/posts/im-osten-nichts-neues-6.php
">weiterlesen</a></p>
<hr>
</div>
This works great, but if I reduce the length to 250 I get only the Headlines, no teaser-text:
The output with length 250:
<h4>Neueste Beiträge</h4><div class="anynews">
<h5>Demokratie, Verfassung, Interessenvermittlu
ng</h5>
<p>...</p>
<p><a href="
http://www.politik.uni-osnabrueck.de/cms/pages/posts/demokratie-verfassung-interessenvermittlung-7.php
">weiterlesen</a></p>
<hr>
<h5>Im Osten nichts Neues </h5>
<p>...</p>
<p><a href="
http://www.politik.uni-osnabrueck.de/cms/pages/posts/im-osten-nichts-neues-6.php
">weiterlesen</a></p>
<hr>
</div>
I have installed your actual version 1.12.
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #381 on:
October 03, 2009, 10:58:35 AM »
The 8th param is wrong.
($custom_placeholder false:= none (default), array('MY_VAR_1' => '%TAG%#', ... 'MY_VAR_N' => '#regex_N#' ...)
I think you confounded with #9, $sort_by.
This works fine for me:
Code:
if (function_exists('displayNewsItems')) {
displayNewsItems(
$group_id = 0,
$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 = 1,
$sort_order = 1,
$not_older_than = 0
);
//displayNewsItems(57, 87, 260, 5,'DE' ,'true' ,'<p><a><img>' , 1, 0);
}
Logged
tiesy
Offline
Posts: 124
Re: Code Snippet: Display news items, anywhere
«
Reply #382 on:
October 06, 2009, 09:41:24 AM »
Hi WebBird,
thanks for your help. I´ve tested your code, but there is no difference. I´ll wait for the next version.
Logged
erpe
Offline
Posts: 2077
Re: Code Snippet: Display news items, anywhere
«
Reply #383 on:
October 06, 2009, 09:49:53 AM »
Hi Webbird
the new code is working for me...........
Thanks.
erpe
Logged
stories about
be part of the Tutorials-Project
visit the jQuery-Showroom
joep
Offline
Posts: 3
Re: Code Snippet: Display news items, anywhere
«
Reply #384 on:
October 06, 2009, 02:00:41 PM »
Hello people.
I've got a problem with the LINK to the news page.
I've got this script:
Code:
displayNewsItems(array(15, 16, 17, 18, 19), 5, 1, 2, NL,
true, '<p><a><img>', false,
2, 1, 0);
This works fine!!
The only problem is when i click a menu item, it doesn't link to the specific news page, but the overview page.
Code:
<div class="anynews">
<ul>
<!-- BEGIN news_block -->
<li><a href="[b]{LINK}[/b]">{TITLE}</a></li>
<!-- END news_block -->
</ul>
</div> {LINK}
The link in this code does that..
Anyone knows how to fix this??
Thnq
Joep Muijres
Logged
Luisehahne
Board Member
Development Team
Offline
Posts: 3147
Re: Code Snippet: Display news items, anywhere
«
Reply #385 on:
October 06, 2009, 11:40:06 PM »
Quote
<li><a href="
{LINK}
">{TITLE}</a></li>
b tag is not allowed there
Dietmar
Logged
We are human beings - and nobody is perfect at all.
doc
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #386 on:
October 07, 2009, 08:38:46 AM »
Hi,
as Dietmar mentioned, try to add the <b> tag to the allowed tags.
In addition I would suggest to use the following function call, which makes it much more obvious, for what the various parameter are for.
Code:
<?php
displayNewsItems
(
$group_id
= array(
15
,
16
,
17
,
18
,
19
),
$max_news_items
=
5
,
$max_news_length
=
1
,
$display_mode
=
2
,
$lang_id
=
'NL'
,
$strip_tags
=
true
,
$allowed_tags
=
'<p><a><img><b>'
,
$custom_placeholder
=
false
,
$sort_by
=
2
,
$sort_order
=
1
,
$not_older_than
=
0
);
?>
Also check the settings for max_news_length which is currently set to 1 and the setting for the language, which should be wrapped in quotes 'NL' instead of NL
Doc
«
Last Edit: October 07, 2009, 08:43:47 AM by doc
»
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #387 on:
October 07, 2009, 12:43:50 PM »
Quote from: tiesy on October 06, 2009, 09:41:24 AM
I´ll wait for the next version.
Which next version?
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #388 on:
October 07, 2009, 12:46:40 PM »
Quote from: doc on October 07, 2009, 08:38:46 AM
Hi,
as Dietmar mentioned, try to add the <b> tag to the allowed tags.
But Dietmar meant that
<b>
is not allowed in the
href
attribute (by the HTML standard), apart from adding it to the list of allowed tags.
Logged
doc
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #389 on:
October 12, 2009, 05:22:59 PM »
Hi,
the latest Version of Anynews v1.13 (AMASP only) includes an updated
English Readme
file. The examples in the README file make now use of the function parameter to make it more obvious what the different parameters are for
Doc
P.S.: Apart from the Readme file, no new functions were added
«
Last Edit: October 12, 2009, 05:25:18 PM by doc
»
Logged
mikejd
Offline
Posts: 160
Re: Code Snippet: Display news items, anywhere
«
Reply #390 on:
November 06, 2009, 03:51:03 PM »
I have installed this snippet on a website and I am experiencing some odd behaviour which someone may be able to explain.
The length of the text quoted in the display can be set in the function call to a particular number of characters. I have noticed that this number appears to include any html tags in the short text entry eg if for instance a particular string is tagged as say h4 - <h4>xxxxxxxxxxx</h4> the count includes the <h4> and if the number, say 15, is less than the total number of characters, 20 in this case, the closing tag isn't included. This can result in a serious error in the html code for the page and cause major problems with the overall page display.
Has anyone else noticed this? Is there any solution apart from not using formating in the short text entry? In which case the FCK editor should not be available for that input box as it encourages editors to use it.
Any comments appreciated.
Mike
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #391 on:
November 06, 2009, 05:01:53 PM »
I have addressed this issue above. Please make sure that you have the current version. If you do, please give an URL where to look at the problem.
Logged
artifaction
Offline
Posts: 7
Re: Code Snippet: Display news items, anywhere
«
Reply #392 on:
November 10, 2009, 11:27:06 AM »
I have a question i really hope someone can help me with.
If I add a image in the "short" section of a news item I can get that to show in anynews, but the problem is that it doesnt look good at all.
I want it to look like this.
http://www.magnuslofdahl.com/img_share/anynews_format.jpg
Is this possible? and how, where do I start.
This is the page I want to change, the news section at the bottom.
http://www.stylingutbildningen.se/
Please some advise would have been worth alot.
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #393 on:
November 10, 2009, 11:37:06 AM »
I get an error message with the second link.
You can create a custom layout by editing the "custom_output_displ
ay_mode_4.htt" file in the htt subfolder of AnyNews. All AnyNews placeholders are described there. You can also add your very own template file to the htt subfolder. See the help file for more information about this.
Logged
Franck707070
Offline
Posts: 4
Re: Code Snippet: Display news items, anywhere
«
Reply #394 on:
December 10, 2009, 03:58:25 PM »
Hi there,
I have a little problem.
I wanted to add a bit of code in order not to display the title "
Nouvelles
" and the corresponding
DIV
when there's no news to display. I tried both ways below without success. The echo doesn't display at all, even if there's some news to display and I don't understand why...
First try:
Code:
<!-- Display News -->
<?php
if (
function_exists
(
'displayNewsItems'
)) {
$test
=
displayNewsItems
(
0
,
3
,
160
,
1
,
$lang_id
,
$strip_tags
,
$allowed_tags
,
$custom_placeholder
,
$sort_by
,
$sort_order
,
$not_older_than
);
if (
$test
!=
""
)
{
echo
'<div id="menunews" style="display:block;">'
;
echo
'<a href="http://prix-excellence.com/pages/nouvelles.php">Nouvelles</a>'
;
displayNewsItems
(
0
,
3
,
160
,
1
,
$lang_id
,
$strip_tags
,
$allowed_tags
,
$custom_placeholder
,
$sort_by
,
$sort_order
,
$not_older_than
);
echo
'</div>'
;
}
}
?>
Second try:
Code:
<!-- Display News -->
<?php
if (
function_exists
(
'displayNewsItems'
)) {
$test
=
displayNewsItems
(
0
,
3
,
160
,
1
,
$lang_id
,
$strip_tags
,
$allowed_tags
,
$custom_placeholder
,
$sort_by
,
$sort_order
,
$not_older_than
);
if (
$test
!=
""
)
{
?>
<div id="menunews" style="display:block;">
<a href="http://prix-excellence.com/pages/nouvelles.php">Nouvelles</a>
<?php
displayNewsItems
(
0
,
3
,
160
,
1
,
$lang_id
,
$strip_tags
,
$allowed_tags
,
$custom_placeholder
,
$sort_by
,
$sort_order
,
$not_older_than
);
?>
</div>
<?php
}
}
?>
advTHANKSance
«
Last Edit: December 10, 2009, 04:01:05 PM by Franck707070
»
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #395 on:
December 10, 2009, 04:15:14 PM »
http://www.websitebaker2.org/forum/index.php/topic,15579.msg100790.html#msg100790
Logged
Franck707070
Offline
Posts: 4
Re: Code Snippet: Display news items, anywhere
«
Reply #396 on:
December 10, 2009, 10:03:57 PM »
Nice, thank's a lot!
Logged
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #397 on:
December 11, 2009, 10:18:46 AM »
I think the trick you needed to know is the usage of
ob_start()
etc.
Logged
Stefek
WebsiteBaker Org e.V.
Offline
Posts: 4884
Re: Code Snippet: Display news items, anywhere
«
Reply #398 on:
December 11, 2009, 01:26:14 PM »
Hello,
I wonder if there is no way to output just the date (w/o time) with this snippet.
Or did I overseen a parameter to call?
Regards,
Stefek
Logged
"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
WebBird
Guest
Re: Code Snippet: Display news items, anywhere
«
Reply #399 on:
December 11, 2009, 02:13:05 PM »
See $LANG['DATE_FORMAT'] in the language module(s)
Logged
Pages:
1
...
14
15
[
16
]
17
18
...
21
Go Up
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
=> Security Announcements
=> Documentation
=> WebsiteBaker Website Showcase
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.9
===> Announcements
===> Help/Support
=====> Modules / Extensions
===> Suggestions
===> Software bugs
=> 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
=> WebsiteBaker 2.9
===> Ankündigungen
===> Hilfe/Support
=====> Module / Extensions
===> Vorschläge
===> Softwarefehler
===> Erfahrungs und Testberichte
=> 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
-----------------------------
Bakery (WB shop module)
-----------------------------
=> Bakery English
=> Bakery Deutsch
-----------------------------
KeepInTouch (Multi Contact Module)
-----------------------------
=> KeepInTouch English
=> KeepInTouch Deutsch
Loading...