Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 3rd, 2005, 08:59 AM
Authorized User
 
Join Date: Jan 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calling fuctions from a file.

This might sound simple but I'm a bit stuck!

What I want to do is use a switch to control what is seen in a particular DIV. In an effort to keep this tidy (and for portability sake) I want to make the case statments all functions that are read from other php pages.

For example:

Code:
switch ( $transform )
{
  case "test":
      include 'foo.php'
        function foo();
    break;
  case "test2":
      include 'foo2.php'
    function foo2();
default:
    echo "Default";
    break;
}
Foo.php contains:

Code:
<?
function foo()
{
    echo "<div id=content2>
    echo "Hello";
    echo "</div>;
}
?>
etc.

However when I try that I get an unexpected T_FUNCTION error.

I'm probably doing something really daft but I just can't see it! Any ideas please?
 
Old March 3rd, 2005, 11:52 AM
Authorized User
 
Join Date: Jan 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Don't worry I've got it now. Silly me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling Class within ASPX file kingroon ASP.NET 2.0 Basics 3 July 9th, 2008 07:43 AM
Calling to an external .jar file tony_s XSLT 3 December 16th, 2006 05:20 PM
Calling Orchestrations based on file format azmatazz Biztalk 0 March 18th, 2005 07:07 AM
Calling a function from .vb file to aspx file !! NitinJoshi General .NET 4 February 10th, 2005 06:23 AM
Calling procedures from another excel file ja8261 Excel VBA 1 December 16th, 2004 11:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.