Skip to content
Snippets Groups Projects
function.articlesummary.php 464 B
Newer Older
  • Learn to ignore specific revisions
  • Imran Hussain's avatar
    Imran Hussain committed
    function smarty_function_articlesummary($params, &$smarty)
    {
    
    Imran Hussain's avatar
    Imran Hussain committed
        $article = $params['article'];
        $id = $params['id'];
        $title = rawurlencode($params['title']);
    
    Imran Hussain's avatar
    Imran Hussain committed
        $linky = "<span style=\"float: right\"><a href=\"/News/" . rawurlencode($title) . "\">Read More</a></span>";
    
        $matches = array();
        preg_match("/^(<p>.*?<\/p>)/s", $article, $matches);
        $summary = preg_replace("/<\/p>/", "$linky</p>", $matches[0]);
        return $summary;
    }