Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
News manager
#76
seems solid and simple enough,
I added a truncate/except function - it's rough, but fits my immediate needs, might be helpful for someone else

function the_NM_excerpt() {
global $nm;
echo truncate($nm->the_NM_content(), 125,'...');
}

function truncate ($str, $length=10, $trailing='...')
{
$length-=mb_strlen($trailing);
if (mb_strlen($str)> $length)
{
// string exceeded length, truncate and add trailing dots
return mb_substr($str,0,$length).$trailing;
}
else
{
$res = $str;
}
return $res;
}
Reply
#77
Howdy;

Before I invest the time to write one myself (and possibly it already exists and I'm missing it) Is there a way to generate a permalink for a specific news item - I see that the create function accepts '$id,$date, $title, $event' and I'll assume the ids are unique - but I don't see a function to return that unique id to the front end, whereas we could concatenate a permalink (domain.com/news/unique-id)

Thoughts?
Reply
#78
Great Plugin Thanks!
Reply
#79
Hi all. Does anyone know how I can get excerpt of the most recent story or the title of all news articles and place either of these in a component. That has been my only issue with News Manager. Thanks
Reply
#80
sauldraws Wrote:seems solid and simple enough,
I added a truncate/except function - it's rough, but fits my immediate needs, might be helpful for someone else

function the_NM_excerpt() {
global $nm;
echo truncate($nm->the_NM_content(), 125,'...');
}

function truncate ($str, $length=10, $trailing='...')
{
$length-=mb_strlen($trailing);
if (mb_strlen($str)> $length)
{
// string exceeded length, truncate and add trailing dots
return mb_substr($str,0,$length).$trailing;
}
else
{
$res = $str;
}
return $res;
}

I think I would love this, but how do I use it? I tried inserting it into the new manager.php file, but it didn't work when I called the function in a component. I would really love to know how to use this in a component. Thanks
Reply
#81
For Version: 1.2

Hi there.. just want to post I added one line in code.. above
line 42 just after

Code:
function gestione_css()

I added this line

Code:
global $thisfile;

hope it helps
Stopped developing on GS Plugins. Anybody welcome to take the projects over. Thanks for all the support all.
Reply
#82
Hello!

I want to add a read more button.

I can create function to edit and save short and full text but i cant make the more button (link) to show the full article

Code:
function show_articles($n) {
  $articles = get_articles();
  if (isset($n) && $n > 0) {
    $index = (isset($_GET['page'])) ? $_GET['page'] : 0;
    $pages = array_chunk($articles, $n);
    $articles = $pages[$index];
  }
  foreach ($articles as $article) {
    $id = basename($article, ".xml");
    show_single($id);
    
?>
   <a href="WHAT TO PUT HERE?">more</a>
    <?php
    
  }
  if (isset($n))
    show_navigation($index, sizeof($pages));
}

I dont know what to put as link.
Reply
#83
Hello,
When I disabled the plugin, the news is always show on my page.

An improvement idea :
Control the plugin status. And don' show the news when it disabled.

Thanks.
Reply
#84
What should I do to the latest news appeared first? How do I change the order the withdrawal of news? Thank you.
Reply




Users browsing this thread: 1 Guest(s)