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
?>