WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Code Snippet: Display news items, anywhere
  • Print
Pages: 1 ... 14 15 [16] 17 18 ... 21   Go Down

Author Topic: Code Snippet: Display news items, anywhere  (Read 373523 times)

WebBird

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #375 on: September 22, 2009, 10:23:14 AM »
This is much more effort I can find the time for at the moment. :roll:
Logged

doc

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #376 on: September 23, 2009, 07: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, 07: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?

[gelöscht durch Administrator]
« Last Edit: September 24, 2009, 07:33:53 PM by WebBird »
Logged

Offline tiesy

  • Posts: 125
    • Wir in Wallenhorst
Re: Code Snippet: Display news items, anywhere
« Reply #378 on: September 25, 2009, 05: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, 06:12:21 PM by tiesy »
Logged

WebBird

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #379 on: September 28, 2009, 10:20:47 AM »
Can you provide me a complete test case, please? (Post "Short Text" as HTML Code here for Copy&Paste.)
Logged

Offline tiesy

  • Posts: 125
    • Wir in Wallenhorst
Re: Code Snippet: Display news items, anywhere
« Reply #380 on: October 02, 2009, 11:08:55 AM »
Hi WebBird,

that is the anynews-snippet in my code-section:

echo "<h4>Neueste Beitr&auml;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&auml;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&uuml;ber gehen nicht nur im Alltagsverst&auml;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&auml;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, 11: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: [Select]
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

Offline tiesy

  • Posts: 125
    • Wir in Wallenhorst
Re: Code Snippet: Display news items, anywhere
« Reply #382 on: October 06, 2009, 10: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

erpe0812

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #383 on: October 06, 2009, 10:49:53 AM »
Hi Webbird

the new code is working for me...........

Thanks.

erpe

Logged

joep

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #384 on: October 06, 2009, 03:00:41 PM »
Hello people.

I've got a problem with the LINK to the news page.

I've got this script:

Code: [Select]
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: [Select]
<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

Offline Luisehahne

  • WebsiteBaker Org e.V.
  • **
  • Posts: 4548
  • Gender: Male
Re: Code Snippet: Display news items, anywhere
« Reply #385 on: October 07, 2009, 12:40:06 AM »
Quote
<li><a href="{LINK}">{TITLE}</a></li>

b tag is not allowed there

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

doc

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #386 on: October 07, 2009, 09: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: [Select]
<?php
displayNewsItems
(
  
$group_id = array(15, 16, 17, 18, 19),
  
$max_news_items = 5, 
  
$max_news_length = 1,
  
$display_mode = 2,
  
$lang_id = &#39;NL&#39;,
  
$strip_tags = true,
  
$allowed_tags = &#39;<p><a><img><b>&#39;,
  
$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, 09:43:47 AM by doc »
Logged

WebBird

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #387 on: October 07, 2009, 01:43:50 PM »
Quote from: tiesy on October 06, 2009, 10: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, 01:46:40 PM »
Quote from: doc on October 07, 2009, 09: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, 06: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 :wink:

Doc

P.S.: Apart from the Readme file, no new functions were added
« Last Edit: October 12, 2009, 06:25:18 PM by doc »
Logged

Offline mikejd

  • Posts: 251
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

  • Guest
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

  • Guest
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: [Select]
<!-- Display News -->
<?php
if (function_exists(&#39;displayNewsItems&#39;)) {
    
$test = displayNewsItems(0,3, 160, 1, $lang_id, $strip_tags, $allowed_tags, $custom_placeholder, $sort_by, $sort_order, $not_older_than);
    if (
$test != "")
    {   
        echo &
#39;<div id="menunews" style="display:block;">&#39;;
        
echo &#39;<a href="http://prix-excellence.com/pages/nouvelles.php">Nouvelles</a>&#39;;
        
displayNewsItems(0,3, 160, 1, $lang_id, $strip_tags, $allowed_tags, $custom_placeholder, $sort_by, $sort_order, $not_older_than);
        echo &
#39;</div>&#39;;
    
}
}
?>

Second try:

Code: [Select]
<!-- Display News -->
<?php
if (function_exists(&#39;displayNewsItems&#39;)) {
    
$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 »
https://forum.WebsiteBaker.org/index.php/topic,15579.msg100790.html#msg100790
Logged

Franck707070

  • Guest
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. :-D
Logged

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
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
"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

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

  • Print
Pages: 1 ... 14 15 [16] 17 18 ... 21   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Code Snippet: Display news items, anywhere
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2