Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 8th, 2006, 10:05 PM
lazypig06@gmail.com
Guest
 
Posts: n/a
Default PHP global functions ?

Hi everyone !

I got a question about how to create a universal functions (visible to
all pages in current directory and sub directories).

I am trying to create a function that can be called on each page in
current directory and sub directories without include the file that
contains this file. Does anybody know how to do this ?

To make it more specific, Let's say I created a file "temp.php" which
contains a function "foo( )".
Now, I'd like to call foo( ) in every new web pages I create in any
subdirectory without including the file "temp.php".

I was told that .htaccess can get this job done. However, I don't know
exactly how this is done using .htaccess ?

Any help would be appreciated ?

Thanks,
Lazy Pig

  #2  
Old August 8th, 2006, 10:15 PM
Carl Vondrick
Guest
 
Posts: n/a
Default Re: PHP global functions ?

Quote:
I was told that .htaccess can get this job done. However, I don't know
exactly how this is done using .htaccess ?
Just configure it in php.ini. Set auto_append_file to wherever your
function is.

Carl
  #3  
Old August 9th, 2006, 07:25 AM
binderup@gmail.com
Guest
 
Posts: n/a
Default Re: PHP global functions ?

Just configure it in php.ini. Set auto_append_file to wherever your
Quote:
function is.
Well that might not be a good idea if you don't want the functions to
be available for all virtual hosts (or if you don't have access to the
php.ini file).

I prefer to use the .htaccess method:
php_value auto_prepend_file /full/path/to/script.php

  #4  
Old August 10th, 2006, 04:55 PM
lazypig06@gmail.com
Guest
 
Posts: n/a
Default Re: PHP global functions ?

Hi guys!

Thank you for your response. If you gonna use .htaccess to this this,
how would you go about to do that ?
I've searched many sites, but none of the sites I found has specific
information about this stuff.

Thanks,
Lazy Pig

binderup@gmail.com wrote:
Quote:
Quote:
Just configure it in php.ini. Set auto_append_file to wherever your
function is.
>
Well that might not be a good idea if you don't want the functions to
be available for all virtual hosts (or if you don't have access to the
php.ini file).
>
I prefer to use the .htaccess method:
php_value auto_prepend_file /full/path/to/script.php
  #5  
Old August 10th, 2006, 10:05 PM
Rik
Guest
 
Posts: n/a
Default Re: PHP global functions ?

lazypig06@gmail.com wrote:
Quote:
binderup@gmail.com wrote:
Quote:
Quote:
>>Just configure it in php.ini. Set auto_append_file to wherever your
>>function is.
>>
>Well that might not be a good idea if you don't want the functions to
>be available for all virtual hosts (or if you don't have access to
>the php.ini file).
>>
>I prefer to use the .htaccess method:
>php_value auto_prepend_file /full/path/to/script.php
Thank you for your response. If you gonna use .htaccess to this this,
how would you go about to do that ?
I've searched many sites, but none of the sites I found has specific
information about this stuff.
Exactly how he said, create an .htaccess file containing:
php_value auto_prepend_file /full/path/to/script.php

More files/scripts are perfectly possible.

Grtz,
--
Rik Wasmus


  #6  
Old August 19th, 2006, 11:15 AM
binderup@gmail.com
Guest
 
Posts: n/a
Default Re: PHP global functions ?

Rik wrote:
Quote:
Exactly how he said, create an .htaccess file containing:
php_value auto_prepend_file /full/path/to/script.php
There could be a problem with permissions - make sure that the
..htaccess file is set to be executable

/Peter

  #7  
Old August 19th, 2006, 01:45 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default Re: PHP global functions ?

binderup@gmail.com wrote:
Quote:
Rik wrote:
>
Quote:
>>Exactly how he said, create an .htaccess file containing:
>>php_value auto_prepend_file /full/path/to/script.php
>
>
There could be a problem with permissions - make sure that the
.htaccess file is set to be executable
>
/Peter
>
..htaccess is not an executable file and should *never* be set that way.
It only needs to be readable by the Apache process.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles