Jump to content

Executing PHP Function through echo'd variable


mysticssjgoku4

Recommended Posts

Hello there,
I'm trying to execute a function such as "include('file.php');" by echoing it through a variable.

Set Before Loading Page:
[code]$skin['content'] .= "<?php include('pages/page_$pagename.src'); ?>";[/code]

In Page:
[code]<td class='nav_body' nowrap>
                                        <br>
                                        <? echo $skin[content]; ?>
                                        <br>
                                    </td>[/code]

Now, I've tried all sorts of things and cannot get this to execute a function while echo'ing it. Nothing has worked, most I've got it to do is echo the text.

If you could please help me out, I would appreciate it greatly!

Thank you very much.

-Ryan
Link to comment
Share on other sites

Thank you, eval worked perfectly.

[img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]


One thing, I'm not sure if it's my fault or what:

I put this in

Index.php
[code]
$skin['content'] .= "include('pages/page_$pagename.src');";
[/code]

Page Included
[code]
<?
    $skin['title'] = "News";
?>


<p align='center'>
<table width='95%' border='1'>
    <tr>
        <td>

        </td>
    </tr>
    <tr>
        <td>
            CENSORED<br>
        </td>
    </tr>
</table>
</p>

[/code]

Template
[code]<td class='nav_body' nowrap>
                                        <br>
                                        <? eval($skin[content]); ?>
                                        <br>
                                    </td>[/code]

Doesn't set the value $skin['title'] to "News" as it should above.

Thank You once again!
Link to comment
Share on other sites

[!--quoteo(post=373675:date=May 14 2006, 02:14 AM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ May 14 2006, 02:14 AM) [snapback]373675[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You might want to watch your tongue when posting on the forums. Some people may take offence. I would edit your previous post if I where you.
[/quote]

Not only is it an example, it's a quote from television. If it was able to be air'd I don't believe anyone will take offense to it and would rather laugh at it. Good Day, and thank you for going off topic while not providing me any help. I can see the relevance you must make amongst the community.

Now aside from all that, does anyone have any better ideas? [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Link to comment
Share on other sites

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]I don't believe anyone will take offense to it[/quote]
Im telling you that I [b]do[/b].
[code]
$skin['content'] = "include('pages/page_$pagename.src')";
eval($skin['content']);
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.