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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T07:48:25+00:00 2026-05-15T07:48:25+00:00

If the title hasn’t scared you away yet, read on. I’m working on an

  • 0

If the title hasn’t scared you away yet, read on. I’m working on an ExpressionEngine website and I’m editing the member templates file. All templates that relate to member interaction are stored as functions inside of a class in one single file.

Each of these functions is a simple here document, but many of them print code with paths and terms that I don’t care to use. For instance, this website will refer to logged in users as “clients” instead of “members.”

Anyway, I’m looking for a way to abstract these values so that I can change them easily for this and future projects. Right now, I’m able to print variables inside of here documents by defining them within each function. I would much prefer to define these values in the top of the file, before the class is defined, but I can’t get the here documents to recognize these values.

Here’s an abridged example file:

<?php
/* I wish to define variables once in this area */
$globaluserterm = "client";

class profile_theme {

//----------------------------------------
//  Member Page Outer
//----------------------------------------
function member_page()
{
$userterm = "client";
return <<<EOF
<div id="{$userterm}-content">
    <h1>{$userterm} Account</h1> (Note: This DOES work)
    <h1>{$globaluserterm} Account</h1> (Note: This doesn't work)
    {include:member_manager}
</div>
EOF;
}
/* END */

//-------------------------------------
//  Full Proile with menu
//-------------------------------------
function full_profile()
{
$userterm = "client";
return <<< EOF
<div id="{$userterm}-full-profile">
    {include:content}
</div>
EOF;
}
/* END */


}
// END CLASS
?>
  • 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-05-15T07:48:26+00:00Added an answer on May 15, 2026 at 7:48 am

    If you have only one class per file, maybe it is already sufficient to define the values at class level? E.g.

    class profile_theme {
        private $globaluserterm = "client";
        //....
    }
    

    and in the function:

    return <<<EOF
    <div id="{$userterm}-content">
        <h1>{$userterm} Account</h1> (Note: This DOES work)
        <h1>{$this->globaluserterm} Account</h1> (Note: This doesn't work)
        {include:member_manager}
    </div>
    EOF;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Title pretty much describes it, I just need to get all the order numbers
Title sais it all really. private bool addToBinary(byte[] msg, string filepath) { bool succ
Title said it all. Some context: I got a search mechanism - search view,
Title pretty much says it all. The web.config, unchanged from how VS2008SP1 generated it,
Title kinda says it all. The usual SOS command !bpmd doesn't do a lot
Title more or less says it all. In response to a touchesBegan event, my
I think my title about says it all. During the __construct() -tion of $classA
As the title said: I would like to find all elements that are on
First of all I don't know how to phrase the question title, sorry if
This script hasn't changed since yesterday when it was working and I used 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.