Thread Rating:
  • 4 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager (updated)
(2013-09-19, 03:15:26)TeeJay Wrote:
(2013-09-19, 02:49:58)manubz Wrote: That's all. Thanks for your great help guyz !

Just a last question, I do not remember if I have even do it. Would you know how to integrate news provided by news manager in sitemap.xml for google and others search engine indexation ?

See you.

I guess I haven't helped you much but still you're welcome.

I would also be very interested in the second point. As for now - I'm adding every post I write into the Google index via my account in the developer tools. If you don't have an account for your website, you can add your site (or concrete page) to the Google index using the form in this link.

I already have an account like you. But as you say, manually index is not a usefull solution.
I do not write messages every days but manually index articles will be boring
Reply
Glad you found the solution, man!
As I said it was "url.rewrite-once" and not "url.rewrite". I just gave a little help to you, that's all.

About the last thing you asked, Google indexes the news of my site automatically without them being present in the site map. I'm webmastering a professional site (made with GS) and I am getting excellent results!
Reply
(2013-09-19, 03:41:15)D.O. Wrote: Glad you found the solution, man!
As I said it was "url.rewrite-once" and not "url.rewrite". I just gave a little help to you, that's all.

About the last thing you asked, Google indexes the news of my site automatically without them being present in the site map. I'm webmastering a professional site (made with GS) and I am getting excellent results!

Nice to read it, I will see for future. I keep this thread in my favorites, I will probably spent some times here now Smile
Reply
Thumbs Up 
Wink Then Read You Soon!
Reply
NM does insert news posts in the Sitemap, but only if you still use GS 3.0 :-)
Since GS 3.1 sitemap hooks cannot be used by plugins like NM to insert their dynamic/non-page items in the Sitemap.
No easy way to fix this right now (mvlcek uses a clever workaround in his I18N plugin, but it's still not perfect)

Related threads:
http://get-simple.info/forums/showthread.php?tid=3056
http://get-simple.info/forums/showthread.php?tid=2624
Open issue: https://github.com/GetSimpleCMS/GetSimpleCMS/issues/363

I may create a simple plugin to generate an alternative Sitemap that includes NM posts, until this is fixed (when I have the time)

In the meantime, you can try patching GS as I suggested and manubz found, but in NM versions 2.2.6 or later you must also edit news_manager.php and change this:
Code:
if (!function_exists('generate_sitemap')) { // exclude GetSimple 3.1+
  add_action('sitemap-additem', 'nm_sitemap_include');
}
by this:
Code:
add_action('sitemap-additem', 'nm_sitemap_include');
Reply
bro you are a DEUS EX MACHINA lol
Reply
(2013-09-19, 04:56:17)Carlos Wrote: NM does insert news posts in the Sitemap, but only if you still use GS 3.0 :-)
Since GS 3.1 sitemap hooks cannot be used by plugins like NM to insert their dynamic/non-page items in the Sitemap.
No easy way to fix this right now (mvlcek uses a clever workaround in his I18N plugin, but it's still not perfect)

Related threads:
http://get-simple.info/forums/showthread.php?tid=3056
http://get-simple.info/forums/showthread.php?tid=2624
Open issue: https://github.com/GetSimpleCMS/GetSimpleCMS/issues/363

I may create a simple plugin to generate an alternative Sitemap that includes NM posts, until this is fixed (when I have the time)

In the meantime, you can try patching GS as I suggested and manubz found, but in NM versions 2.2.6 or later you must also edit news_manager.php and change this:
Code:
if (!function_exists('generate_sitemap')) { // exclude GetSimple 3.1+
  add_action('sitemap-additem', 'nm_sitemap_include');
}
by this:
Code:
add_action('sitemap-additem', 'nm_sitemap_include');

Hi Carlos,

I tried your suggest like that, here is my generate_stemap function
Code:
function generate_sitemap() {

        if(getDef('GSNOSITEMAP',true)) return;

        // Variable settings
        global $SITEURL;
        [b][color=#FF0000]global $xml, $page;[/color][/b]
        $path = GSDATAPAGESPATH;
        $count="0";

        $filenames = getFiles($path);

        if (count($filenames) != 0)     {
                foreach ($filenames as $file)   {
                        if ( isFile($file, $path, 'xml')) {
                                $data = getXML($path . $file);
                                if ($data->url != '404') {
                                        $status = $data->menuStatus;
                                        $pagesArray[$count]['url'] = $data->url;
                                        $pagesArray[$count]['parent'] = $data->parent;
                                        $pagesArray[$count]['date'] = $data->pubDate;
                                        $pagesArray[$count]['private'] = $data->private;
                                        $pagesArray[$count]['menuStatus'] = $data->menuStatus;
                                        $count++;
                                }
                        }
                }
        }

And here is my news_manager.php : # hooks
Code:
# hooks
add_action('pages-sidebar', 'createSideMenu', array($thisfile, i18n_r('news_manager/PLUGIN_NAME')));
add_action('header', 'nm_header_include');
add_action('index-pretemplate', 'nm_frontend_init');
//add_filter('content', 'nm_site'); // deprecated
#if (!function_exists('generate_sitemap')) { // exclude GetSimple 3.1+
add_action('sitemap-additem', 'nm_sitemap_include');
#}
add_action('plugin-hook', 'nm_patch_plugin_management');

Am I false ?

Cheers.
Reply
@manubz
Your generate_sitemap function seems to be incomplete. Had you already patched it?
I suggest you do the patch on the original template_functions.php file.



About these patches, I forgot to say that:
- You must have GSDONOTPING disabled (commented out with #, or set to 0 or false) if you want to send the Sitemap to google.
- The Sitemap will not be generated/submitted automatically when you save a post -- you must update some normal page or re-save your GS settings for that.

PS Note that patching the core or plugins is generally not recommended.
Reply
A question I ask myself is this:
Why the new versions of GS, do not consider the compatibility with popular plugins as NM?
Reply
(2013-09-19, 07:35:38)Carlos Wrote: @manubz
Your generate_sitemap function seems to be incomplete. Had you already patched it?
I suggest you do the patch on the original template_functions.php file.



About these patches, I forgot to say that:
- You must have GSDONOTPING disabled (commented out with #, or set to 0 or false) if you want to send the Sitemap to google.
- The Sitemap will not be generated/submitted automatically when you save a post -- you must update some normal page or re-save your GS settings for that.

PS Note that patching the core or plugins is generally not recommended.

Hi,

Exactly, I did not post all the generate_sitemap function, I just had where I add global $xml, $page;

Here is all the generate_sitemap function
Code:
function generate_sitemap() {

        if(getDef('GSNOSITEMAP',true)) return;

        // Variable settings
        global $SITEURL;
        global $xml, $page;
        $path = GSDATAPAGESPATH;
        $count="0";

        $filenames = getFiles($path);

        if (count($filenames) != 0)     {
                foreach ($filenames as $file)   {
                        if ( isFile($file, $path, 'xml')) {
                                $data = getXML($path . $file);
                                if ($data->url != '404') {
                                        $status = $data->menuStatus;
                                        $pagesArray[$count]['url'] = $data->url;
                                        $pagesArray[$count]['parent'] = $data->parent;
                                        $pagesArray[$count]['date'] = $data->pubDate;
                                        $pagesArray[$count]['private'] = $data->private;
                                        $pagesArray[$count]['menuStatus'] = $data->menuStatus;
                                        $count++;
                                }
                        }
                }
        }

        $pagesSorted = subval_sort($pagesArray,'menuStatus');

        if (count($pagesSorted) != 0)
        {
                $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset></urlset>');
                $xml->addAttribute('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd'$
                $xml->addAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');

                foreach ($pagesSorted as $page)
                {
                        if ($page['private'] != 'Y')
                        {
                                // set <loc>
                                $pageLoc = find_url($page['url'], $page['parent']);

                                // set <lastmod>
                                $tmpDate = date("Y-m-d H:i:s", strtotime($page['date']));
                                $pageLastMod = makeIso8601TimeStamp($tmpDate);

                                // set <changefreq>
                                $pageChangeFreq = 'weekly';
                                // set <priority>
                                if ($page['menuStatus'] == 'Y') {
                                        $pagePriority = '1.0';
                                } else {
                                        $pagePriority = '0.5';
                                }

                                //add to sitemap
                                $url_item = $xml->addChild('url');
                                $url_item->addChild('loc', $pageLoc);
                                $url_item->addChild('lastmod', $pageLastMod);
                                $url_item->addChild('changefreq', $pageChangeFreq);
                                $url_item->addChild('priority', $pagePriority);
                                exec_action('sitemap-additem');
                        }
                }

                //create xml file
                $file = GSROOTPATH .'sitemap.xml';
                exec_action('save-sitemap');
                XMLsave($xml, $file);
        }

        if (!defined('GSDONOTPING')) {
                if (file_exists(GSROOTPATH .'sitemap.xml')){
                        if( 200 === ($status=pingGoogleSitemaps($SITEURL.'sitemap.xml')))       {
                                #sitemap successfully created & pinged
                                return true;
                        } else {
                                error_log(i18n_r('SITEMAP_ERRORPING'));
                                return i18n_r('SITEMAP_ERRORPING');
                        }
                } else {
                        error_log(i18n_r('SITEMAP_ERROR'));
                        return i18n_r('SITEMAP_ERROR');
                }
        } else {
                #sitemap successfully created - did not ping
                return true;
        }
}

Cheers
Reply
(2013-09-19, 15:46:43)D.O. Wrote: A question I ask myself is this:
Why the new versions of GS, do not consider the compatibility with popular plugins as NM?

Partly my fault, as I had forget about the issue and didn't insist on this.

I know for sure that Shawn (currently the only GS developer) is doing his best to support backwards compatibility with plugins.
Reply
(2013-09-11, 23:58:17)TeeJay Wrote: I have to admit that the current way of settings is a little a bit more difficult than the one in GSConfig. It's not difficult at all, but I guess there are still some people that want to install and be ready to use without any settings. Without any settings, the NM is hardly half as good as it is with them (pictures, read more...)
What I personally don't like the most is that some settings have to be set in the administration, some in the gsconfig.php ($NMIMAGEINPUT = true; $NMIMAGEINPUT = 2Wink and some in components.
It would be awesome if everything could be set in the administration by clicks only, but I understand that it's a bit more difficult as some settings are conditional. Some settings like "Allow post images", "Allow links in post images", "Automatically add alt attribute to post images", "Auto resizing and cropping post images", "Post images default dimensions" would be possible, though.

I wanted to build all these new functionalities in some flexible way that allows customizing for many different setups.

I intended to add some new options to NM's settings page in some future version (maybe for 2.6), but I'm doing it for 2.5. I'll post a new beta shortly.

Thanks for your comments, and sorry for the late reply.
Reply
(2013-09-07, 01:04:57)D.O. Wrote:
(2013-09-07, 00:58:34)Carlos Wrote: One question: if I added optional support for authors, would it be fine to display it like this?
Code:
<p class="nm_post_date">Posted on Sep 6, 2013</p><p class="nm_post_author">Author: username</p>
or do you suggest another way?
(The "Author: " string would be customizable, e.g. changed to " by: ")

About the line I could suggest this way:

<p class="nm_post_date">Posted on Sep 6, 2013 <span class="nm_post_author">by Username</span></p>

And yes, of course, the string "Author" (or "by") should be customizable, and on th same line of the post date.

I honestly don't like inserting a field tag inside another field tag.

Ideally you would do this by customizing the post layout (I have in mind, but for the future).

Would it be too difficult to style both <p> tags so that they're shown in the same line?
Reply
It won't be a problem so I will add a css trick to show date and author on the same line
Reply
(2013-09-21, 17:49:43)Carlos Wrote:
(2013-09-11, 23:58:17)TeeJay Wrote: I have to admit that the current way of settings is a little a bit more difficult than the one in GSConfig. It's not difficult at all, but I guess there are still some people that want to install and be ready to use without any settings. Without any settings, the NM is hardly half as good as it is with them (pictures, read more...)
What I personally don't like the most is that some settings have to be set in the administration, some in the gsconfig.php ($NMIMAGEINPUT = true; $NMIMAGEINPUT = 2Wink and some in components.
It would be awesome if everything could be set in the administration by clicks only, but I understand that it's a bit more difficult as some settings are conditional. Some settings like "Allow post images", "Allow links in post images", "Automatically add alt attribute to post images", "Auto resizing and cropping post images", "Post images default dimensions" would be possible, though.

I wanted to build all these new functionalities in some flexible way that allows customizing for many different setups.

I intended to add some new options to NM's settings page in some future version (maybe for 2.6), but I'm doing it for 2.5. I'll post a new beta shortly.

Thanks for your comments, and sorry for the late reply.

Thank you, that sounds good Smile



(2013-09-21, 18:20:52)Carlos Wrote:
(2013-09-07, 01:04:57)D.O. Wrote:
(2013-09-07, 00:58:34)Carlos Wrote: One question: if I added optional support for authors, would it be fine to display it like this?
Code:
<p class="nm_post_date">Posted on Sep 6, 2013</p><p class="nm_post_author">Author: username</p>
or do you suggest another way?
(The "Author: " string would be customizable, e.g. changed to " by: ")

About the line I could suggest this way:

<p class="nm_post_date">Posted on Sep 6, 2013 <span class="nm_post_author">by Username</span></p>

And yes, of course, the string "Author" (or "by") should be customizable, and on th same line of the post date.

I honestly don't like inserting a field tag inside another field tag.

Ideally you would do this by customizing the post layout (I have in mind, but for the future).

Would it be too difficult to style both <p> tags so that they're shown in the same line?

The way you suggest is the ideal way in my opinion - the name itself isn't a paragraph, so semantically it doesn't belong into the <p> tag. Having it all in one paragraph and wrapping into span for different styles is much better.

But if you ask, it's not difficult to style both paragraphs to be shown in the same line.
Basically, you wrap both of them into a div and you let both of them float. If you want them next to each other, you keep float:left on both of them. Then you can use margin/padding for doing some spaces.
You can also put float:left to the one on the left, float:right to the other one and then set width to the wrapping div so they will be close enough.
In both cases, you should not forget about an empty div behind the second paragraph with clear:both style.

So it's like this:
Code:
<div class="wrapper">
<p class="nm_post_date"></p>
<p class="nm_post_author"></p>
<div class="clear"></div>
</div>

.nm_post_date { float:left; }
.nm_post_author { float:right; }
.clear { clear:both; }

Anyway, I wouldn't recommend doing it this way.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
Hi Carlos,
then here is the CSS solution for showing date and author on the same line:

PHP Code:
.nm_post_date, .nm_post_author display:inline; }
.
nm_post_content display:block; }

<
class="nm_post_date">Posted on Sep 62013</p>
<
class="nm_post_author">Authorusername</p>
<
div class="nm_post_content"><p>Post content</p></div

Simple and neat!!!
Btw, I look forward the author support will be ready!
Reply
I don't understand the sitemap issue, search engines still index your site regardless of your sitemap, provided you have links to the pages some where. Just stick a archive link or something.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
Hold on Shawn,
I am gonna reply ya in the right space..
Reply
Yeah i just realized i answered an old post on a previous page. oops.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
News Manager 2.5 beta 12 attached to this post.

Changes since beta 11:
- New options in backend settings for images, readmore, title links, etc. (@TeeJay, @Oleg06, ...)
- Removed support for gsconfig variable $NMARCHIVESBY (it's now in settings)
- Post images disabled by default (though you can enable them in settings)
- $NMIMAGEINPUT in gsconfig only needed if you want to change the default input position
- New gsconfig setting to force converting tags to lowercase (@Connie)
Code:
$NMLOWERCASETAGS = true;
(temporary - I may change it to define instead of global var)

I'll try to prepare some decent docs... in the meantime, ask anything you need to know.

Before I ask for language translations, please tell me if you think that the English captions I've added to the settings are adequate, what you would change... My English isn't as good as I'd like.

Remember it's a beta. Please report any bugs you find. Feedback much appreciated.

[attachment removed: news_manager-2.5-beta12.zip (Downloads: 12)
Reply
(2013-09-22, 00:14:31)shawn_a Wrote: I don't understand the sitemap issue, search engines still index your site regardless of your sitemap, provided you have links to the pages some where. Just stick a archive link or something.

Yes, they do if there are some links leading to those pages.

But what's the point of sitemap if there isn't everything?
It should server for
1) users to get oriented easily
2) site owner to get internal backlinks without linking through the articles
3) search engines to index your site more easily

Yes, the page gets indexed anyway but generally it's recommended to use sitemap - it has some benefits for your site in general. And if you want to use it, it should include all pages you want to be included. I would be glad if my NM post were included and they're not.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
I forgot... these are the new strings:

Code:
"ARCHIVES_BY"         =>  "Archives by",
"MONTH"               =>  "Month",
"YEAR"                =>  "Year",
"READ_MORE_LINK"      =>  "\"Read more\" link after excerpt",
"ALWAYS"              =>  "Always",
"NOT_SINGLE"          =>  "Except for single posts",
"GO_BACK_LINK"        =>  "\"Go back\" link under single post",
"TITLE_LINK"          =>  "Link to post in title",
"BROWSER_BACK"        =>  "Previously visited page",
"MAIN_NEWS_PAGE"      =>  "Main News Page",
"POST_IMAGES"         =>  "Post images",
"IMAGE_LINKS"         =>  "Link images to posts",
"IMAGE_WIDTH"         =>  "Post image width (pixels)",
"IMAGE_HEIGHT"        =>  "Post image height (pixels)",
"IMAGE_CROP"          =>  "Crop post images to fit dimensions",
"IMAGE_ALT"           =>  "Insert post title in post image <em>alt</em> attribute",
Reply
@TeeJay

To list all your NM posts somewhere in your template you could do like this:
PHP Code:
<?php
global $NMRECENTPOSTS;
$tmprecent $NMRECENTPOSTS;
$NMRECENTPOSTS 99999;
nm_list_recent();
$NMRECENTPOSTS $tmprecent;
?>

that is, if you want to include this in a site map, not in the Sitemap (sitemap.xml)...
Reply
NM is gonna be a superplugin Wink
Reply
(2013-09-22, 00:35:49)Carlos Wrote: Changes since beta 11:
- New options in backend settings for images, readmore, title links, etc. (@TeeJay, @Oleg06, ...)
- Removed support for gsconfig variable $NMARCHIVESBY (it's now in settings)
- Post images disabled by default (though you can enable them in settings)
- $NMIMAGEINPUT in gsconfig only needed if you want to change the default input position
- New gsconfig setting to force converting tags to lowercase (@Connie)
Code:
$NMLOWERCASETAGS = true;
(temporary - I may change it to define instead of global var)

I'll try to prepare some decent docs... in the meantime, ask anything you need to know.

This is great Smile I could totally leave out all the gsconfig.php and components setting, I set everything in the NM settings and it works great as desired.

(2013-09-22, 00:35:49)Carlos Wrote: Before I ask for language translations, please tell me if you think that the English captions I've added to the settings are adequate, what you would change... My English isn't as good as I'd like.

Remember it's a beta. Please report any bugs you find. Feedback much appreciated.

I forgot... these are the new strings: ...

I had little troubles comprehending all the settings at the first look and I think that if I haven't worked with NM before, I would have much more troubles. Furthermore, there are no articles used. I'm also not a native English speaker, but I think I can contribute a little.

So this is my suggestion:

Code:
"ARCHIVES_BY"         =>  "Archives by",
"MONTH"               =>  "Month",
"YEAR"                =>  "Year",
"READ_MORE_LINK"      =>  "Show \"Read more\" link below posts' excerpts",
"ALWAYS"              =>  "Always",
"NOT_SINGLE"          =>  "Except for a single post view",
"GO_BACK_LINK"        =>  "\"Go back\" link in a single post view",
"TITLE_LINK"          =>  "Links to posts in their titles",
"BROWSER_BACK"        =>  "Previously visited page",
"MAIN_NEWS_PAGE"      =>  "Main News Page",
"POST_IMAGES"         =>  "Allow posts' images",
"IMAGE_LINKS"         =>  "Links to posts in the posts' images",
"IMAGE_WIDTH"         =>  "Post images' width (pixels)",
"IMAGE_HEIGHT"        =>  "Post images' height (pixels)",
"IMAGE_CROP"          =>  "Crop post images to fit the dimensions above",
"IMAGE_ALT"           =>  "Insert a post's title into the post's image <em>alt</em> attribute",

I think this is better and more correct, but use what you and others want to. I'm just trying to be clearer and to be grammatically correct (though it still may not be without any mistakes).

I also want to ask you if you could include the dimensions filled in in the back-end to the "width" and "height" attributes of posts' images- it would be perfect. Smile

(2013-09-22, 01:07:28)Carlos Wrote: @TeeJay

To list all your NM posts somewhere in your template you could do like this:
PHP Code:
<?php
global $NMRECENTPOSTS;
$tmprecent $NMRECENTPOSTS;
$NMRECENTPOSTS 99999;
nm_list_recent();
$NMRECENTPOSTS $tmprecent;
?>

that is, if you want to include this in a site map, not in the Sitemap (sitemap.xml)...

Thanks for this. However, I would need to insert this into the middle of the sitemap unordered list which wouldn't be easy at all. I use I18N's sitemap and I don't understand how is it generated, so I won't do anything about it so far. But still, it's great to know this. I might send this piece of code to Mvlcek for the sitemap... Smile
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply




Users browsing this thread: 2 Guest(s)