Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7712337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:36:19+00:00 2026-06-01T01:36:19+00:00

I need a rewrite in how the modifier ‘truncate’ is called, because it is

  • 0

I need a rewrite in how the modifier ‘truncate’ is called, because it is causing an error.
_getfilepath does not exist in version 3

$this->_engine = new Smarty();
$this->_engine->template_dir = $config->paths->templates;
$this->_engine->compile_dir = sprintf('%s/tmp/templates_c',
                                      $config->paths->data);

 $this->_engine->plugins_dir = array($config->paths->base .
                           '/woonbel/include/Templater/plugins','plugins');



function smarty_function_breadcrumbs($params, $smarty)
{
    $defaultParams = array('trail'     => array(),
                           'separator' => ' > ',
                           'truncate'  => 40);

    // initialize the parameters
    foreach ($defaultParams as $k => $v) {
        if (!isset($params[$k]))
            $params[$k] = $v;
    }

    // load the truncate modifier
    if ($params['truncate'] > 0)

require_once $smarty->getPluginsDir(‘modifier’, ‘truncate’);

 $links = array();
        $numSteps = count($params['trail']);
        for ($i = 0; $i < $numSteps; $i++) {
            $step = $params['trail'][$i];

            // truncate the title if required
            if ($params['truncate'] > 0)
                $step['title'] = smarty_modifier_truncate($step['title'],
                                                          $params['truncate']);

            // build the link if it's set and isn't the last step
            if (strlen($step['link']) > 0 && $i < $numSteps - 1) {
                $links[] = sprintf('<a href="%s" title="%s">%s</a>',
                                   htmlSpecialChars($step['link']),
                                   htmlSpecialChars($step['title']),
                                   htmlSpecialChars($step['title']));
            }
            else {
                // either the link isn't set, or it's the last step
                $links[] = htmlSpecialChars($step['title']);
            }
        }

        // join the links using the specified separator
        return join($params['separator'], $links);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:36:20+00:00Added an answer on June 1, 2026 at 1:36 am

    you are looking for the (not publicly documented) loadPlugin() function:

    $smarty->loadPlugin('smarty_modifier_truncate', true);
    $string = smarty_modifier_truncate($string);
    

    Update test case:

    <?php
    error_reporting(E_ALL);
    require_once 'path-to/Smarty.class.php';
    
    $smarty = new Smarty();
    $smarty->loadPlugin('smarty_modifier_truncate', true);
    $string = 'hello world I should be truncated to some smaller string';
    $string = smarty_modifier_truncate($string, 10);
    var_dump($string);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to rewrite this query and I'm not allowed to use a subquery.
Here is a simplified version of the code I use. I need to rewrite
I know they do not hold across pattern matches (i.e. you need to rewrite
I need rewrite this url http://adresa.com/article.php?act=view&id=1113 to http://adresa.com/view/1113 I make it with mod_rewrite in
I need to rewrite some Perl code in python. So I'm looking for the
i have a mixed aspx/MVC webapp project and need to rewrite incoming URL's either
I need some help on mod rewrite 301 , to redirect my old website
i'm trying to use iirf for what looks like asimple rewrite but it's not
i need to rewrite urls for my classified ads directory i have 4 types
I need a rewrite rule for this url http://localhost/~user/frame/lib/index.php?/controller/method/12/22/ How can i rewrite it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.