Page 1 of 1

Easy question to answer.

Posted: Wed Jun 14, 2006 1:44 am
by akimm
I have a script that takes words from a form prints them to a textfile for example:

Example word = example definition
contributed by: Example person

then with explode() I take this information and place it into an array then alphabetize it and print it in different parts, like part A) is words thta begin with A and so on:

Example person#datasep#example word#datasep#example definition#entrysep#

What I would like to do is make a graphical interface to do this without having to FTP a textfile and then format it myself.

My first question for the forum is basically, if i have these functions in directory A) in textfile A) is it possble to refer to it in file B) as long as it's still in the same directory?


[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.

Posted: Wed Jun 14, 2006 1:51 am
by RobertGonzalez
As long as you have permissions to get into the folders/files, open them and read them, it should be no problem to do whatever you want in them.

No no

Posted: Wed Jun 14, 2006 1:53 am
by akimm
I mean, can i refer to functions from one file, or do I need to actually reprint them in each file?

Would include work?

Posted: Wed Jun 14, 2006 2:05 am
by RobertGonzalez
Yes, include would work...

Code: Select all

<?php
/***************
 * This page is:
 * functions.php
 **************/
function my_function()
{
    // do something
}
?>

Code: Select all

<?php
/***************
 * This page is:
 * mypage.php
 **************/

// Include our functions
// Make sure they are in the same path
// or reference the actual path that the file is in
include 'functions.php';

$my_var = my_function();
?>

ok

Posted: Wed Jun 14, 2006 2:11 am
by akimm
cool, thanks.