flexible scope strategies for include()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lawrence

    #1

    flexible scope strategies for include()

    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:

    <?php
    $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
    href='index.php ?pageId=$id'>$i d</a>

    ";
    ?>






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







    function combineEntryInf o($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
    information
    // in the forms, so people know what the hell it is they are
    deleting, or editing, or whatever.
    $cbId = $entry[0];
    $entryWithKeys = $this->sql->getEntryAsObje ct($cbId);
    $controllerForA ll = & $GLOBALS["controllerForA ll"];
    $dataTableForSt andardPages =
    $controllerForA ll->getObject("McD ataTableForStan dardPages");
    $convertedEntry WithKeys =
    $dataTableForSt andardPages->convertEntryWi thKeysFromDs($e ntryWithKeys);
    $dataTableForSt andardPages->shortenValuesT oSummaries();
    $table = $dataTableForSt andardPages->getTable();
    if (is_array($tabl e)) extract($table) ;
    $string = $controllerForA ll->import("mcArra ngementShortFor mLists.php");
    return $string;
    }
Working...