Forums / Setup & design / Include website in another

Include website in another

Author Message

Aurore Hublé

Friday 15 December 2006 3:19:13 am

Hi,

I need to include a website in another. I tried to do that with php include fonction in an extension. It's work but instead of be between <div></div>, the included part is at the top.

In pagelayout.tpl I add

<div id="block-contenu">
	{web_include(''http://localhost/boutique/index.php/boutique')}

And in my extension :

function web_include($path)
{
	include($path); 
}

And the result

       ___________________________________________________
   |  included part                                    |
___|__ (http://localhost/boutique/index.php/boutique')_|
|                                                      |
|   Main website                                       |
|______________________________________________________|

instead of

 _____________________________
|                             |
|    Main website             |
|_____________________________|__________________
|     included part                              |
| (http://localhost/boutique/index.php/boutique')|
|________________________________________________|
|________________________________________________|

Kåre Køhler Høvik

Friday 15 December 2006 3:44:42 am

Hi

The include() function will output the result to the std. out output. This is displayed before any result from the templates. Make your extension function return the content instead, example:

function web_include( $path )
{
    return file_get_contents(  $path );
}

Kåre Høvik

Aurore Hublé

Friday 15 December 2006 5:05:56 am

Ok thanks !!

Mark Marsiglio

Friday 15 December 2006 5:18:12 am

I have done something similar using an iframe. It can either go in the template code directly, or using the literal html class in the Online Editor:

<iframe src ="/default.asp" width="100%" border="0">
</iframe>

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

kracker (the)

Friday 15 December 2006 7:35:00 am

Alternately you can use a php template operator as the above php function uses just one parameter (limitation).

PHP Function: '<i>file_get_contents</i>'
<i>http://us2.php.net/file_get_contents</i>

Add this line to your setting file, '<i>settings/siteaccess/example/template.ini.append.php</i>'.

[PHP]
PHPOperatorList[file_get_contents]=file_get_contents

Add this line to your pagelayout file, '<i>design/example/templates/pagelayout.tpl</i>'.

{'http://yahoo.com/'|file_get_contents()}

Alternately, if you need to use a php function using many arguments, you will want to use the 'wrap_operator' extension (in contributions). <i>http://ez.no/community/contribs/template_plugins/wrapper_operator</i>

Add this line to your setting file, '<i>settings/override/wrap_operator.ini.append.php</i>'.

[PHPFunctions]
PermittedFunctionList[]
PermittedFunctionList[]=file_get_contents

Add this line to your pagelayout file, '<i>design/example/templates/pagelayout.tpl</i>'.

{wrap_php_func('file_get_contents', 'http://google.com/' )}

Well still you could pass additional arguments as well using this method.

{wrap_php_func('file_get_contents', array( 'http://google.com/', FALSE, NULL, 0, 0 ) )}

And and after that you can write as many user defined functions in php and use them as php or template operators with the wrap_operator extension. A very flexible tool to provide for simple solutions.

Still ... beware of cache and cache block (possible) related considerations.

//kracker
<i>tv: metalocalypse</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Jianjun Hu

Saturday 07 July 2007 8:18:43 pm

Very helpful!
Thanks!

OnlyBlue

☆..·°∴°.☆°°.☆°.
°∴ °☆ .·enjoy star° .·★°∴°
∴°.°★ .·°
  ミ☆°∴°.★☆° ∴·°
°.☆° .·∴° 

Is it a pleasure after all to practice in due time what one has learnt?

eZ debug

Timing: Jan 31 2025 01:14:57
Script start
Timing: Jan 31 2025 01:14:57
Module start 'content'
Timing: Jan 31 2025 01:14:57
Module end 'content'
Timing: Jan 31 2025 01:14:58
Script end

Main resources:

Total runtime0.2047 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0098 587.9297370.2969
Module start 'content' 0.00980.0163 958.22661,009.6406
Module end 'content' 0.02610.1785 1,967.86723,898.9375
Script end 0.2046  5,866.8047 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00592.8668200.0003
Check MTime0.00150.7573200.0001
Mysql Total
Database connection0.00080.391410.0008
Mysqli_queries0.094246.01761410.0007
Looping result0.00140.69291390.0000
Template Total0.178187.010.1781
Template load0.00090.455810.0009
Template processing0.177286.557910.1772
Override
Cache load0.00070.323510.0007
Sytem overhead
Fetch class attribute can translate value0.00221.052910.0022
XML
Image XML parsing0.00030.145010.0003
General
dbfile0.01065.1684200.0005
String conversion0.00000.003530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs