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 ... 9 10 [11] 12 13 ... 21   Go Down

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

Offline sparkdigital

  • Posts: 366
  • Once a baker, always a baker!
    • romantic hotels
Re: Code Snippet: Display news items, anywhere
« Reply #250 on: March 03, 2009, 05:51:11 PM »
Great stuff, thanks.

If I have multiple news pages and assign group = 0 in the snippet, what is the order of the news items based on? It seems to display them randomly but I would like to display the top news item from each individual news page.

Is there any way of doing this?

Thanks,

Konrad
Logged

doc

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #251 on: March 03, 2009, 05:53:04 PM »
Hi Konrad,

have a look at the Readme file coming along with Anynews. Guess the last two options sort_order and sort_by are your friend.

Regards Christian
Logged

Offline sparkdigital

  • Posts: 366
  • Once a baker, always a baker!
    • romantic hotels
Re: Code Snippet: Display news items, anywhere
« Reply #252 on: March 03, 2009, 06:16:48 PM »
Thanks Christian,

I've upgarded to the latest version and followed the instructions in the read me - I understand it orders it based on the date / time, either ascending or descending?

Presuming I have 5 news pages, is there any way to display the top post of each news page rather than just the 5 latest posts?

Thanks!

Konrad
Logged

doc

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #253 on: March 03, 2009, 06:29:30 PM »
Hi,

anynews only allows to list x news from either all news pages (group id = 0) or from a certain group (group id > 0). However, you can think off calling the function 5 times (one call per group) and limiting anynews to show only one news per group. This in combination with a user defined template (/htt/custom_output_display_mode_X.htt) should do the trick even if it is not that straight forward.

Regards Christian
Logged

Offline sparkdigital

  • Posts: 366
  • Once a baker, always a baker!
    • romantic hotels
Re: Code Snippet: Display news items, anywhere
« Reply #254 on: March 03, 2009, 06:44:49 PM »
Thanks Christian,

I was thinking along similar lines but unfortunately I don't think it will work in this scenario - Ill try something else.

Thanks very much for your help though! :wink:
Logged

Offline sparkdigital

  • Posts: 366
  • Once a baker, always a baker!
    • romantic hotels
Re: Code Snippet: Display news items, anywhere
« Reply #255 on: March 04, 2009, 11:32:45 AM »
I noticed it is possible to allow certain tags using 'allowed_tags' but is it also possible to only allow these tags (img and a) and exclude any text? This way I could show the image and use that as a link and could make it look a bit more 'designed'.

Thanks,

Konrad
Logged

doc

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #256 on: March 04, 2009, 11:42:20 AM »
Hi Konrad,

this is not possible in any of the Anynews version available. Anynews simply uses the PHP strip_tags function with the option to define tags which should not get removed from the text. However, feel free to change the code to fit your needs.

Regards Christian
Logged

Offline sparkdigital

  • Posts: 366
  • Once a baker, always a baker!
    • romantic hotels
Re: Code Snippet: Display news items, anywhere
« Reply #257 on: March 04, 2009, 11:47:10 AM »
Okay, never mind!

K
Logged

daydreamer

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #258 on: March 12, 2009, 11:17:33 AM »
Read more links to /index.php on each post not to the actual post?
Logged

doc

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #259 on: March 14, 2009, 08:40:28 AM »
Hi,

Anynews v0.40 is available on the WebsiteBaker Addons repository.

Main changes:
 - anynews function was renamed from display_news_items() into displayNewsItems()
 - the old function name still exists, but was marked deprecated, which means it will be removed in future versions
 - some code clean up

Regards Christian
Logged

JonH

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #260 on: March 15, 2009, 06:59:01 PM »
Ok, what am I missing?

I have 2 news groups, Group-X and Group-Y and want to display news from Group-X on my front page by using:

Code: [Select]
<?php displayNewsItems(0, 5, 50, 2, 
  &
#39;Latest news&#39;, &#39;read more&#39;, &#39;No news available&#39;,
  
true, &#39;<a><img>&#39;, true, &#39; (d.m.Y)&#39;, 1, 1); ?>

What do I put instead of 0 as the first parameter? I tried 1 and I tried Group-X, none worked. It only shows news from all groups...
Is group id same as group title?

Help pls!

(I'm using latest version of wb and anynews)
« Last Edit: March 15, 2009, 07:01:14 PM by JonH »
Logged

doc

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #261 on: March 15, 2009, 07:18:42 PM »
Hello,

the group is is numeric. Go the the WB backend and vist the page of type News (not Anynews). Look for the section called: "Modify / Delete Groups" which lists all the groups you have created. Go with the mouse over the group name and look in the browser status bar (in Firefox at the bottom). Here you see a link with the numeric group_id. If you don´t get it, simply click on the link of the group you are interested. The group_id can be found in the URL.

If it still not works, make sure you have assigned the news entries to one of those groups. Per default, news entries are assigned to the group_id 0, you need to add news entries manually to a group to get it working.

The parameter to touch is the first one. If still in doubt, have a look at the README file.

Regards Christian
« Last Edit: March 15, 2009, 07:20:32 PM by doc »
Logged

JonH

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #262 on: March 15, 2009, 07:32:51 PM »
Aaahaaaa! That mouse over trick did the job.
Thank's a lot!
Logged

Offline babsy

  • Posts: 337
Re: Code Snippet: Display news items, anywhere
« Reply #263 on: March 17, 2009, 02:04:23 PM »
to make the "Title" the link also?
anyone who knows?, there was now trouble in the old code, but i just can´t figure it out in this new code?
Logged

erpe0812

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #264 on: March 17, 2009, 02:24:32 PM »
Hi

you have to modify the standard template in anynews and add
Quote
<a href="{LINK}">{TITLE}</a>
in that row.

rgds

erpe
Logged

Offline babsy

  • Posts: 337
Re: Code Snippet: Display news items, anywhere
« Reply #265 on: March 17, 2009, 02:39:50 PM »
Do you mean in this code part (i tried, and the pages keep turning blank)? (this is in the module/anynews/index.php ?

// replace the news article dependend template placeholders
                $tpl->set_var(array(
                    'TITLE'                => ($strip_tags) ? strip_tags($row['title']) : $row['title'] ,
                    'CONTENT_SHORT'        => $row['content_short'],
                    'POSTED_WHEN'        => ($display_publish_date) ? date($date_time_format, $row['posted_when']) : '',
                    'PUBLISHED_WHEN'    => isset($row['published_when']) ? date($date_time_format, $row['published_when'])
                                            : date($date_time_format, $row['posted_when']),
                    'LINK'                => WB_URL . PAGES_DIRECTORY . $row['link'] . PAGE_EXTENSION
                ));
Logged

erpe0812

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #266 on: March 17, 2009, 02:42:30 PM »
What version of anynews do you use?
Logged

Offline babsy

  • Posts: 337
Re: Code Snippet: Display news items, anywhere
« Reply #267 on: March 17, 2009, 02:50:37 PM »
i think i found.... under modules/anynews/htt/detailed_output.htt

looks. like thats its... i just have to customize it now!

anynews is on the right... here:

http://www.is.fo/


i use the latest version.. i think :)
« Last Edit: March 17, 2009, 02:54:56 PM by babsy »
Logged

erpe0812

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #268 on: March 17, 2009, 03:02:13 PM »
Yes, that's the template........

Add the link and you are done.

rgds

erpe
Logged

Offline babsy

  • Posts: 337
Re: Code Snippet: Display news items, anywhere
« Reply #269 on: March 17, 2009, 03:16:11 PM »
thanks for you help :):)
 
Logged

Gitrian

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #270 on: March 26, 2009, 09:48:29 AM »
Hi,

I wondered if it was possible, in addition to the max number of news-items shown, also to specify how old the news-items must be, to be shown on the list ?

For example I want max 5 items and no one older than 1 month.
Logged

doc

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #271 on: March 26, 2009, 10:26:05 AM »
Hi,

this feature would require to modify the code in the file include.php and to add another control parameter to the function. As the function already has 13 parameter, users may get lost with the options.

Another option is to deactivate "older" news via the WB backend manually.

Regards Christian
Logged

Gitrian

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #272 on: March 27, 2009, 01:05:59 PM »
Hi,

If I deactivate "older" news via the WB backend, I can't see them anymore in the news page (correct me if I'm wrong), so I think I'll have a look at include.php and try to modify the file myself.

Thanks for responding.

Regards Brian
Logged

doc

  • Guest
Re: Code Snippet: Display news items, anywhere
« Reply #273 on: March 27, 2009, 07:51:40 PM »
Hello,

Quote from: Gitrian
If I deactivate "older" news via the WB backend, I can't see them anymore in the news page
Thats true. Released a new version of Anynews at the Addons repository which introduces the variable $not_older_than. This allows you to show only news posted within the last x days. For the last 12 hours simply specify 0.5. Details can be found in the Readme file.

Regards Christian
« Last Edit: March 28, 2009, 12:39:52 PM by doc »
Logged

doc

  • Guest
Display news items in table layout
« Reply #274 on: April 02, 2009, 05:41:09 PM »
Hello,

please post any questions related to anynews in this thread instead of sending a PM at the first place. This may give the hint to other users which may have similar issues. Thanks.

Quote from: question raised via PM
... I would realy love to integrate the anynews snippet in a table (for lay-out puposes) in the homepage for website for my school. As you can see on the homepage of http://www.jonatan.be, the cell under "schoolnieuws"  should be filled with the news, but is not. Further on the page I've used the code-module and then put the snippet in it. That does work, but is not quite as pleasent looking. ...

My public answer:
Think this can be achieved by using a custom template file as described in the Anynews README file. Have a look at /modules/anynews/htt/custom_output_display_mode_3.htt.

Try to play around with the template file. Try something like:
Code: [Select]
<table>
<!-- BEGIN news_block -->
<tr>
<td><strong>{TITLE} {POSTED_WHEN}</strong></td>
<td>{CONTENT_SHORT}<br />
<a href="{LINK}">{ARG_READMORE_TEXT</a>
</td>
</tr>
<!-- END news_block -->
</table>

Remember to set the display mode to 3 as described in the README file. Try the admin tools Addon File editor from the WebsiteBaker repository if you have no glue how to modify the Anynews template files.

Good luck
Christian
Logged

  • Print
Pages: 1 ... 9 10 [11] 12 13 ... 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