Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager
@mvlcek thanks a lot, that should give me a good start.
Reply
roog (and maybe mvlcek),

I'm running into a problem while using News Manager calls (e.g. nm_list_archives()) by way of mvlcek's DynPages plugin.

I'd rather not use another template to include the call for, say, the archives list, so I put the call into a component and ran it via DynPages. This basically works and the link for May is inserted into my designated archives page, but the target page creates a 404 error.

The link is the following:
Code:
http://www.domain.tld/sub-folder/blog/archive/201105

Could it be the problem that my current installation is in a sub folder? Fancy URLs work like a charm so the htaccess should be okay with the rewrite base set to the sub folder.

Any ideas?

(News Manager 2.1.4, DynPages 0.7.1)
Reply
If the archive link generated by nm_list_archives() is correct, which it is seems to be, then I guess the problem is not the News Manager or DynPages plugin but something else. What happens when you turn fancy URLs off? If that solves the problem, it is probably a .htaccess issue.
Reply
I switched FU off and get a link like this

Code:
http://www.domain.tld/sub-folder/index.php?id=blog&archive=201105

which ends up as

Code:
http://www.domain.tld/sub-folder/index.php?id=blog

and shows me all blog entries, not only from May. I had created a separate blog post for March and April for testing purposes.

My .htaccess looks like this, it's vanilla GS with your additions (and something PHP-related at the top)

Code:
AddHandler php53-cgi .php

AddDefaultCharset UTF-8
Options -Indexes

# blocks direct access to the XML files - they hold all the data!
<Files ~ "\.xml$">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>
<Files sitemap.xml>
        Order allow,deny
    Allow from all
    Satisfy All
</Files>

RewriteEngine on

# Usually it RewriteBase is just '/', but
# replace it with your subdirectory path
RewriteBase /sub-folder/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]

# News Manager
RewriteRule ^blog/tag/([^/.]+)/?$ index.php?id=blog&tag=$1 [L]
RewriteRule ^blog/post/([^/.]+)/?$ index.php?id=blog&post=$1 [L]
RewriteRule ^blog/page/([^/.]+)/?$ index.php?id=blog&page=$1 [L]
RewriteRule ^blog/archive/([^/.]+)/?$ index.php?id=blog&archive=$1 [L]

If you'd like direct access, I can PM you with details. Any info I missed I'll gladly provide.
Reply
I think it is important to put the News Manager rewrite rules before the original ones of GS. This is also how the .htaccess content is generated by this plugin. So try the following and tell me what happens:

Code:
AddHandler php53-cgi .php

AddDefaultCharset UTF-8
Options -Indexes

# blocks direct access to the XML files - they hold all the data!
<Files ~ "\.xml$">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>
<Files sitemap.xml>
    Order allow,deny
    Allow from all
    Satisfy All
</Files>

RewriteEngine on

# Usually it RewriteBase is just '/', but
# replace it with your subdirectory path
RewriteBase /sub-folder/

# News Manager
RewriteRule ^blog/tag/([^/.]+)/?$ index.php?id=blog&tag=$1 [L]
RewriteRule ^blog/post/([^/.]+)/?$ index.php?id=blog&post=$1 [L]
RewriteRule ^blog/page/([^/.]+)/?$ index.php?id=blog&page=$1 [L]
RewriteRule ^blog/archive/([^/.]+)/?$ index.php?id=blog&archive=$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /?([A-Za-z0-9_-]+)/?$ index.php?id=$1 [QSA,L]
Reply
1) I edited the german language file as it contained typos, it is attached below

2) my problem is that the date format in your language file does not correspond with the general date format which is set for GS.
When I edit the language file and change it, the existing entries are not updated as far as I noticed

3) I need the option to hide "published at" or to move it below the post-content, now I had to edit the core files (cross your fingers that I won't forget to re-edit this after an update ) ;=)
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
roog Wrote:So try the following and tell me what happens
Same results as before :/
Reply
Alright,

this is for another website I'm working on with Connie.

We're currently using News Manager 2.1.4 which worked fine until this morning/noon. We're still investigating what we possibly did to our installation which might have broken News Manager for us. I'm writing this post in the hope that someone maybe has an idea what might've caused it.

Starting today the dropdown in NM options which selects the blog page got borked and the blog overview doesn't work anymore. Additionally, recent blog post links from the sidebar looks like this, e.g.

Code:
http://www.get-simple.de//post/interview-mit-chris-cagle

The formerly set slug 'blog' isn't honoured anymore so the spot is empty, apparently because the mentioned dropdown is screwed up? Where are you getting the contents for that dropdown, roog? Maybe that'll give us a hint where things have gone wrong.

[Image: gs-de_screenshot_newsmanager_dropdown.png]

What we remember doing was: update the I18N plugin und NM lang files.

We reinstalled NM, tried an earlier version of I18N since we'd updated to 1.6 yesterday (just to make sure), checked the .htaccess for errors, still the same result. Nothing in the error logs which is related or from yesterday/today.

Any help is appreciated!
Reply
connie Wrote:My problem is that the date format in your language file does not correspond with the general date format which is set for GS

I don't think I understand, can you clarify? Do note btw that the language you choose in the News Manager settings panel (/plugins/news_manager/lang/) only applies to the front-end part of your site (including the date). All back-end functions use the global GS language (/admin/lang/) date settings.

connie Wrote:I need the option to hide "published at" or to move it below the post-content

Yeah, I can imagine. However I'm afraid I'll have to disappoint you. I think most people want to include the publish date so I'm gonna leave it in. If you want to hide it without editing the NM code, you could also use the following css rule:

Code:
.nm_post_date {
  display: none;
}

in your style.css.

polyfragmented Wrote:Where are you getting the contents for that dropdown, roog? Maybe that'll give us a hint where things have gone wrong.

That's weird. Indeed it seems that the plugin can no longer read the page slugs. The code responsible for creating the dropdown menu is in /plugins/news_manager/template/edit_settings.php. Specifically the lines 18-20:

Code:
$pages = get_available_pages();
foreach ($pages as $page) {
  $slug = $page['slug'];

I assume you are using GS 3.0? Maybe it's the I18N plugin that's interfering? If DEBUG mode is turned on you could check if there are any errors printed in the page source.

Are .htaccess errors you described before happening on the same site? If so, you can still PM me the details for direct access, and I'll see what I can find.
Reply
New version is out (2.1.5). Changelog:
  • Posts are now listed in the sitemap.xml when you auto-generate one from the Themes tab (thanks to patriotmedia for the idea).
  • Post title checking is now done using JQuery Validate, so you will no longer loose all you have written when saving a post without a title.
  • Several language updates, including new Russian and Turkish translations.
Reply
roog Wrote:I assume you are using GS 3.0? Maybe it's the I18N plugin that's interfering? If DEBUG mode is turned on you could check if there are any errors printed in the page source.
Yeah, 3.0. Removed I18N, to no avail.

Following is in the backend on the news manager page with DEBUG on.
Code:
Warning: file_get_contents(/var/www/foo/html/getsimple/data/pages/.xml) [function.file-get-contents]: failed to open stream: Datei oder Verzeichnis nicht gefunden in /var/www/foo/html/getsimple/admin/inc/basic.php on line 218

Notice: Trying to get property of non-object in /var/www/foo/html/getsimple/plugins/news_manager/inc/functions.php on line 24

Warning: file_get_contents(/var/www/foo/html/getsimple/data/pages/.xml) [function.file-get-contents]: failed to open stream: Datei oder Verzeichnis nicht gefunden in /var/www/foo/html/getsimple/admin/inc/basic.php on line 218

Notice: Trying to get property of non-object in /var/www/foo/html/getsimple/plugins/news_manager/inc/functions.php on line 24

/data/pages/.xml? What the....?

roog Wrote:Are .htaccess errors you described before happening on the same site? If so, you can still PM me the details for direct access, and I'll see what I can find.
No, those problems are on another hosting space and not related.
Reply
Apparently NMPAGEURL is set to "" (empty string). I suggest you remove /data/other/news_manager.xml. This should reset NM to its default settings.
Reply
Your suggestion, sadly, doesn't work.

This is getting weird, roog. I installed GS anew and migrated the old content... twice. Even when news manager is the second plugin installed (need multiuser first) and no other plugins are uploaded, the dropdown is totally borked right from the start.

I've got the impression that the culprit hides somewhere outside news manager and that bad stuff is migrated with the content or old settings -- I just don't know what may be causing it. Page XML data integrity is reported as OK with Health Check as well. We have news manager running on two other separate sites without problems.

Going to put my thinking cap back on later today.

Edit: going to do another fresh install in another sub folder today, doing pedantic step-by-step restructuring.
Reply
roog Wrote:
connie Wrote:My problem is that the date format in your language file does not correspond with the general date format which is set for GS

I don't think I understand, can you clarify? Do note btw that the language you choose in the News Manager settings panel (/plugins/news_manager/lang/) only applies to the front-end part of your site (including the date). All back-end functions use the global GS language (/admin/lang/) date settings.

well I am confused.
In the gsconfig.php we set the locale to de_DE
In the general GS settings i choose de_DE as language and there is the dateformat defined
Now in the NewsManager-Settings I choose german language again, and there
Code:
# date settings
"DATE_FORMAT"         =>  "%e.%b %Y"
is predefined, which is definitely no german dateformat

so I wondered why I had to set it to %d.%m. Y, why not read from general GS settings?


connie Wrote:I need the option to hide "published at" or to move it below the post-content

I set it to "display:none;visibility:hidden" and it is ok.
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
Connie Wrote:
Code:
# date settings
"DATE_FORMAT"         =>  "%e.%b %Y"
is predefined, which is definitely no german dateformat

so I wondered why I had to set it to %d.%m. Y, why not read from general GS settings?

The function that GS uses for the date can not display non-english day/month names, so any plugin displaying information on the frontend, should use the strftime function (like the news manager), which uses a different format string. See here.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:The function that GS uses for the date can not display non-english day/month names, so any plugin displaying information on the frontend, should use the strftime function (like the news manager), which uses a different format string.

Yes indeed. Thanks mvlcek for explaining.
Reply
Thanks for plugin.

How i can add link on full text in [...] ?
Reply
19th Wrote:How i can add link on full text in [...]?

Change line 105 in plugins/news_manager/inc/site.php:

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

to

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

and replace the function nm_create_excerpt in plugins/news_manager/inc/functions.php with:

Code:
function nm_create_excerpt($content, $url) {
  global $NMEXCERPTLENGTH;
  $len = intval($NMEXCERPTLENGTH);
  $content = strip_tags($content);
  $link = "<a href=\"$url\">[...]</a>";
  if (strlen($content) > $len) {
    if (function_exists('mb_substr'))
      $content = trim(mb_substr($content, 0, $len, 'UTF-8')) . " $link";
    else
      $content = trim(substr($content, 0, $len)) . " $link";
  }
  return "<p>$content</p>";
}
Reply
Hi Everyone,

I was wondering, is there a simple method of displaying news posts on 2 or more pages?
Essentially I would like to have the news manager to display say around my 3 recent posts on my 'index' page, and all posts on say a 'news' page.

Is there a way around this (apologies if this has been asked before!)?

Thanks!
Reply
macky Wrote:I was wondering, is there a simple method of displaying news posts on 2 or more pages?

It is not supported by News Manager out of the box, but you could add the following function to for example plugins/news_manager/inc/site.php:

Code:
function nm_show_posts($n) {
  $posts = nm_get_posts();
  $posts = array_slice($posts, 0, $n, true);
  foreach ($posts as $slug=>$file)
    nm_show_post($slug);
}

where $n defines the number of posts you want to show. Now create a new template (for example by copying template.php) wherein this function is called directly and add a page using the Pages tab that uses this new template.
Reply
Please add the ability to show images in excerpts
Reply
Still searching for error regarding the News Manager which stopped working, but there's always time to squeeze in another feature request:

Newsfeed generation. If you were willing to work on it I personally would prefer the ATOM format, it is not as patched-up as RSS and standardised.

Here's a few resources: http://www.atomenabled.org/developers/, http://en.wikipedia.org/wiki/Atom_%28standard%29, http://en.wikipedia.org/wiki/Atom_%28sta...to_RSS_2.0
Reply
@Oleg06: That might be difficult because I have to strip all html tags in order to create an excerpt. But I'll look into it and see if there is a way to safely skip <img> tags.

@polyfragmented: Yes, that has been on my todo list already :-). It might take some time though to implement it.
Reply
polyfragmented Wrote:Still searching for error regarding the News Manager which stopped working (...)
I think I have it narrowed down to the culprit... as soon as I upload the file pages.array into a testinstall, your dropdown gets messed up. The file is being generated by noodle101's page caching plugin and placed into the pages folder along with page xml files.

Still completing the rebuilding of the production page into the testinstall to see if anything else messes with said dropdown. Will keep you posted.

Edit: Seems to be working fine so far.
Reply
Ah, that makes sense. The built-in function get_available_pages() (which NM uses) expects all files in the pages directory to be valid page xml files. If not, weird things happen as you can see :-).
Reply




Users browsing this thread: 13 Guest(s)