Thread Rating:
  • 6 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager (updated)
Fix print date in post.

\plugins\news_manager\inc\functions.php , function nm_get_date ,
Code:
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
    // workaround for Windows, as strftime returns ISO-8859-1 encoded string
    $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $format); // add line code, fix print date
    $date = utf8_encode(strftime($format, $timestamp));
} else {
    $date = strftime($format, $timestamp);
}

Manual: strftime
Reply
Hi MaxShy,
I tested it on IIS 7.5 and it works perfectly: no more zero ahead the day using the date format %e %B %Y.
Good Job!
My website made with GetSimple CMS is

Arte & Società
www.artesocieta.eu

An indipendent website about Italian Contemporary Visual Arts
Reply
When i add new news I get this error

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /XXXX/plugins/news_manager/inc/cache.php on line 30

News published still correctly... I havent change any line of that file or earlier its working correctly and no error.
Reply
(2013-08-28, 21:01:56)artzii Wrote: When i add new news I get this error

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /XXXX/plugins/news_manager/inc/cache.php on line 30

News published still correctly... I havent change any line of that file or earlier its working correctly and no error.

Do you get this error since you started using News Manager? Or has it begun appearing later?
What plugin version?
Reply
(2013-08-24, 23:34:25)TeeJay Wrote: However, there's one thing that surprised me - why isn't a post's picture also on the full post page? I don't think it would be hard to implement that feature. It's a pity that it isn't so Smile

No, it's not hard. It's just I thought that images would mostly be used for post thumbnails in main news page, etc. (as Oleg suggested) but not in single post pages.

I'm changing the way these new options are set, so that it's more customizable, including this. I hope to post a new beta soon.
Reply
(2013-08-29, 00:46:15)Carlos Wrote:
(2013-08-28, 21:01:56)artzii Wrote: When i add new news I get this error

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /XXXX/plugins/news_manager/inc/cache.php on line 30

News published still correctly... I havent change any line of that file or earlier its working correctly and no error.

Do you get this error since you started using News Manager? Or has it begun appearing later?
What plugin version?

Appearing later... i have used it about year... yesterday i used and that time its appear...
version 2.4.3
Reply
(2013-08-29, 04:52:30)artzii Wrote: Appearing later... i have used it about year... yesterday i used and that time its appear...
version 2.4.3

Could it be you moved/copied some normal GS page from data/pages/ to the data/posts/ folder?

If yes:
The xml structure is similar but there are some differences. You probably get the error because NM uses date instead of pubDate. To fix this error, just find that post, edit it and save it. (Or just delete it if you don't want it)
Reply
(2013-08-29, 05:35:55)Carlos Wrote:
(2013-08-29, 04:52:30)artzii Wrote: Appearing later... i have used it about year... yesterday i used and that time its appear...
version 2.4.3

Could it be you moved/copied some normal GS page from data/pages/ to the data/posts/ folder?

If yes:
The xml structure is similar but there are some differences. You probably get the error because NM uses date instead of pubDate. To fix this error, just find that post, edit it and save it. (Or just delete it if you don't want it)

No I haven't Smile
Reply
(2013-08-29, 13:47:34)artzii Wrote:
(2013-08-29, 05:35:55)Carlos Wrote: Could it be you moved/copied some normal GS page from data/pages/ to the data/posts/ folder?

No I haven't Smile

Sorry :-)

In the News Manager main admin panel, do you see any post with a strange date? (like Jan 1, 1970)
Reply
@MaxShy
Thank you for the Windows strftime tip, I'll use it in next NM version.
Reply
(2013-08-29, 16:32:45)Carlos Wrote:
(2013-08-29, 13:47:34)artzii Wrote:
(2013-08-29, 05:35:55)Carlos Wrote: Could it be you moved/copied some normal GS page from data/pages/ to the data/posts/ folder?

No I haven't Smile

Sorry :-)

In the News Manager main admin panel, do you see any post with a strange date? (like Jan 1, 1970)

yes there is one news which datet is Jan 1, 1970
I try to delete it, but it wont delete.
Reply
(2013-08-29, 17:59:12)artzii Wrote: yes there is one news which datet is Jan 1, 1970
I try to delete it, but it wont delete.

Try editing and saving it.
Reply
(2013-08-29, 18:02:50)Carlos Wrote:
(2013-08-29, 17:59:12)artzii Wrote: yes there is one news which datet is Jan 1, 1970
I try to delete it, but it wont delete.

Try editing and saving it.

cant open it... it doesnt have title and i dont find it also in news folder
Reply
(2013-08-29, 20:41:16)artzii Wrote: cant open it... it doesnt have title and i dont find it also in news folder

You may have a ".xml" file (no name, only extension) in your data/posts/ folder.

- Delete it there, then go to the NM main panel and edit and save any other post (to refresh the cache).
- Or if you don't want to lose it, rename to something.xml and then edit it by opening SITE/admin/load.php?id=news_manager&edit=something , fix the date and title and save it.

(By the way, I think the post must have been created with NM 2.2.4 or older - this shouldn't happen with recent releases)
Reply
@Carlos, @D.O. , no problems, thank you for your work!!!
Reply
(2013-08-28, 21:01:56)artzii Wrote: When i add new news I get this error

Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /XXXX/plugins/news_manager/inc/cache.php on line 30

News published still correctly... I havent change any line of that file or earlier its working correctly and no error.

I'm getting this error in the sidebar where I use NM Addons plugin with every new website I'm doing. Maybe just the line is different, I'm not sure.

My solution for it is changing News Manager settings (number of characters in excerpts usually) save, refresh frontend webpage to see the difference, change the setting back and save again and it's gone if I'm right - I've made another site with NM today and this is my approximate procedure. Sometimes I also change the sidebar settings in the code of the sidebar (changing number of posts in the sidebar).

I also always delete my sample articles, but I don't think that it's necessary just to get rid of the error.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
(2013-08-29, 00:55:06)Carlos Wrote: No, it's not hard. It's just I thought that images would mostly be used for post thumbnails in main news page, etc. (as Oleg suggested) but not in single post pages.

I'm changing the way these new options are set, so that it's more customizable, including this. I hope to post a new beta soon.

The posts' thumbnails should definitely be the also the part of the inside. I had a little speech about this with two of my friends (webdesigners) and we agreed on that not showing the thumbnail in an article detail is very unexpectable behaviour. If you want to add a setting for it - why not, it's ok. Maybe there are a few people who might enjoy the feature. It just an opinion of three Czech guys, but I would strongly recommend to set showing it by default.
Just look at this Joomla portal, I did it two months ago - http://www.webzpravodaj.cz/ - there's the K2 used and if you open any of the articles with a thumbnail, you can also see it in the article detail. (Btw, an overwhelming majority of the posts on the homepage is written by me Smile ). But this isn't actually the reason why I came here.

The reason I'm here now is that I want to provide you a new version of the Czech translation for your great plugin. I made it much more user friendly - people can more easily understand what to click on now.

Thanks for including it in the next NM version.

By the way, as I'm trying to write more and more articles (all with thumbnails), I've just found out that Mlvcek's pic.php which is used by NM converts my thumbs into .jpg (= no transparency). It means that when I use a PNG image with transparent background, my image gets a black background which is not very desired. I suppose there's not an easy way to edit the php file to make this better, right? It's GPLv3 anyway. Never mind, still great Smile


Attached Files
.php   cs_CZ.php (Size: 4.73 KB / Downloads: 3)
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
(2013-08-31, 05:15:29)TeeJay Wrote: I'm getting this error in the sidebar where I use NM Addons plugin with every new website I'm doing. Maybe just the line is different, I'm not sure.

Probably a different issue. I would need to know the exact error, or if you cannot reproduce it, tell me your NM Addons sidebar code (PM to me if you wish) and plugin version.
Reply
(2013-08-31, 17:30:29)Carlos Wrote: Probably a different issue. I would need to know the exact error, or if you cannot reproduce it, tell me your NM Addons sidebar code (PM to me if you wish) and plugin version.

I tried to simulate the situation when it happened on a different hosting with no success - worked ok this time. It doesn't matter anyway, I have always solved that easily the way I wrote about in my post before previous.

Just about the error - it was very very similar. It was also something in cache.php about array, but I'm not sure.

I'll give you a notice with details when I happen to get to that situation again Smile Thanks for your concern.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
@MaxShy

Thank to you too!!
My website made with GetSimple CMS is

Arte & Società
www.artesocieta.eu

An indipendent website about Italian Contemporary Visual Arts
Reply
Hi,

NW is really great, but I have 2 problems :/
- I need to show a image in short content, how can I do it?
- How can I change a template when full content is view ? (I use NM on my main site where I have a banner and I dont need it when full news is show) .

Mayby some help?

Thx, rafal
Reply
a image in short content? where? What do u mean?
Should it be inside a piece of new? Or before the news?



(2013-09-02, 19:47:37)Rafal Wrote: Hi,

NW is really great, but I have 2 problems :/
- I need to show a image in short content, how can I do it?
- How can I change a template when full content is view ? (I use NM on my main site where I have a banner and I dont need it when full news is show) .

Mayby some help?

Thx, rafal
My website made with GetSimple CMS is

Arte & Società
www.artesocieta.eu

An indipendent website about Italian Contemporary Visual Arts
Reply
@D.O.
He means in the excerpt / intro text.

@Rafal
You can put an image into the post in the post settings by default. However, you have to use one of the latest beta versions of NM - it's still in beta versions only. Then, you have to include some settings into you gsconfig.php. This is my setting for clients (for my blog, I have a bit bigger pictures)
Code:
# Allowing images for News Manager articles
$NMIMAGEINPUT = true;

# Setting direct visibility of the image upload line when writing an article
// $NMIMAGEINPUT = 0; // or FALSE : not visible
// $NMIMAGEINPUT = 1; // in Options, first field
$NMIMAGEINPUT = 2; // or TRUE : in Options, last field
// $NMIMAGEINPUT = 3; // directly visible above content
// $NMIMAGEINPUT = 4; // directly visible below content

# Setting frontend of the image
$NMIMAGES = array(
'width' => 100,
'height' => 100,
'crop' => 1,         // Cropping the image to fit exactly the dimensions above. IF 0, it scales the image to fit to the width / height
'default' => '',     // Default image to be set if none is chosen -
'alt' => true,       // Alt attribute for the picture
'title' => false,    // Title for the picture
'link' => true,      // Keep <a href=""> in the image
'external' => false, // Display images that are not in the data/upload folder
'show' => true       // Show post images
);

# Adding "Read more" link to all the articles
$NMREADMORE = 'a';

# Removing the link from the post title itself when on a post's detail
$NMTITLENOLINK = 'single';
This piece of code allows "Read more" button and also the images in the post excerpts you are after. The size here is 100x100px. You can change it as you wish.



About the second request - the problem is that the post itself is just a dynamic change on the page you were before clicking onto any of the articles. The classes are the same, there is no difference in the code. So as far as I know, you can't style the article detail (full post) differently than the list of articles (where are usually post excerpts only). However, I'm not absolutely sure about this point.



@others - Am I right about the second point? I would be also really glad if I could style differently a full post's view - the page you get to after clicking onto any of your articles.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
(2013-08-31, 05:38:44)TeeJay Wrote: The posts' thumbnails should definitely be the also the part of the inside.
[...]

Ok, images will be default for all newspages including single post ones.

(2013-08-31, 05:38:44)TeeJay Wrote: The reason I'm here now is that I want to provide you a new version of the Czech translation for your great plugin. I made it much more user friendly - people can more easily understand what to click on now.
Thanks for including it in the next NM version.

Thanks! Included for the next release.

(2013-08-31, 05:38:44)TeeJay Wrote: By the way, as I'm trying to write more and more articles (all with thumbnails), I've just found out that Mlvcek's pic.php which is used by NM converts my thumbs into .jpg (= no transparency). It means that when I use a PNG image with transparent background, my image gets a black background which is not very desired. I suppose there's not an easy way to edit the php file to make this better, right? It's GPLv3 anyway. Never mind, still great Smile

Yes, someone had reported this issue before. I've added this to the to-do list, but leaving it for some future version (or until mvlcek or someone else makes the changes in pic.php ;-))
Reply
(2013-09-02, 19:47:37)Rafal Wrote: - I need to show a image in short content, how can I do it?

TeeJay explained how it works in the latest 2.5 betas.
Note that it's a development version, and the way some of the settings are configured is going to change for the next one (by using components instead of gsconfig)

(2013-09-02, 19:47:37)Rafal Wrote: - How can I change a template when full content is view ? (I use NM on my main site where I have a banner and I dont need it when full news is show) .

You cannot currently select different templates for different views of the news page. There may be a way to do it (with a small custom plugin, or some code in your theme's functions.php), but perhaps this may work for you: somewhere in your template,

Code:
<?php if (!nm_post_title("","",false)): ?>
  *** Your banner goes here ***
<?php endif; ?>

NM 2.5 will have better conditional functions for this kind of stuff (nm_is_single(), ...)
Reply




Users browsing this thread: 4 Guest(s)