Welcome, Guest. Please login or register.
Did you miss your activation email?
February 12, 2012, 01:08:07 PM

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.
149637 Posts in 21099 Topics by 7562 Members
Latest Member: ionline
* Home Help Search Login Register
Pages: 1 ... 16 17 [18] 19 20 21   Go Down
Print
Author Topic: Code Snippet: Display news items, anywhere  (Read 100275 times)
doc
Guest
« Reply #425 on: January 22, 2010, 01:08:39 PM »

Hi,

the Anynews function call shown in the info section of AMASP seems to be corrupt. Think it has to do with the allowed tags <a>. Think a small bug in the edit dialoge of the module used.
http://www.websitebakers.com/pages/code-snippets/listings/anynews.php

Maybe the missing $ can be added to the README files with the next update.

Regards Doc
Logged
erpe

Offline Offline

Posts: 2077


WWW
« Reply #426 on: January 22, 2010, 01:40:20 PM »

Yes, I noticed it yesterday too.
Hope that Aldus will correct this soon.

Thanks for posting.

rgds

erpe
Logged

erpe

Offline Offline

Posts: 2077


WWW
« Reply #427 on: January 22, 2010, 04:03:53 PM »

@all who are interested in this:
http://www.websitebaker2.org/forum/index.php/topic,409.msg110386.html#msg110386

It was a bug in xfast_Template_2 and had nothing to do with anynews.........tho ugh it seems to have on the first impression.

Thanks to Webbird and Aldus for quick help.

rgds

erpe
Logged

aldus

Offline Offline

Posts: 1238


« Reply #428 on: January 25, 2010, 10:10:38 AM »

Hm ...
I've update the modul "informati0n" at AMASP to leave html-source inside a
pre tag uninterpreted, e.g.
Code:
<pre class="code">
&#x3c;ul id="myGallery" class="image-overlay">
&#x3c;li>
&#x3c;a href="http://www.domain.tld">
      &#x3c;img alt="Image 1" src="yourimages/Image1.jpg"/>
      &#x3c;div class="caption">
        &#x3c;h3>My Image&#x3c;/h3>
        &#x3c;p>click for more info&#x3c;/p>
      &#x3c;/div>
    &#x3c;/a>
  &#x3c;/li>
&#x3c;/ul>
</pre>

by replacing the opening braked < to his hex-entity &#x3c; .
So you can (now) display source inside the description/information fields
like shown at
http://www.websitebakers.com/pages/code-snippets/various/image-overlay.php

Also replaced the $ char to avoid PHP-Conflicts in examples, like "var $xyz is not defined" ...

Regards
Aldus
Logged
kleo

Offline Offline

Posts: 11


« Reply #429 on: January 25, 2010, 07:42:48 PM »

I have more pages (and sections) with the module News. But I use not Groups by News module.

How can I use Anynews to display newsitems from certain pages or section?
How can I change the code?

More thanks!

Logged
Turskis

Offline Offline

Posts: 50


« Reply #430 on: January 27, 2010, 09:42:34 AM »

I've been asking about possibility to view the posts in "most commented" order:

http://www.websitebaker2.org/forum/index.php/topic,16548.0.html

I quess this is possible with Anynews, by modifying include.php. My coding skills are limited, so could somebody give me a hint?

Code:
sort_by...    5:= number of comments
Logged
WebBird
Guest
« Reply #431 on: January 27, 2010, 10:35:43 AM »

Hmmm... This requires a more complex SQL query, as the comments are stored in another table. You will have to modify the query (lines 127ff), or add another one especially for the comments count.

Are there any other ones interested in this feature?
Logged
WebBird
Guest
« Reply #432 on: January 27, 2010, 12:20:46 PM »

Please try the include.php attached. Be sure to make a backup copy of the original include.php before trying this one.

Edit: Removed attachment. New version available at AMASP. http://www.websitebakers.com/pages/code-snippets/listings/anynews.php
« Last Edit: January 29, 2010, 10:49:01 AM by WebBird » Logged
Turskis

Offline Offline

Posts: 50


« Reply #433 on: January 27, 2010, 08:34:13 PM »

Seems to work. It would be good to display number of comments after the date in news list.
Logged
WebBird
Guest
« Reply #434 on: January 28, 2010, 10:54:21 AM »

Seems to work. It would be good to display number of comments after the date in news list.

I thought you would suggest this. Try COMMENTS markup. Wink (Custom Template)
Logged
Turskis

Offline Offline

Posts: 50


« Reply #435 on: January 28, 2010, 01:36:10 PM »

Just can't understand how to add number of comments to custom templates  embarassed
Logged
WebBird
Guest
« Reply #436 on: January 28, 2010, 01:52:26 PM »

Just add {COMMENTS} to the template you use at the position you wish.
Logged
Turskis

Offline Offline

Posts: 50


« Reply #437 on: January 28, 2010, 02:21:12 PM »

Not working. Do I need to add some custom placeholder also?

I tried adding
Code:
<tt>COMMENTS: </tt>{COMMENTS}<br />
in custom_output_displ ay_mode_4.htt
Logged
WebBird
Guest
« Reply #438 on: January 28, 2010, 02:54:35 PM »

Do you USE that template? (Param $display_mode in displayNewsItems call.)
Logged
WebBird
Guest
« Reply #439 on: January 28, 2010, 03:24:55 PM »

Maybe this helps...

If you do not set $display_mode, the default is 'detailed output'. The template file for 'detailed output' is htt/detailed_output.htt.

Here's the content of that file:

Code:
<div class="anynews">
<h2>{TXT_HEADER}</h2>

<!-- BEGIN news_block -->
<p><strong>{TITLE} {POSTED_WHEN}</strong></p>
{CONTENT_SHORT}
<!-- BEGIN readmore_link_block -->
<p><a href="{LINK}">{TXT_READMORE}</a></p>
<!-- END readmore_link_block -->
<hr />
<!-- END news_block -->
</div>

Just add the markup {COMMENTS} to that file. Example:

Code:
<div class="anynews">
<h2>{TXT_HEADER}</h2>
Number of comments: {COMMENTS}<br />
<!-- BEGIN news_block -->
<p><strong>{TITLE} {POSTED_WHEN}</strong></p>
{CONTENT_SHORT}
<!-- BEGIN readmore_link_block -->
<p><a href="{LINK}">{TXT_READMORE}</a></p>
<!-- END readmore_link_block -->
<hr />
<!-- END news_block -->
</div>
Logged
Turskis

Offline Offline

Posts: 50


« Reply #440 on: January 28, 2010, 06:05:10 PM »

Tried that, but it is not displaying the number. Only "Number of comments: " and then blank
Logged
WebBird
Guest
« Reply #441 on: January 28, 2010, 06:24:07 PM »

Hm. Works for me. huh

Just saw that the text is outside the loop. Try this:

Code:
<div class="anynews">
<h2>{TXT_HEADER}</h2>
<!-- BEGIN news_block -->
<p><strong>{TITLE} {POSTED_WHEN}</strong></p>
Number of comments: {COMMENTS}<br />
{CONTENT_SHORT}
<!-- BEGIN readmore_link_block -->
<p><a href="{LINK}">{TXT_READMORE}</a></p>
<!-- END readmore_link_block -->
<hr />
<!-- END news_block -->
</div>
Logged
Turskis

Offline Offline

Posts: 50


« Reply #442 on: January 28, 2010, 07:48:36 PM »

No help. I think that variable {COMMENTS} is not set anywhere. Do I need some custom placeholder? Or does it need to be set in include.php. Or am I totally lost here?
Logged
WebBird
Guest
« Reply #443 on: January 29, 2010, 10:47:46 AM »

It is already set in the new include.php. But maybe I did not upload the last version. huh

Please download the new version 1.15 at AMASP and try it again.

http://www.websitebakers.com/media/amasp_uploads/anynews_v1.15.zip

Edit: Checked it out, it was missing in the include.php I provided for testing. I'm sorry. undecided
« Last Edit: January 29, 2010, 10:49:31 AM by WebBird » Logged
Turskis

Offline Offline

Posts: 50


« Reply #444 on: January 29, 2010, 12:02:08 PM »

Now it's working. Thanks, this was a very important feature for me!
Logged
doc
Guest
« Reply #445 on: January 29, 2010, 01:26:32 PM »

@Webbird: Would be nice if you could also maintain/update the README file with new releases. The latest implemented options seems to be missing. Also the README on AMASP and Add-ons point to an outdated version.

Regards Doc
Logged
WebBird
Guest
« Reply #446 on: January 29, 2010, 02:48:50 PM »

Yepp. Will write that on my Todo list. But I need help with the NL readme. rolleyes
Logged
seagull

Offline Offline

Posts: 81


« Reply #447 on: January 31, 2010, 11:20:56 AM »

Maybe i overlooked it, but when i use displayanynews with displaymode=2(only the newstitle as link) and having newsitems with only shorttext the resulting page displays the longtext wich is empty, so only the header and the footer are displayed.
Am i doing something wrong or is this the way the snippet should work?(only with long text)

@webbird, i would like to help you with the Dutch translation.

Jan
Logged
WebBird
Guest
« Reply #448 on: January 31, 2010, 03:16:46 PM »

Great, Jan, thank you! Just take the help_en.html to see what's new there and missing in help_nl.html.

I'll take a look at displaymode 2 tomorrow. Promise. grin
Logged
Harry P.

Offline Offline

Posts: 84


« Reply #449 on: January 31, 2010, 07:07:59 PM »

Hello All,

when I use the AnyNews call...

Code:
if (function_exists('displayNewsItems')) {
   displayNewsItems(
       $group_id = 2,
       $max_news_items = 10,
       $max_news_length = -1,
       $display_mode = 1,
       $lang_id = 'auto',
       $strip_tags = true,
       $allowed_tags = '<p><a><img>',
       $custom_placeholder = false,
       $sort_by = 1,
       $sort_order = 1,
       $not_older_than = 0
   );
}

... on a standalone CODE page, News teasers display fine within my template.

But when I pack the same into a droplet, say "Anynews", and place it on a WYSIWYG page with [Anynews]], the News teasers appear outside (above) my WB template.

Any idea what I'm missing? I walked through this whole thread but couldn't find a clue...  huh
Logged
Pages: 1 ... 16 17 [18] 19 20 21   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!