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

  • SEARCH
  • Home
  • 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 8750259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:50:06+00:00 2026-06-13T12:50:06+00:00

How would I extend the $insert so that I can pass multiple parameters into

  • 0

How would I extend the $insert so that I can pass multiple parameters into the function e.g
{"Sample text %s this more %s."|inject:$foo:$foo2}.

At the moment it only works with 1 param.

/**
 * Smarty inject modifier plugin
 *
 * Type:     modifier<br>
 * Name:     inject<br>
 * Purpose:  sprintf with a IF empty wrapper
 *
 */
function smarty_modifier_inject($string, $insert)
{
    if(!empty($insert))
        return sprintf($string, $insert);
}
  • 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-13T12:50:07+00:00Added an answer on June 13, 2026 at 12:50 pm

    you have to modify inject function to take arbitrary number of arguments, like this:

    function inject(){
        $args = func_get_args();
        if(count($args) > 1){
            return call_user_func_array('sprintf', $args);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Would be possible to extend this kind of layout so that I can have
I would like to extend a liferay core jsp by custom-jsp hook. In this
To extend RavenDB's capabilities I would like to install the bundles that are available
We would like to get a hold of all the parameters that hibernate binds
Are there any pre-existing solutions out there which would extend the built in SQL
How would one extend the Paginator class in django.core.paginator to work with Google App
I would like to extend the team explorer work item editor with a custom
I would like to extend a kd-tree (2D) class to be able to remove
For a project of mine I would like to extend twitter bootstrap modal window
I would like to create extend a Java Swing application to have a look

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.