Thread Rating:
  • 6 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News Manager (updated)
(2014-06-11, 03:08:50)tapioka Wrote: I do not understand how to make the navigation on the news page: [1] [2] [3] etc

Not currently possible, though it's in the to-do list.
Reply
(2014-06-10, 21:46:55)jeherrin Wrote: The site I'm working on has two basic template files — the main, default template file for the overall site, and a second blog template to deal with and style the blog page. In the interests of making the site responsive and mobile-friendly, my CSS uses media queries to restyle the site depending on the viewer's browsing device.

On the desktop site view, News Manager is set to display full posts, with five posts per page (the client tends to write quite long posts!) but on the mobile view, I'd like it to change to titles and excerpts, rather than showing the full thing. Is there a way to set this in the template rather than in the options? This way, I can use CSS to show/hide content container divs as required — I'll have two content divs, each with the blog, but the second div set to only show excerpts, and set via the CSS to only display on certain screen sizes.

Very interesting.
With News Manager 3.0 ("beta but usable") you can use some of its new functions to do something like this: in your blog template, replace
PHP Code:
<?php get_page_content(); ?>
by
PHP Code:
<?php if (nm_is_main()) { ?>
<div id="desktop_version">
<?php get_page_content(); ?>
</div>
<div id="mobile_version">
<?php nm_set_option('excerpt',1); nm_show_page(intval(@$_GET[NMPARAMPAGE])); ?>
</div>
<?php } else { get_page_content(); } ?>

(change the id's by the ones you like, or classes if you prefer)
Reply
(2014-06-11, 05:20:25)Carlos Wrote:
(2014-06-10, 21:46:55)jeherrin Wrote: The site I'm working on has two basic template files — the main, default template file for the overall site, and a second blog template to deal with and style the blog page. In the interests of making the site responsive and mobile-friendly, my CSS uses media queries to restyle the site depending on the viewer's browsing device.

On the desktop site view, News Manager is set to display full posts, with five posts per page (the client tends to write quite long posts!) but on the mobile view, I'd like it to change to titles and excerpts, rather than showing the full thing. Is there a way to set this in the template rather than in the options? This way, I can use CSS to show/hide content container divs as required — I'll have two content divs, each with the blog, but the second div set to only show excerpts, and set via the CSS to only display on certain screen sizes.

Very interesting.
With News Manager 3.0 ("beta but usable") you can use some of its new functions to do something like this: in your blog template, replace
PHP Code:
<?php get_page_content(); ?>
by
PHP Code:
<?php if (nm_is_main()) { ?>
<div id="desktop_version">
<?php get_page_content(); ?>
</div>
<div id="mobile_version">
<?php nm_set_option('excerpt',1); nm_show_page(intval(@$_GET[NMPARAMPAGE])); ?>
</div>
<?php } else { get_page_content(); } ?>

(change the id's by the ones you like, or classes if you prefer)

Awesome. I'll give this a bash!
Reply
Carlos, it works like a dream. Thanks so much!
Reply
how stable is this for production site ?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
(2014-06-11, 04:14:43)Carlos Wrote:
(2014-06-11, 03:08:50)tapioka Wrote: I do not understand how to make the navigation on the news page: [1] [2] [3] etc

Not currently possible, though it's in the to-do list.

Oh, thank you. We will wait with impatience.
Reply
@jeherrin You're welcome. Nice to know it works for you.

@shawn_a I think it's stable enough. I'll release it to Extend shortly.
Reply
spaces in tags are removed unlike gs page tags.

Is it possible to override the GS $title on article pages so the GS $title is the article title, and skip showing the title in the content ? Seems like it would be useful to not have to create a custom template for news pages, and use any existing gs template.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
(2014-06-17, 01:12:51)shawn_a Wrote: spaces in tags are removed unlike gs page tags.

I suppose you're using NM 2.x
That's the normal behaviour, spaces are not allowed.
In 3.0 that changes, almost any character are allowed.

(2014-06-17, 01:12:51)shawn_a Wrote: Is it possible to override the GS $title on article pages so the GS $title is the article title, and skip showing the title in the content ? Seems like it would be useful to not have to create a custom template for news pages, and use any existing gs template.

I had thought about it, but I'm not sure I like it this way. Maybe I'll add an option for that later.
It's easy to customize with some if instead of several templates.
Reply
Yeah old version ,whoops.

Are you setting global $title and then setting it back?
Cause I am unable to override it myself, so i am assuming it is being set back $data_index somewhere.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
Yes. Doing this to insert the post title in the <title> tag.

Can be disabled with custom setting titleTag 0
Reply
PHP Code:
function nm_restore_page_title() {
  if (!
nm_is_single() || !nm_get_option('titletag',true) || function_exists('nmt_set_gstitle')) {
    return;
  } else {
    global 
$title$data_index;
    
$title $data_index->title;
  }

Needs to restore $title back to $title, not data-index, since anyone can modify it after index-post-dataindex

maybe

PHP Code:
// patch for <title> tag
function nm_update_page_title() {
  if (!
nm_is_single() || !nm_get_option('titletag',true) || function_exists('nmt_set_gstitle')) {
    return;
  } else {
    global 
$title,$nmtitle_old;
    
$nmtitle_old $title;
    
$title nm_post_title('',' - '.$title,false);
  }
}

// restore original title - <title> tag patch
function nm_restore_page_title() {
  if (!
nm_is_single() || !nm_get_option('titletag',true) || function_exists('nmt_set_gstitle')) {
    return;
  } else {
    global 
$title$nmtitle_old$data_index;
    
$title $nmtitle_old;
  }

NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
That's how I was going to do initally, like the NM Title plugin already does, using a temp global...
I'll look into it, thanks.
Reply
I am trying to override the title with the news title for page title also ( just like meta title ), but was unable to. lol I also need to hide the nm title in content, is there a optiontag for that ?
Is there a list of options ?
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
Display post title if in single view, but normal page title if not:
<?php nm_post_title() or get_page_title(); ?>

Hiding title in single post view - custom setting:
single showFields date,author,image,content,tags
(default is title,date,author,image,content,tags)

List of new settings/options in 3.0 (draft):
http://www.cyberiada.org/cnb/news-manager-b/
Reply
Ok that is what i figure, did not know if that was the final doc page ( titleTag you mentioned above is not noted there )
Thanks!
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
@shawn_a
Oh sorry, this was added to latest betas and forgot to add it to the docs I believe.

@tapioka
Next beta will have numbered page navigation.
Reply
fyi my workaround for using nmtitle as page heading
PHP Code:
<?php
# hook_theme-header
GLOBAL $id,$title,$data_index,$NMPAGEURL;
if(
$id == $NMPAGEURL)$data_index->title $title nm_post_title('','',false);
?>

I could add a check i guess to make sure this is necessary and that the nm title override already ran, but in my case its always executed before my hook.


also collecting info here for core enhancements related to titles and stuff
https://github.com/GetSimpleCMS/GetSimpleCMS/issues/831
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
News Manager 3.0 beta 23 - Download / Info

Changes (since beta 22):
  • completed Danish translation (thanks @chrsand)
  • pagination starts at 1 instead of 0 (so the second page (URL) is 2 instead of 1, etc.)
  • numbered + prev/next navigation (as default - older/newer now optional) (@tapioka)
  • new strings in language files for prev/next links (texts and link titles)
  • several slight changes

Pagination index (page= or page/ in URL) starts now at 1 instead of 0 by default.
This can be changed back to the old way with a new custom setting:
Code:
define('NMFIRSTPAGE',0);

If you don't want the new prev/next numbered navigation and prefer the classic Older/Newer links, use this new custom setting:
Code:
navOldNew 1

If you want the prev/next links but don't want the numbers between them, use this custom setting:
Code:
navNumber 0

If for any reason you need to disable the navigation,
Code:
showNav 0

These are the new language strings (can be redefined in Custom settings or in gsconfig with $nm_i18n[...]):
Code:
PREV_TEXT &lt;
PREV_LINK "Previous page"
NEXT_TEXT &gt;
NEXT_LINK "Next page"
(default English values shown)

Opinions and feedback is very welcome.

Unless there's some issue, this should be another release candidate. :-)
Reply
Seems very nice. Next week I'm going to go through all the updates since beta 18 and become up-to-date again Smile

I just want to ask as I can't try it right now - when you are browsing through pages 1, 2, 3... does the current page number link have a class="current" attribute or something like that?

Anyway, great work again, thanks for that.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
Oh sorry, I forgot to comment about styling the navigation. Yes, it's class="current"
It's done very like in I18N Search's navigation:

Previous page: <span class="previous"><a href="...
Number links: <span><a href="...
Current number: <span class="current">...
Next page: <span class="next"><a href="...

(inside a <div class="nm_page_nav">, like with Older/Newer nav)
Reply
great plugin <span class="current"> http://www.without-db.ru/demo/000/news/page/2
Reply
I can see on Oleg's site now.
The only thing that could be better about it is to actually show the prev/next page "<" and ">" symbols even though there isn't any next page. Just give it a special class like "disabled" so people can style it into a grey colour or simply hide it with display: none. Or, maybe, there could be an extra settings that would allow/disallow this feature.
Tomáš Janeček - Multilingual personal website powered by GetSimple
» The little I did for GetSimple
Reply
@Oleg06 Thanks for testing, as always.

@TeeJay I'll add a setting to enable showing always prev/next (I don't like that as default)
Reply
I just added support for a new custom setting navPrevNext to the development version:

navPrevNext 0 to disable Previous/Next page links (numbered navigation only)

navPrevNext a (or "navPrevNext always") to make both always visible, even in first and last page (with class "disabled" and no link)

If anyone wants to test this, overwrite beta 23's inc/site.php file with:
https://raw.githubusercontent.com/cnb/Ne...c/site.php
Reply




Users browsing this thread: 20 Guest(s)