Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager
Carlos Wrote:maybe this:
Code:
foreach (array_reverse($data->item,TRUE) as $item) {

Unfortunately that too renders all the posts invisble. This is quite a puzzle...I think I'm going to be at this all night Tongue
Reply
Sorry I have no time to install NM and play with it, so I can't help you right now...

Anyway I suggest using some alternative as this plugin is no longer supported.

[edit] I finally found the way to do it. See this post: http://get-simple.info/forum/post/31132/#p31132
Reply
hello!
How to display intro of content in Sidebar?
i modify function nm_list_recent() to display date, but can't get content
Code:
function nm_list_recent() {
  global $NMRECENTPOSTS;
  $posts = nm_get_posts();
  if (!empty($posts)) {
    echo ' ';
    $posts = array_slice($posts, 0, $NMRECENTPOSTS, true);
    foreach ($posts as $post) {
      $url = nm_get_url('post') . $post->slug;
      $title = strip_tags(strip_decode($post->title));
      $postDate = date('d.m.Y', strtotime($post->date));
      echo "<p><span class='news_date'>$postDate</span></p>
      <p><div class='news_title_colon'><a href=\"$url\">$title</a></div></p><br />";
    }
    echo ' ';
    
  }
}
Reply
UksusoFF Wrote:hello!
How to display intro of content in Sidebar?

well, we did it at www.get-simple.de that way:

Code:
<?php

        if (return_page_slug()!='blog') {

            echo '<div class="section">';
            echo '<h2>News!</h2>';
            nm_list_recent();
            echo '</div>';

        } else {

            echo '<div class="section">';
            echo '<h2>News!</h2>';
            nm_list_recent();

            echo '</div>';

            echo '<div class="section">';
            echo '<h2>Blog-Archiv</h2>';
            nm_list_archives();
            echo '</div>';

        }

    ?>

as the news are presented on the page with the slug "blog", we show archive + latest news on that page,
on all other pages we only show latest news

Cheers, Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
Connie Wrote:well, we did it at www.get-simple.de that way:
sorry but i can't see content of news in this sample.
i see this:
Quote:GetSimple 3.1.2: BugFix-Release
Neu! E-Book: Open Source CMS im Vergleich …
GetSimple 3.1.1B Bugfix-Release
but i need this:
Quote:GetSimple 3.1.2: BugFix-Release
Diese Version ist ein BugFix, es wurde ein Problem beim Hochladen mehrerer Dateien in Unterordner behoben:
Neu! E-Book: Open Source CMS im Vergleich …
und GetSimple ist natürlich dabei.
GetSimple 3.1.1B Bugfix-Release
GetSimple 3.1.1Beta ist ein Release, welches ausschließlich Bugs bereinigt.
Reply
found it:
$data = getXML(NMPOSTPATH . "$post->slug.xml");
$content = $data->content;
$content = nm_create_excerpt(strip_decode($content));
Reply
Hi!
I really like this plugin. It helps me in any projects, especially when I want to do something different and don´t know how to do using PHP too much and I don´t want to call friends.
Now I have a doubt.
Is it possible to put excerpt somewhere in the post that I don´t have to define number of caracters?
How to show an image that can be in the post before excerpt?
Basing in Wordpress, where can I put what I want.

Thank you everybody!
Reply
Thanks for this amazing Plugin Smile

But is there anyway I can choose to show the posts on more than just one page ?

If it's not there maybe it can be a great feature to add

" each page can have it's own posts , and when writing the post you choose on which page you want this post to be posted "
Reply
Having a strange problem, if I edit a post and save it, it is saving the edited post as a new one.
I tried to delete the duplicate, but it just re-appears.

Has anyone else experienced this or know whats going on?


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
islander Wrote:Having a strange problem, if I edit a post and save it, it is saving the edited post as a new one.
I tried to delete the duplicate, but it just re-appears.

Do your post titles have non-English characters?

Does your /data/posts folder have the same file permissions/ownership as /data/pages?
Reply
I have added another writer on my site, so is there a way of getting the authors name to appear under their posts ?

so it would be

Article title
Published On (date)
by editor

sorry If I have missed it, tried 4 or 5 searches
Reply
@gordo

This plugin doesn't have that option.
I don't remember having seen any patch to make it support author names.
Reply
@danielmooreuk

A bit late, but... :-)

I did some experimenting with NM and found how to make it sort posts by ascending date.

Edit news_manager/inc/functions.php and change line 21:
Code:
return $posts;
to:
Code:
return array_reverse($posts);
Reply
thanks carlos.. what a shame.....
Reply
I don't agree. It may be a pity, but not a shame. It's a simple plugin with very few options, but works nicely.
Reply
Carlos Wrote:Do your post titles have non-English characters?

Does your /data/posts folder have the same file permissions/ownership as /data/pages?

Thanks for the reply. Yes to both questions. Folders have permissions, and yes, some of the titles had accented characters, such as "ñ, á, í, etc."

By your question, I am guessing that this is a known problem? Is there also a fix, if this is the problem?

Thanks for any info.


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
weren't knocking the plug in, it is a dam good. more a shame I can't do what I would like.
Reply
@islander

I can use áéíóúñ with no problems. I remember there was trouble with some other characters (non-latin, e.g. Russian), but not with these.

If you create and later edit a post with only English chars, do you have the same issue?

While browsing this thread I read some user had a similar problem (duplicate posts...) but I think he/she didn't get a reply.

I can only tell you to make sure read/write permissions are *exactly the same* for /data/posts and /data/pages, just in case.
Also check if /data/other/news_manager is writable.

Have you tried to enable GS debug mode to see if you get any errors?

Also, are you able to do a new fresh install in the same server/host (on another folder maybe), both GS and NM, and test this?
Reply
Carlos Wrote:Have you tried to enable GS debug mode to see if you get any errors?

Also, are you able to do a new fresh install in the same server/host (on another folder maybe), both GS and NM, and test this?

Permissions are all fine. I will try a fresh install and enable debug. Will also play with titles to see what is going on. Will try to report finding later. Thanks.


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
I think News Manager is a great plug-in. It does everything I need for the minimal blog I run. I have added a couple of tweaks to my installation which I thought I'd share here - they might be useful to someone else.

1) When editing posts I found it irked me that there wasn't a "Save" button in the sidebar like there is when editing pages. I have added one by making a simple change to the file /plugins/news_manager/template/edit_post.php. At the very end of the file, before:

Code:
});
</script>

add the following:

Code:
// BOF: Let's have that extra submit button in the sidebar (same as with the page editor)
$('.submit').clone().appendTo('#sidebar');
$('#sidebar .submit').css({'margin-left': '14px'}).click(function() { $('form#edit.largeform input.submit').trigger('click'); });
// EOF: Let's have that extra submit button in the sidebar (same as with the page editor)

2) I didn't like the fact that News Manager would truncate in the middle of a word when producing it's excerpts, so I fixed that with the following method:

Code:
/**
* Takes a block of text/HTML and trims it's length to $NMEXCERPTLENGTH, but will
* only trim at a whitespace character.
* If a $url is supplied, then a "read more" link will be appended to the snippet.
*
* @param  text/HTML $snippet The text/HTML to trim.
* @param  text      $url     The "read more" URL.
* @return text            The trimmed text, stripped of HTML.
*
*/
function trim_snippet($snippet, $url = false) {
    global $NMEXCERPTLENGTH;
    $cutOff = intval($NMEXCERPTLENGTH);
    $snippet = strip_tags($snippet);
    if (strlen($snippet) > $cutOff) {
        $whole_words = explode(' ', $snippet);
        $return_snippet = '';
        $test_return_snippet = '';
        foreach ($whole_words as $word) {
            $test_return_snippet = $return_snippet . ' ' . $word . '&nbsp;&hellip;' . ($url ? '&nbsp;[<a href="' . $url .'">read&nbsp;more</a>]' : '');
            if (strlen($test_return_snippet) <= $cutOff) {
                $return_snippet = $return_snippet . ' ' . $word;
            } else {
                $return_snippet = $return_snippet . '&nbsp;&hellip;' . ($url ? '&nbsp;[<a href="' . $url .'">read&nbsp;more</a>]' : '');
                break;
            }
        }
        $snippet = $return_snippet;
    }
    return $snippet;
}

Paste this code into /admin/inc/theme_functions.php

Then, in the file /plugins/news_manager/inc/site.php, find the function called "nm_show_post" and replace the following line:

Code:
if ($excerpt) $content = nm_create_excerpt($content);

with:

Code:
if ($excerpt) $content = '<p>' . trim_snippet($content, $url) . '</p>';

I hope these snippets of code are useful to someone.
Reply
A further change I have made on my weblog (News Manager) at https://www.perpetual-beta.org/ is to have proper previous and next buttons at the end of each post, in place of the JavaScript "back" link that the News Manager uses by default.

In the file /plugins/news_manager/inc/site.php, find the function called "nm_show_post" and replace the following:

Code:
# show "go back" link, if required
if (strstr($_SERVER['QUERY_STRING'], "post=$slug")) {
echo '<p class="nm_post_back"><a href="javascript:history.back()">&lt;&lt; ';
i18n('news_manager/GO_BACK');
echo '</a></p>';
}

with:

Code:
// BOF: Previous & Next article links
if ( !$excerpt && ($post->private != 'Y') ) {
    echo '<div id="pagerBottom">';
    $articleIndex = nm_get_posts();
    $articleDirectory = array();
    foreach ($articleIndex as $article) $articleDirectory[strtotime($article->date)] = $article->title . '|' . nm_get_url('post') . $article->slug;
    unset($articleIndex);
    ksort($articleDirectory);

    $current = strtotime($post->date);
    reset($articleDirectory);
    while (key($articleDirectory) !== $current) next($articleDirectory);

    prev($articleDirectory);
    $previous = key($articleDirectory);
    if ( ($previous !== $current) && $previous ) {
        $prevTemp = explode('|', $articleDirectory[$previous]);
        echo '<div class="prevLink"><a href="' . $prevTemp[1] . '" title="read: ' . $prevTemp[0] . ' (dated: ' . date('l jS \of F Y h:i:s A', $previous) . ')"><span class="button">&larr; Previous Post</span></a></div>';
        next($articleDirectory);
    } elseif (!$previous) {
        reset($articleDirectory);
    }

    next($articleDirectory);
    $next = key($articleDirectory);
    if ( ($next !== $current) && $next ){
        $nextTemp = explode('|', $articleDirectory[$next]);
        echo '<div class="nextLink"><a href="' . $nextTemp[1] . '" title="read: ' . $nextTemp[0] . ' (dated: ' . date('l jS \of F Y h:i:s A', $next) . ')"><span class="button">Next Post &rarr;</span></a></div>';
    }
    unset($articleDirectory);
    echo '</div>';
}
// EOF: Previous & Next article links

Have fun!
Reply
@darkblue

Thanks for sharing your tweaks!

- Extra Save button (nice idea), works ok.
- Previous and Next links tested. Great!
- The excerpt fix works, but strangely they are shorter than what I have in settings. I'll take a look at that later.

Anyway, a comment about your excerpt patch:
darkblue Wrote:Paste this code into /admin/inc/theme_functions.php
I think it would be better to put that function in the "News Manager mod" instead of patching GetSimple core (what should be avoided if possible because of upgrades). Maybe in news_manager/inc/site.php ...
Reply
Carlos Wrote:I think it would be better to put that function in the "News Manager mod" instead of patching GetSimple core (what should be avoided if possible because of upgrades). Maybe in news_manager/inc/site.php ...

That makes perfect sense Carlos and is good advice for others. I only patched the core as I use this same function for search engine results (and other snippets) so having it within the News Manager code wasn't semantically correct in my case.

Glad you like the mods.
Reply
If you use News Manager in a Windows environment (WAMP, XAMPP...) your post dates will not be displayed properly by default.
It seems it's because of NM's default date format:
Code:
"DATE_FORMAT"         =>  "%b %e, %Y"
As we can read here http://www.php.net/manual/en/function.strftime.php the %e parameter is not supported by Windows' implementation of the strftime function.

To fix this, edit your language file (news_manager/lang/en_US.php or other) and change that line (it's near the end of the file) to something like e.g.:
Code:
"DATE_FORMAT"         =>  "%b %#d, %Y"
or something different like:
Code:
"DATE_FORMAT"         => "%Y.%m.%d - %H:%M"
(See all % parameters you can use in the php.net link above.)
Reply
If you have javascript disabled, when you create or edit a post in News Manager the post options are not available.

To fix it, edit news_manager/template/edit_post.php and insert this:

Code:
<noscript><style>#metadata_window {display:block !important} </style></noscript>

before this (line 41):
Code:
<div style="display:none;" id="metadata_window">
Reply




Users browsing this thread: 6 Guest(s)