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 8324709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:10:17+00:00 2026-06-09T00:10:17+00:00

I have several calls to a getContent() function with arguments that are pulled into

  • 0

I have several calls to a getContent() function with arguments that are pulled into the function using func_get_args(). Several of the arguments stay the same, and I would like to set them as a variable to prevent having to duplicate the repeated arguments throughout all of these function calls.

Here is an example of the function call with the full arguments:

<? getContent(
    "article",
    "display:list",
    "find_series:team",
    "find_category:pastors-team",
    "order:series",
    "find_parent_category:team",
    "show:<div class='box box_stories'>",
    "show:<div class='box_pad box_img bwWrapper'>",
    "show:<div class='box_inner_pad'>",
    "show:<h3><a href='/staff-detail/__slug__'>__authorX__</a></h3>",
    "show:<p class='teamsummary'>__summary__</p>",
    "show:<p class='phone_icon'>__authorXworkphone__</p>",
    "show:</div>",
    "show:</div>",
    "show:</div>"
); 
?>

Ideally, I would be able to do something like this:

<? $myStyle = 
    "show:<div class='box box_stories'>",
    "show:<div class='box_pad box_img bwWrapper'>",
    "show:<div class='box_inner_pad'>",
    "show:<h3><a href='/staff-detail/__slug__'>__authorX__</a></h3>",
    "show:<p class='teamsummary'>__summary__</p>",
    "show:<p class='phone_icon'>__authorXworkphone__</p>",
    "show:</div>",
    "show:</div>",
    "show:</div>";

getContent(
    "article",
    "display:list",
    "find_series:team",
    "find_category:leadership-team",
    "order:series",
    "find_parent_category:team",
    $myStyle
);

getContent(
    "article",
    "display:list",
    "find_series:team",
    "find_category:executive-team",
    "order:series",
    "find_parent_category:team",
    $myStyle
); ?>

Is this possible? What is the best way to approach this?

Note: I cannot change the getContent() function, it’s a core function of the CMS

  • 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-09T00:10:19+00:00Added an answer on June 9, 2026 at 12:10 am

    This is the simplest one i can think of:

    call_user_func_array('getContent',array_merge(array(
        "article",
        "display:list",
        "find_series:team",
        "find_category:executive-team",
        "order:series",
        "find_parent_category:team",
        ),$myStyle)
    );
    

    Edit: Yazmat’s solution will probably be better.
    You can use it with a variable number of arguments like this:

    <?php
    function myGetContent() {
        $defaults = array(
            "show:<div class='box box_stories'>",
            "show:<div class='box_pad box_img bwWrapper'>",
            "show:<div class='box_inner_pad'>",
            "show:<h3><a href='/staff-detail/__slug__'>__authorX__</a></h3>",
            "show:<p class='teamsummary'>__summary__</p>",
            "show:<p class='phone_icon'>__authorXworkphone__</p>",
            "show:</div>",
            "show:</div>",
            "show:</div>"
        );
        return call_user_func_array('getContent',array_merge(func_get_args(), $defaults));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several jQuery .ajax calls on the same page like: $.ajax({ url: page1.php,
I have several expressions I have generated in Mathematica that I would like to
I have an application that uses several different Java classes and would like to
I have several popovers (on a tags) that make ajax calls to populate their
I have a query that makes several calls within a SELECT statement to a
I have several layers of function calls, passing around a common dictionary of key
Let say, I have a MulticastDelegate that implements generic delegate and contains several calls:
I have a legacy function that looks like this: int Random() const { return
I have a several tables nested within a table that I am parsing using
I have several modules (mainly C) that need to be redesigned (using C++). Currently,

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.