View Full Version : PHP includes HOWTO
utvara
10-23-2007, 05:06 PM
Fastest and cleanest way of doing includes in Vivvo 4 is to include your PHP script output as HTML via vte:include
<vte:include href="http://www.vivvo.net/somepage.php"
Note: you have to have allow_url_fopen enabled on your server to use this inclusion
Alternatively you would have to do the following for your custom PHP code.
Create include wrapper function:
function include_something(){
ob_start();
include 'my_include.php';
$contents = ob_get_contents();
ob_end_clean();
return $contents;
}
$template->assign('included_php', strval(include_something()));
Note: this is not the cleanest of ways to perform inclusion as you may pollute vivvo variable scope and break the functionality of included script due to various reasons. This is only suitable for including simple scripts.
For debugging purposes you can add error_reporting(E_ALL) before include 'my_include.php';
utvara
Please add 4.0 to the title of these new customisation threads you created in here, to separate them from the 3.5 version. Thanks.
pkg12
01-13-2008, 05:00 PM
where to put php code and <vte:include code , please detail with example
Examples provided are useless, please be more specific
vivvvo
06-28-2008, 04:53 AM
Fastest and cleanest way of doing includes in Vivvo 4 is to include your PHP script output as HTML via vte:include,
i really dont get what its mean, sir please giving more explains, thanks
buddman
07-28-2008, 04:07 AM
I'm trying to include a PHP script that requires an input parameter from the user record being modified in (admin/user_edit/form.xml)
Can anyone tell me the best way to pass this parameter to the PHP?
<vte:include href="http://localhost/vivvo/admin/test.php?input_userid={user.userid}" />
ProgDVB
10-08-2008, 05:31 PM
i really dont get what its mean too, please give more explains and examples. thanks
thorin
01-13-2009, 09:38 PM
Hi,
could somebody who made this feature work please help me out?
I created a simple php file, saved it as test.php and included it into a template:
<vte:include file="http://localhost/vivvo3/test.php" />
the page loads normally, but the content from test.php is not included.
Should I do something else or do I have to put something in the test.php file? I also tried to put only some text in it and then include it, but nothing happens.
allow_url_fopen is enabled on the server.
thanks
shketuljko
01-21-2009, 09:41 AM
Try with this:
http://www.vivvo.net/forums/showthread.php?t=4646&highlight=include+php+file
pkg12
04-01-2009, 01:27 PM
hi
this i am looking since last 6 month , but still there is no any concrete example i can have my own php code but with vivvo template like this.
mypage.php
url:domain/mypage.php
code
include (....)
call some class
.............................
---------------------
load some template
echo "hello word";
can somebody in vivvo , have time for it, i have been to whole documentation and its frustrating.
help help help please
trivia
04-22-2009, 04:19 AM
Since enabling allow_url_fopen is a security vulnerability, is there any other way we could do php includes? I have tried three options given below but didn't work.
With allow_url_fopen disabled, this method will not work. Instead, the file must be included with a local path, and there are three methods of doing this:
By using a relative path, such as ../includes/example_include.php.
By using an absolute path (also known as relative-from-root), such as /home/username/example.com/includes/example_include.php.
By using the PHP environment variable $_SERVER['DOCUMENT_ROOT'], which returns the absolute path to the web root directory. This is by far the best (and most portable) solution. The example that follows shows the environment variable in action:
Thanks
trivia
akash210
04-22-2009, 08:34 AM
Enabling allow_url_fopen isn't a security problem. For it to be considered this way, you need to have both of these: poorly written code and register_globals to be on.
As far as I'm aware of, there are no current vulnerabilities with Vivvo's latest version and most hosts have register_globals off so you should be good.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.