Chtmlmergeaction

[size="3"]This extension will help developer to merge sub-contents of remote html document into other site layout.

CHtmlMergeAction has some methods to help developer fix the relative link inconsistency resulting from merging remote html document into other domain site. Merging process can be entirely customized on view script. If view script is not created, CHtmlMergeAction will create one with name equal to action name when running for first time, exemplifying how is it done. [/size]

[size="4"]Requirements [/size]

  • [font="Arial"][size="3"]Yii Framework[/size][/font]
  • [size="3"][font="Arial"]PHP Simple HTML DOM Parser ( instaled on "ext.[/font][font="Arial"]simplehtmldom" )[/font][/size]
  • [size="3"]Yii ehttpclient extension (instaled on "ext.httpclient" )[/size]

[size="4"]Usage [/size]

[color="#222222"][font="Arial, sans-serif"][size="4"]1.[/size][size="3"]Unpack compressed files and place them on your "ext.[/size][/font][/color][size="3"]CHtmlMergeAction" [color="#222222"][font="Arial, sans-serif"]directory.[/font][/color]

[font="Arial, sans-serif"] [/font][/size]

[size="3"][font="Arial, sans-serif"][color="#222222"]2. Import "ext.[/color][/font]CHtmlMergeAction" into an application. [color="#1C2837"]Edit main.php on "application.config" directory and add the following options.[/color][/size]

[color="#1C2837"][size="2"]


...

	'import'=>array(

                'ext.CHtmlMergeAction.*',   	

...

[/size][/color]

[size="3"]3. In your controller script add the following lines.[/size]


...


public function actions() {

        return array(

			'<action name>'=>array(  'class'=>'CHtmlMergeAction',

					'mergewith'=>'<http url | local html file path>',

				),

...

  1. Add view script name "<action name>.php" at applicaton views controler




<?php

	$this->action->mergeHeadLinks();   

	$this->action->mergeHeadScripts();

	$this->action->fixLinks();


	// insert remote body script tags on local body

	foreach($DOM->find('body script') as $Node) 

		echo $Node->outertext;                           	


	// insert remove body link tags on local body 	     

	foreach($DOM->find('body link') as $Node) 

		echo $Node->outertext;                           	


	// insert remote body child element with id equal to bodyContent on local body

	foreach($DOM->find('body #bodyContent') as $Node) 

		echo $Node->outertext;                           	

?>