using php includes on pages
Get this plugin:
Then wrap your php code in:
<?php include("file.php"); ?>
This doesn’t seem to work for me.
I am using php v4.3.10 with wordpress 1.5.2
After wrapping the php code with <phpcode> and </phpcode>, what I get in the result page is the php code without the wrappers.
anyone can help? Thanks.
did you install and activate the plugin linked above before putting the code in your page?
I could not get Include to work correctly for awhile either. The answer for me was to upload the php file to my acutal root directory not the blog directory and use this line of type.
// must include this script
Want the code?
I will have to try the above as well.
Yes, I did.
I uploaded the file “phpexec.php” to the wordpress directory of “wp-content/plugins/”.
Subsequently I activated it from wordpress admin panel’s “plugins”.
Then I add the code in the post.
I think I have done it correctly. Not sure whether there is still any setting in the wordpress that require changes. or is phpexec support wordpress v1.5.2?
Darcie, which php file you upload to root directory? the phpexec.php? in such case, how are you going to activate the plugins? and your code is without ‘php’ after ‘<?’. I am very new to php, so this is just to confirm that I understand it correctly.
No it was actually just a php file for my progress meter. It is not plug-in ready yet. I wish someone would write me a plugin for it. If it were already a plugin I think it would not have been a prob.
I guess what I am saying is I am doing manually and maybe I should re-insert my question into another forum.
Darcie – don’t do includes that use URLs, they should only use absolute or relative paths within your site. Trying to include a URL usually won’t work…
I took a look at your CG-Amazon. Not sure whether I understand correctly that it doesn’t support realtime price feeding from Amazon.
I have been trying to find a way to insert price feeding into a blog post.
WP-Amazon and AMM don’t support price feeding. MrRat’ script seems to support price feed, but I need to < ?php include …> the result url in a page. (in which phpexec doesn’t seem to work for my case…)
I am looking at amazon-o-matic too.
Not sure whether you have anyway of inserting realtime price feed of an Amazon product into a post?
Hi David, is cg-quickphp supports command like “include”?
For instance, <quickphp include(“http://www.domain.com/onesection.php”); />
I found that using phpexec with wordpress 2.0 and php 4.4.1 will add
<br />tags to the end of each line of the include making it useless.
I am using the non-rich post editor and I cannot find any way to turn this “feature” off. I suspect WordPress is adding the
<br />tags. I don’t see anything adding this in the phpexec code.
UPDATE: I just found that (for both runPHP and PHPexec) if you enclose your php in
</pre>tags, WordPress won’t insert
<br />at the end of each line of the resulting html.
However, some php includes still don’t work as expected. I’m not sure yet what is happening.
I tried all the suggestions here and none work running PHPexec in WP 2.0.2.
If you check the plugins that don’t work with wp2.0, phpexec is one of them. I also use this plugin and am looking for a solution.
- The topic ‘using php includes on pages’ is closed to new replies.