Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager
Hi,

the news manager works perfectly for me! thank you very much!
I'm working on a website where i use news manager for the news on the homepage. (ofcourse)
But beside that i'de like to use it for something else on the website. So i'de like to duplicate news manager.
I duplicated the directory "news_manager" and the php file: "news_manager"
So i thought: in al the php files i'll replace the words "news manager", "news_manager", "newsmanager", "nm" for something else in the same way. (with the _ and the space etc...)
It works almost! except that when i make a post, it shows in my news manager and in the duplicated news manager. Is there a simple way to solve this? It looks like both news manager still get there information out of the same database...
Reply
I hadn't come across this being noted anywhere so thought it would be worth mention, if you have canonical redirects enabled in gsconfig.php this will break News Manager. Is there a patch for this or is it even possible to patch?
Modern UI Admin for GetSimple
Watch the demo. Install this plugin. Use this CSS. Enjoy.
Reply
sal Wrote:I hadn't come across this being noted anywhere so thought it would be worth mention, if you have canonical redirects enabled in gsconfig.php this will break News Manager. Is there a patch for this or is it even possible to patch?

Enabling GS built-in canonical redirection will break any plugin that uses URL parameters (like NM). Nothing wrong about GetSimple, it's difficult (impossible?) to do for all cases. That's why GSCANONICAL is not enabled by default.

sal Wrote:Is there a patch for this or is it even possible to patch?

It'd be nice to have a canonical redirection plugin that allows excluding specified slugs.

For now, here's a quick solution. Insert this in your theme's functions.php file (create it if you don't have one):

Code:
<?php
if ($url != 'news') {
    if ($_SERVER['REQUEST_URI'] != find_url($url, $parent, 'relative')) {
        redirect(find_url($url, $parent));
    }
}

(Change 'news' to your NM slug name)

Edit: I forgot... you have to disable canonical redirects in gsconfig for this to work.
Reply
hi,
whenever I add/edit a news, the plugin give me the chmod error even if I set data/backups to 0777.
I've tried to remove nm_update_cache() in this passage (plugins/news_manager/inc/posts.php):

Code:
# write data to file
  if (@XMLsave($xml, $file) && nm_update_cache())
    nm_display_message(i18n_r('news_manager/SUCCESS_SAVE'), false, @$backup);
  else
    nm_display_message(i18n_r('news_manager/ERROR_SAVE'), true);

so I save and the success message appears.
but I have to manually refresh to see the modified content (so I can't see news added without refreshing the page).

this problem doesn't occurs on another GS installation, different domain.
I have no problems in adding/editing normal pages.

could you help me to find what's the problem with that? I believe it's something related with the cache functions..
Reply
Hello everyone
I've got strange results when tried to screw the External commenting plug-in into the News Manager. I found sourcefile
Code:
/plugins/news_manager/inc/site.php
and inserted the 129-th line like it was described in the External commenting plug-in's reference:
Code:
get_external_comments();
It seemed to work perfectly but the comments are the same to all the news posts. And there's absolutely no difference between them. I have no idea how to make independent Disqus comments for different news.
Can anyone help?
PS: when logged into Disqus dashboard I can really see all the comments are related to News page but not to distinct news posts. Is it possible to fix?
Hail to get-simple developers!
Reply
I get an error message on the post's (news post..) page:
Code:
Warning: Invalid CRT parameters detected in*\plugins\news_manager\inc\functions.php on line 86 Warning: Invalid CRT parameters detected in *\plugins\news_manager\inc\functions.php on line 86 Warning: Invalid CRT parameters detected in *\plugins\news_manager\inc\functions.php on line 86 Warning: Invalid CRT parameters detected in *\plugins\news_manager\inc\functions.php on line 86 Warning: Invalid CRT parameters detected in *\plugins\news_manager\inc\functions.php on line 86

Referring to:

Code:
function nm_get_date($format, $timestamp) {
  global $NMLANG;
  $locale = setlocale(LC_TIME, null);
  setlocale(LC_TIME, $NMLANG);
  $date = strftime($format, $timestamp); /* This Line... 86 */
  setlocale(LC_TIME, $locale);
  return $date;
}
http://Blog.TDT-Alpha.com/
(Website will be replaced soon, with an image database made with GS)
Reply
Updated german language file with german language format %d.%m.%Y is attached

Cheers, Connie
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
TDT-Alpha,

check the language file if there is a date set at the end of the file:

Code:
# date settings
"DATE_FORMAT"         =>  "%d.%m.%Y"
or any other date format
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
Connie Wrote:"DATE_FORMAT" => "%d.%m.%Y"

It was set to:
Code:
"DATE_FORMAT"         =>  "%b %e, %Y"

That's the default file...
Edited and it works now, thanks!!!
http://Blog.TDT-Alpha.com/
(Website will be replaced soon, with an image database made with GS)
Reply
yepp, the next stone rolled down the hill ;=)
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
reff Wrote:I have no idea how to make independent Disqus comments for different news.
Can anyone help?
Take a look at the External Comments forum thread, this post and next ones (fix by RobA).
Reply
RSS Generation

My clients needed an RSS Feed of their blog so they can submit it to Facebook.

I will post the 2 simple changes I made to your news plugin for automatic rss generation.
Maybe it can give you a starting point on adding the functionality or help someone else out.

I added the following function to "plugins/news_manager/inc/admin.php" , above the nm_save_post" function:
Code:
function rss_feed_generate()
{
global $SITEURL;
$dir = "../data/posts";

$RSSString                              = "";
$RSSString                              .= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$RSSString                              .= "<rss version=\"2.0\">\n";
$RSSString                              .= "<channel>\n";
$RSSString                              .= "<title>$SITEURL - RSS Feed</title>\n";
$RSSString                              .= "<link>$SITEURL</link>\n";
$RSSString                              .= "<description>$SITEURL</description>\n";
$RSSString                              .= "<lastBuildDate>".date("D, j M Y H:i:s T")."</lastBuildDate>\n";
$RSSString                              .= "<language>en-us</language>\n";

$post_array = glob($dir . "/*.xml");
$limit = "5";
array_multisort(array_map('filemtime', $post_array), SORT_DESC, $post_array);
$post_array = array_slice($post_array, 0, $limit);

foreach($list as $file) {
    include $file;
}
foreach ($post_array as $filename) {
        $blog_post = simplexml_load_file($filename);
        $RSSDate                                 = $blog_post->date;
        $RSSTitle                              = $blog_post->title;
        $RSSBody = html_entity_decode($blog_post->content);
        $RSSBody = str_replace("&nbsp;", " ", $RSSBody);
        $RSSBody                               = substr(htmlspecialchars(strip_tags($RSSBody)),0,200)."...
        
";
        $ID                                     = str_replace("../data/posts/", "", $filename);
        $ID                                     = str_replace(".xml", "", $ID);
        $RSSString                              .= "<item>\n";
        $RSSString                              .= "\t  <title>".$RSSTitle."</title>\n";
        $RSSString                              .= "\t  <link>http://$SITEURL/index.php?id=blog&amp;post=".$ID."</link>\n";
        $RSSString                              .= "\t  <guid>http://$SITEURL/index.php?id=blog&amp;post=".$ID."</guid>\n";
        $RSSString                              .= "\t  <description>".$RSSBody."</description>\n";
        $RSSString                              .= "</item>\n";
}


$RSSString                              .= "</channel>\n";
$RSSString                              .= "</rss>\n";

if(!$fp = fopen("../rss.rss",'w')){
        echo "Could not open the rss.rss file";
        exit();
}
if(!fwrite($fp,$RSSString)){
        echo "Could not write to rss.rss file";
        exit();
}
fclose($fp);
}

Then I executed that function right at the end of the "nm_save_post" function. That way a new rss feed will be generated after each page save. Note the RSS feed has a limit of 5 posts (you can change that by changing the limit variable above). The RSS Feed is also sorted by date of edited/created posts.

Below is a snippet of where I exectuted the "rss_feed_generate()" function:
Code:
# write data to file

    if (!@XMLsave($xml, $file))

      nm_display_message(i18n_r('news_manager/ERROR_SAVE_POST'), TRUE);

    else

      nm_display_message(i18n_r('news_manager/SUCCESS_SAVE_POST'));

  }
    rss_feed_generate();
}
Reply
reff Wrote:Hello everyone
I've got strange results when tried to screw the External commenting plug-in into the News Manager. I found sourcefile
Code:
/plugins/news_manager/inc/site.php
and inserted the 129-th line like it was described in the External commenting plug-in's reference:
Code:
get_external_comments();
It seemed to work perfectly but the comments are the same to all the news posts. And there's absolutely no difference between them. I have no idea how to make independent Disqus comments for different news.
Can anyone help?
PS: when logged into Disqus dashboard I can really see all the comments are related to News page but not to distinct news posts. Is it possible to fix?

Already answered by Connie, but more specifically you need to add the parameters to the get_external_comments call.

-Rob A>
Reply
I know there is a nm_list_recent function for sidebar, but, what if I'd like to have the extended version of latest news there? meaning: title and post's content in sidebar?
Reply
hi,

thank you for your great extension. i love it.

just one little bug?:
.htaccess content -> there is a double "\\"

Code:
# blocks direct access to the XML files - they hold all the data!
<Files ~ "\\.xml$">
Reply
Hi all, I've been on vacation for a while and therefore wasn't able to reply.

@jarno1982: you're right that the duplicate plugin reads from the same DB. To fix this, change NMPOSTPATH, NMSETTINGS, etc. i.e., have them point to a different location/file.

@allienato: you shouldn't remove the line that updates the post cache. It will break NM functionality. It is better to remove the cache file itself and let NM generate a new one.

@mikeh: thanks a lot, good work! I will include that code as soon as I have time.

@lanooz: you'll have to modify the function nm_list_recent() in news_manager/inc/sidebar.php and make it print the post content (or part of it) too.

@chainsaw81: thanks for pointing that out, I've fixed it now.
Reply
Hi

Testing GS on a WAMP localhost, installed the News Manager plugin working great except one small thing, the top "Published On" comes with no date

Verified my server date and time and all is ok, tried published date previius to todays date, nothing gets it appearing, any ideas?

regards

John
Reply
kidda media Wrote:Verified my server date and time and all is ok, tried published date previius to todays date, nothing gets it appearing, any ideas?
http://get-simple.info/forum/post/14970/#p14970
Addons: blue business theme, Online Visitors, Notepad
Reply
yojoe Wrote:
kidda media Wrote:Verified my server date and time and all is ok, tried published date previius to todays date, nothing gets it appearing, any ideas?
http://get-simple.info/forum/post/14970/#p14970

Thanks for taking the time to reply however that makes zero sense to me, any practical steps to follow to address this?

John
Reply
kidda media Wrote:Thanks for taking the time to reply however that makes zero sense to me, any practical steps to follow to address this?

Add manually your timezone to for example gsconfig or your template file
Code:
date_default_timezone_set('Europe/your_capital');

On your local WAMP date might not be shown, so move your development to LAMP or destination server.
Addons: blue business theme, Online Visitors, Notepad
Reply
Hey guys, i really like get simple and the news manager plugin also, but i still miss a feature (or I didn't discover it Wink )
I converted a html template to a getsimple template, it consists of the content and a static single news on the right of it,

when i try to embed a news published with the news manager using <?php nm_list_recent(); ?>
it only shows the headline, but i'd liked to have the whole news there

how do i have to edit the sidebar.php????????

as a workaround i could use the edit component feature, but the homepage is for a person who has absolutely no skills in html or css, and that would maybe too complicated for him
Reply
I am currently trying to hack the page excerpt function to modify the [...] at the end of excerpts. I'd like the [...] string to be a link pointing to the full post version as the headline already does.

This should be easy to accomplish for someone with more PHP experience. Maybe you guys can give me a hint.

I looked around in other news manager related files and found the code which builds the URL for the headline (/plugins/news_manager/inc/site.php), but I'm unable to recreate the functionality in the excerpt code.

/plugins/news_manager/inc/functions.php, around line 150:
Code:
$content = trim(mb_substr($content, 0, $len, 'UTF-8')) . ' [...]';

I modified it like this so far:
Code:
$content = trim(mb_substr($content, 0, $len, 'UTF-8')) . ' <a href="" title="">[weiterlesen &hellip;]</a>';

I tried inserting <?php echo $url; ?> (from site.php) which gets printed as-is, tried separating it by way of . <?php echo $url; ?> ., to no avail.

Help?
Reply
polyfragmented Wrote:I am currently trying to hack the page excerpt function to modify the [...] at the end of excerpts. I'd like the [...] string to be a link pointing to the full post version as the headline already does.

This should be easy to accomplish for someone with more PHP experience. Maybe you guys can give me a hint.

I looked around in other news manager related files and found the code which builds the URL for the headline (/plugins/news_manager/inc/site.php), but I'm unable to recreate the functionality in the excerpt code.

/plugins/news_manager/inc/functions.php, around line 150:
Code:
$content = trim(mb_substr($content, 0, $len, 'UTF-8')) . ' [...]';

I modified it like this so far:
Code:
$content = trim(mb_substr($content, 0, $len, 'UTF-8')) . ' <a href="" title="">[weiterlesen &hellip;]</a>';

I tried inserting <?php echo $url; ?> (from site.php) which gets printed as-is, tried separating it by way of . <?php echo $url; ?> ., to no avail.

Help?

I just tested this out and accomplished it with 2 small edits to "news_manager/inc/functions.php" and "news_manager/inc/site.php". Below are my edits and the edited files are attatched to this post (ver: 2.2.4).

File: news_manager/inc/site.php : Around Line 99
Change
Code:
if ($excerpt) $content = nm_create_excerpt($content);
to
Code:
if ($excerpt) $content = nm_create_excerpt($content, $url);

File: news_manager/inc/functions.php : Around Line 151-153
Change
Code:
$content = trim(mb_substr($content, 0, $len, 'UTF-8')) . ' [...]';
    else
      $content = trim(substr($content, 0, $len)) . ' [...]';
to
Code:
$content = trim(mb_substr($content, 0, $len, 'UTF-8')) . '..&nbsp;&nbsp;<a href="'.$url.'">Read More</a>';
    else
      $content = trim(substr($content, 0, $len)) . '..&nbsp;&nbsp;<a href="'.$url.'">Read More</a>';
Reply
Thanks a million, Mike! +1!
Reply
1. When I use News Manager on my local Xampp server I do not get the Date on the post. But after uploading the same configuration to my live server the date appears automatically. How can I make it appear on my local server as well?

2. How and where can I edit the style for the post
Reply




Users browsing this thread: 8 Guest(s)