Hi MARG, It will be better if you can provide the code here and what error you are getting. BTW header function is the key here. Zareef Ahmed ----- Original Message ----- From: "Miles Thompson" <miles@xxxxxxxxxxxxxxxxx> To: <php-general@xxxxxxxxxxxxx> Sent: Sunday, December 11, 2005 12:33 PM Subject: Re: Moving code from a specific file to a generic one > At 10:31 AM 12/11/2005, MARG wrote: > >Hi, > > > >I have this source code in this randomImage.php file (see source): > >http://www.tuxdoit.com/randomImage.phps > > > >This generates a random image for form validation. > >Now, as you can see, i call the picture from > >http://www.tuxdoit.com/newslwetter.php > >as > ><img src="randomImage.php"> > >and that works just fine. > > > >But... i'd like to include the source code of randomImage.php in a > >generic functions.php file along with others. > > > >My problem is i'm not being able to do that. > > > >If i move the code to functions.php, what modifications must be made to > >the image generation code and how do i call it from newsletter.php ? > > > >I've already tried to make it a function, of course, but no good :( > >I'm driving nuts with this :( > > > >Any help would be apreciated. > > > >Warm Regards, > >MARG > > "not able to do that" - what happens? What error messages do you get? Or > does nothing happen? > > What is the scope of $image? Have you recognized it as a global within the > function, and declared it external to the function? > > Have you deconstructed randomImage and built it up incrementally within > function.php? > > Could it be that if you try and include it in functions.php there is output > somewhere sent to the browser before the header() and session_start() > functions are called? > > Finally, what's wrong with calling it as you do at present? Flash > programmers are forced into that model for every class they create. It must > be an independent .as file, with the same name as the function, and contai n > code only for properties and methods of that function. > > HTH - Miles Thompson > > -- ==================================================== PHP Expert Consultancy in Development http://www.indiaphp.com Yahoo! : consultant_php MSN : consultancy@xxxxxxxxxxxx > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php