function from another page?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • thamood@gmail.com

    function from another page?

    hi guys i was just wondering can i call a function from another page
    and get the return value?
    like if i had page1.php which have the function fun1() can i call this
    function from another page ?? if i can how?? many thanx in advance :)...

  • Erwin Moller

    #2
    Re: function from another page?

    thamood@gmail.c om wrote:
    [color=blue]
    > hi guys i was just wondering can i call a function from another page
    > and get the return value?
    > like if i had page1.php which have the function fun1() can i call this
    > function from another page ?? if i can how?? many thanx in advance :)...[/color]

    Yes and no.

    No, you cannot call a PHP function directly on another page.
    You could however call another URI (could be PHP) and catch the complete
    output of that script.
    But why makes things so difficult?

    Yes: If you modify your setup a little:
    Why not put the function(s) in a seperate file, and include that file
    whereever you need it?

    Regards,
    Erwin Moller


    Comment

    • thamood@gmail.com

      #3
      Re: function from another page?

      i already thought of putting the functions in a seprate file but i had
      this idea of putting every page in a certain type like (news - links
      ...etc) and i wanted to make a super class that everyone can inherit and
      this super class have a function that return the type .... i hope i
      made it clear and thanx again man...

      Comment

      Working...