By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,051 Members | 1,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,051 IT Pros & Developers. It's quick & easy.

flexible scope strategies for include()

P: n/a
Can anyone suggest to me a strategy for including() a variable on a
page from within a function but somehow getting that function into
global space? Let us suppose that I have this document:

$string = "

$headline -
In the navigation bar this entry shows up as: $navText.
This entry was created on: $dateCreated .
This entry starts with $textBlock1 . If there is a quote, this is how
it starts: $quoteBlock1.
These are the people with permission to edit this page: $belongsToWho.
Number of times viewed: $numTimesViewed.
Theme words: $keyword01, $keyword02, $keyword03, $keyword04,
$keyword05, $keyword06
This entry is of this type: $isWhichType . Number for this entry: <a


And I want to include it from inside this class method, but using the
class method $controllerForAll->import("mcArrangementShortFormLists.php").
I'm having scope trouble and I'm trying to think of a way around it.

function combineEntryInfo($entry) {
// 06-18-03 - you ask, what is this function for? Well, often, in
the past, I've built a form to do something like, say, delete
// articles. Normally I would fetch the id and the headline of each
article and present that info and ask if people wanted to
// delete it. I'd go through them in a for link and print them all
out, and give the person the option to delete what they wanted.
// But what if the person wanted the headline to be blank? Then
there is no text there. So, the person then looking an entry that
// gives no information about itself, but asks "Do you want to
delete this article?" And they've no way of knowing what that article
// might be. Also, there are times when a user will want to give the
same title to two different articles. And then, looking at the form
// and being asked what they want to delete, how do they know which
one it is they want to delete? They have to guess. I'm writing
// this function out of frustration with all that, I'm now going to
the opposite extreme, my intention is to offer a great deal of
// in the forms, so people know what the hell it is they are
deleting, or editing, or whatever.
$cbId = $entry[0];
$entryWithKeys = $this->sql->getEntryAsObject($cbId);
$controllerForAll = & $GLOBALS["controllerForAll"];
$dataTableForStandardPages =
$convertedEntryWithKeys =
$table = $dataTableForStandardPages->getTable();
if (is_array($table)) extract($table);
$string = $controllerForAll->import("mcArrangementShortFormLists.php");
return $string;
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.