SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast Remy's Avatar
    Join Date
    Oct 2002
    Location
    Amsterdam
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Don't want output directly from LoopManipulator(Eclipse)...

    Hello,

    I'am struggeling with the LoopManipulator Class of the Eclipse Libary of Vincent.

    I'am using it like below, but I don't want to catch the direct output of the LoopManipulator (with ob_start()) but I don't see a other way then to 'echo' in the LoopManipulator(is the TransactionPrinter). It's probely simple, but I don't see how to solve this, without 'echo'-ing.

    Example of my code:
    PHP Code:
     // create table of paged query
    include_once ($this->constants['pathLibary']."/eclipse/Loop.php" );
    include_once (
    $this->constants['pathLibary']."/eclipse/QueryIterator.php" );
    include_once (
    $this->constants['pathPrinter']."/TransactionPrinter.php" );
    ob_start();
    $count Loop::run(new QueryIterator($page), new TransactionPrinter($this->url$query$currentpage));
    $records ob_get_contents();
    ob_end_clean(); 
    - Rémy

    Edit:

    Sorry, should by posted in Advanced PHP Forum. My fault . Could a Mod move this thread?

  2. #2
    SitePoint Evangelist
    Join Date
    Oct 2001
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How about passing an additional argument to the LoopManipulator constructor that you use internally to collect the output? This could be a simple object, or a string reference even:

    PHP Code:
    $output "";
    $manip =& new TransactionPrinter($output);
    echo 
    $output
    Combined with:

    PHP Code:
    class TransactionPrinter extends LoopManipulator {
        var 
    $output;
        function 
    TransactionPrinter(&$output) {
            
    $this->output =& $output;
        }
        function 
    prepare() {
            
    $this->output .= "Preparing...";
        }

    You get the idea.

    BTW:

    PHP Code:
    $this->constants['pathLibary'] = ... 
    Isn't that a bit weird? I mean: a variable called constant?

    Vincent

  3. #3
    SitePoint Enthusiast Remy's Avatar
    Join Date
    Oct 2002
    Location
    Amsterdam
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats just the insight I needed. Thank you for that. It's so simple, but I just didn't see it .

    Quote Originally Posted by voostind
    Isn't that a bit weird? I mean: a variable called constant?
    For me the value constants['pathLibary'] is a contant which is defined once and should not been altered, but I think you mean: Why don't use define-function to get a true syntax-constant, like ECLIPSE_ROOT (if not, could you please explane it clearer for me?).

    I tried to use the define-function, but somehow I coudn't use the constant in a class. I did probely something wrong but with a not much time at hand, I solved it temperaly with a array $constants[..] which contains all constants of the website (like directory-paths) and I even added the GET- and POST-values also to the array, because IMO these should not be altered also. It's probely not the most beautiful\correct solution.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •