Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    92
    Thanks
    1
    Thanked 0 Times in 0 Posts

    displaying a value and calling a function

    i want to display a variable at the top of the page but i cannot run the code to get that variable until after because i am displaying a table at a certain place on the page using that code.

    Basically to get that value i was thinking if i called the function it would allow me to then display the current value after all the code has been run
    However this displays all the output from that function at the top
    Is there a way of calling a function without displaying it's output but just using selected values from that function

    Or is there another way i can do this
    I'll be shocked if anyone understands what i jus tried to explain!

    thanks

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    My head hurts. Maybe you want output buffering? I can honestly say I have no idea what you mean.

  • #3
    Regular Coder
    Join Date
    Oct 2005
    Location
    Right Here
    Posts
    654
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Use a class, call the function, set two variables:

    $this->top_output = $top;
    $this->bottom_outpupt = $bottom;

    Then echo the top, then go down the page and echo the bottom. Or use sessions, or just use two variables and forget the function.

    Either way you have to run the code first to get your value, then just store your bottom output in another variable to display later.


  •  

    Posting Permissions

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