RE: [PHP] Re: Making functions available from another script

2005-11-07 Thread Richard Leclair
Hi Norbert,

Thanks for your reply.  Yeah, you were almost there - it wasn't quite what I
had in mind.  I probably should have elaborated on this one.

I'm looking at building up a library of handy functions that can be included
in a current script.

Only problem is:
(let's just say for clarity that lib.php == A.php; same)..

If I declare the functions in lib.php, then B.php can include lib.php but
cannot execute any functions within B.php (that were declared in lib.php).
it keeps coming up as function undeclared.

Any more ideas/thoughts?  Or have I not gone about this correctly?

Regards,
Richie !


 -Original Message-
 From: Norbert Wenzel [mailto:[EMAIL PROTECTED]
 Sent: Monday, 7 November 2005 5:13 pm
 To: php-general@lists.php.net; Richard Leclair
 Cc: php-general@lists.php.net
 Subject: [PHP] Re: Making functions available from another script
 
 Richard Leclair wrote:
  Hi PHP-ers,
 
  Here's an easy one:
  Q: How can I make a function available from within another php script?
 
  Eg. B.php contains:
 
  ?php include .../fns.php ?
 
  Which has a function fn($x);
 
  Later on, I want to include this function in B.php somewhere.
 
  In short:  B.php wants to use fn($x) found in A.php.
 
  Regards,
  Richie !
 
 I'm not quite sure if I did get your question right, but you answered
 the question yourself.
 
 include(anyfile.php); does nothing more then copy the code of
 anyfile.php to the file, in which it is called. anyfile.php is
 interpreted as HTML, so you should have your ?php brackets around the
 document.
 
 A.php---
 function foo($bar) {
   //do sth
 }
 
 B.php---
 include[_once](A.php);
 
 $x = anything you like;
 $whatever = foo($x);
 
 
 this works if A and B are in exactly the same directory, otherwise you
 should change the path for the include call.
 
 Did I get your question right?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Making functions available from another script

2005-11-07 Thread Richard Leclair
DOH!!  Okay, I've sorted out the [my] problem...

Instead of just doing the include relatively, I tried including it via the
full URL, ie. ?php include(http://$_SERVER[HTTP_HOST]/lib.php;); ?

I guess it just includes output of the result of this typical HTTP parse.
By just doing ?php include(./lib.php); ?, everything works fine.
(Providing of course that the two files exist in the same directory.)

---
If you're interested, this is what I used to test it with:

lib.php:

?php
function doit($s)   { return done: $s\n; }
function listem($s) { print 1 $s, 2 . $s. s, lots of .$s.s.\n; }
?

A.php:
--
?php include http://$_SERVER[HTTP_HOST]/lib.php; ?
HTML
BODY
H1Something basic/H1

H2Let's do stuff:/H2
?php
$todo = doit(put out the garbage.);
$todo .= doit(pay the mower guy.);
$todo .= doit(finish that letter.);
$todo .= doit(take a break.);
print PRE\n$todo/PRE\n;
?

/BODY
/HTML
---

Original included produced an undefined call to function doit().

Regards,
Richie !


 -Original Message-
 From: Arno Kuhl [mailto:[EMAIL PROTECTED]
 Sent: Monday, 7 November 2005 5:58 pm
 To: php-general@lists.php.net
 Subject: RE: [PHP] Re: Making functions available from another script
 
 If it was working properly the function would be callable. Your include is
 probably not working - change it to require and see if you get an error.
 Using include doesn't give you an error if the include file is not
 found.
 
 Arno
  
  DotContent
  Professional Content Management Solutions
  www.dotcontent.net
 
 
 -Original Message-
 From: Richard Leclair [mailto:[EMAIL PROTECTED]
 Sent: 07 November 2005 11:33
 To: 'Norbert Wenzel'
 Cc: php-general@lists.php.net
 Subject: RE: [PHP] Re: Making functions available from another script
 
 
 Hi Norbert,
 
 Thanks for your reply.  Yeah, you were almost there - it wasn't quite what
 I
 had in mind.  I probably should have elaborated on this one.
 
 I'm looking at building up a library of handy functions that can be
 included
 in a current script.
 
 Only problem is:
 (let's just say for clarity that lib.php == A.php; same)..
 
 If I declare the functions in lib.php, then B.php can include lib.php but
 cannot execute any functions within B.php (that were declared in lib.php).
 it keeps coming up as function undeclared.
 
 Any more ideas/thoughts?  Or have I not gone about this correctly?
 
 Regards,
 Richie !
 
 
  -Original Message-
  From: Norbert Wenzel [mailto:[EMAIL PROTECTED]
  Sent: Monday, 7 November 2005 5:13 pm
  To: php-general@lists.php.net; Richard Leclair
  Cc: php-general@lists.php.net
  Subject: [PHP] Re: Making functions available from another script
 
  Richard Leclair wrote:
   Hi PHP-ers,
  
   Here's an easy one:
   Q: How can I make a function available from within another php script?
  
   Eg. B.php contains:
  
   ?php include .../fns.php ?
  
   Which has a function fn($x);
  
   Later on, I want to include this function in B.php somewhere.
  
   In short:  B.php wants to use fn($x) found in A.php.
  
   Regards,
   Richie !
 
  I'm not quite sure if I did get your question right, but you answered
  the question yourself.
 
  include(anyfile.php); does nothing more then copy the code of
  anyfile.php to the file, in which it is called. anyfile.php is
  interpreted as HTML, so you should have your ?php brackets around the
  document.
 
  A.php---
  function foo($bar) {
  //do sth
  }
 
  B.php---
  include[_once](A.php);
 
  $x = anything you like;
  $whatever = foo($x);
 
 
  this works if A and B are in exactly the same directory, otherwise you
  should change the path for the include call.
 
  Did I get your question right?
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Line breaks in mail function?

2005-11-06 Thread Richard Leclair
Hi Murray,

Try doing something like this:

---
$body = From: $name
Email: $email
IP Address: $_SERVER['REMOTE_ADDR']

Feedback:

$feedback
;

$fromaddr = $email
Reply-To: $email
X-Mailer: PHP/ . phpversion();

mail([EMAIL PROTECTED], Feedback, $body, $fromaddr);
---

I haven't tested this 'actual' piece of code, but I've used similar in other
emailing scripts.

Regards,
Richie !

 -Original Message-
 From: Murray @ PlanetThoughtful [mailto:[EMAIL PROTECTED]
 Sent: Monday, 7 November 2005 10:21 am
 To: php-general@lists.php.net
 Subject: [PHP] Line breaks in mail function?
 
 Hi All,
 
 I'm building a site on a new web host and am currently working on
 feedback forms.
 
 I'm using the mail() function to send the feedback to the destination
 mail account, and I'm having problems getting the body of the email to
 line break.
 
 I've tried constructing the body with both \n\n and \r\n\r\n
 terminating lines where I want line breaks to appear, but both return an
 email with the body in one long string showing the actual \n\n or
 \r\n\r\n characters, as opposed to interpreting them as line breaks.
 
 Example code:
 
 $body = 'From: ' . $name . '\r\n\r\n';
 $body .= 'Email:' . $email . '\r\n\r\n';
 $body .= 'IP Address: ' . $_SERVER['REMOTE_ADDR'] . '\r\n\r\n';
 $body .= 'Feedback:\r\n\r\n';
 $body .= $feedback;
 mail([EMAIL PROTECTED], Feedback, $body, From:
 $email\r\nReply-To: $email\r\nX-Mailer: PHP/ . phpversion());
 
 As I said above, I've also tried using \n\n instead of \r\n\r\n.
 
 Can anyone give me some advive on how to get the linebreak characters
 interpreted as linebreaks?
 
 Many thanks and much warmth,
 
 Murray
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Making functions available from another script

2005-11-06 Thread Richard Leclair
Hi PHP-ers,

Here's an easy one:
Q: How can I make a function available from within another php script?

Eg. B.php contains:

?php include .../fns.php ?

Which has a function fn($x);

Later on, I want to include this function in B.php somewhere.

In short:  B.php wants to use fn($x) found in A.php.

Regards,
Richie !

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] No forums?

2005-11-05 Thread Richard Leclair
I'm afraid I'm going to have to agree with Rob Cummings on this one.
I have a comment and suggestion:


Comment:
There is far too much 'spam' about a long-dealt with issue which keeps
flying around, clogging up mailing lists.  It can sometime happens when
people either feel they need to have the last say, or that they are simply
competitive and cannot be seen to be wrong in other people's eyes (when,
in fact - nobody really cares anymore on the issue).

When all that is required is for interested parties to air their issues in
emails among themselves, they still insist on including the whole of the
mailing list - if (in their eyes) the opinions of others are important, this
only highlights their insecurities.


Suggestion:
To those who don't want to be part of this thread for the next week or two,
simply setup a mail filter with RE: [PHP] No forums? in the subject. :P
I'm onto it now.   :)


Regards,
Richie !



 -Original Message-
 From: Robert Cummings [mailto:[EMAIL PROTECTED]
 Sent: Sunday, 6 November 2005 5:09 am
 To: GamblerZG
 Cc: PHP-General
 Subject: Re: [PHP] No forums?
 
 On Sat, 2005-11-05 at 16:04, GamblerZG wrote:
  It is the main reason I think there are many other people
  who would also like to have web conference. Instead of subscribe, post,
  wait
 
 And how many of these many other people in your guesstimate have come
 forward to support your notion?
 
 Perhaps you, and they can go ahead and start up your forum. As was
 suggested already, if you build it, and if they come, they (the Gods of
 PHP) might just officialize it. You have your mandate, feel free to stop
 trolling now.
 
 Cheers,
 Rob.
 --
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php