PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:Function include doesn't work (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:Function include doesn't work


#5377
goliath (User)
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Function include doesn't work 10 Months, 3 Weeks ago Karma: 0  
Hi there

I can't seem to make this work correctly.

A simple <?php echo "Hello world"; ?> seems to work fine.
A <?php include "index.php"; ?> works also.
But <?php include "index.php?option=com_content&view=article&id=112&Itemid=346"; ?> doesn't work.

These are the error messages that I receive:

Warning: include(index.php?option=com_content&view=article&id=112&Itemid=346) [function.include]: failed to open stream: No such file or directory in /home/sitename/public_html/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1

Warning: include(index.php?option=com_content&view=article&id=112&Itemid=346) [function.include]: failed to open stream: No such file or directory in /home/sitename/public_html/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1

Warning: include() [function.include]: Failed opening 'index.php?option=com_content&view=article&id=112&Itemid=346' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/sitename/public_html/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1

Am I doing something wrong?

Please be so kind letting me know.

Best regards
 
  The administrator has disabled public write access.

#5389
kksou (Admin)
Admin
Posts: 1676
graph
User Online Now Click here to see the profile of this user
Re:Function include doesn't work 10 Months, 3 Weeks ago Karma: 27  
Hi,

Please check the PHP documentation.

If you want to use include with URL, you need to provide the full URL, e.g. <?php include "http://www.yoursite.com/index.php?option=com_content&view=article&id=112&Itemid=346"; ?>

However, please take note that you are including the entire content of another article. This will include the complete header, body, etc. And note that you are using DirectPHP within another article, too. So with two headers, body, etc., it will be a "mess". (Just do a view source of both articles and you will know what I mean.)

DirectPHP is not developed for this purpose. It's for running simple and straight-forward PHP scripts. It's not for including one complete article into another.

If you simply want to include the content of one article into another, you can use another plugin that I've written: the include_content_item plugin http://www.kksou.com/php-gtk2/Joomla/Include-Content-Item-plugin.php

Regards,
/kksou
 
  The administrator has disabled public write access.



Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Blog - Forum - Privacy Policy - Contact Us
Links - Classes - Social Business - BPM - Web - General
Copyright © 2006-2013. kksou.com. All Rights Reserved