Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Member Borior's Avatar
    Join Date
    Jul 2003
    Posts
    30
    Member #
    2253
    ok this is a seriously st00pid thing to ask but how the hell do you use the output of functions as variables etc.

    i.e.

    PHP Code:
    <?php
    function myfunc($title$href) {
        echo 
    '<a href="'.$href.'" title="'.$title.'">'.$title.'</a>';

    /* Now i want to set $var to the output of a call to the above function */

    $var myfunc("Home""index.php");
    Now that obviously doesn'y work ... so how do i do it?

  2.  

  3. #2
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    PHP Code:
    function myfunc($title$href)
    {
       return 
    "<a href=\\"$href\\" title=\\"$title\\">$title</a>";
    }
    .
    .
    .
    $var myfunc("Home""index.php"); 
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  4. #3
    Member Borior's Avatar
    Join Date
    Jul 2003
    Posts
    30
    Member #
    2253
    ok ... thats all very well but im gonna need to be more specific. Im using html classes and it looks like this:

    PHP Code:
    $page->SetParameter ("PAGE_CONTENT""Hello World!"); 
    This (funnily enough ) sets a parameter for the HTML class so that in the template file an instance of {PAGE_CONTENT} will be replaced with "Hello World!" .

    If i want to replace the second variable call with, say, an 'include' or a 'require' to replace my "Hello World!" statement with the contents of another local/remote file how the hell would i do that?

    Thanks in advance.

    Borior

  5. #4
    Member Borior's Avatar
    Join Date
    Jul 2003
    Posts
    30
    Member #
    2253
    c'mon ... need some help please! bump-bump

    <!-- Start Edit: -->
    I've got somewhere here:

    for the include thing i can load the file into in array, like this:

    PHP Code:
    $content implode (''file ('pages/example.php')); 
    and then call it like this:

    PHP Code:
    $page->SetParameter ("PAGE_CONTENT"$content); 
    HOWEVER ... i still need help ... if example.php contains php (which it does) how do i parse the array ($content) ... as is, it doesn't parse and so calls like "$_SERVER['REMOTE_ADDR'];" do nothing.

    Still need help
    <!-- End Edit: -->


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:03 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com