I need to get the data from the cms to put it into a variable and display it afterward.
I am using ajax to change dynamicaly the content of a div (using innerHTML).
into this div I want to load a page which exists into the CMS.
for now I am doing that:
Code: Select all
include_once(dirname(__FILE__).'/../include.php');
include_once(dirname(__FILE__).'/../lib/config.functions.php');
include_once(dirname(__FILE__).'/../lib/adodb.functions.php');
require_once(dirname(__FILE__).'/../lib/classes/class.global.inc.php');
$gCms = new CmsObject();
$db =& $gCms->GetDb();
$sql = "SELECT `content_id` FROM `cms_content` WHERE `content_alias` LIKE ?";
$result = $db->GetRow($sql, array( 'get-quote' ));
if (isset($result['content_id']) && !is_null($result['content_id']) &&!empty($result['content_id'])){
$get_quote_page_id = $result['content_id'];
$sql = "SELECT `content` FROM `cms_content_props` WHERE `prop_name` LIKE ? AND `content_id` LIKE ?";
$result = $db->GetRow($sql, array( 'content_en', $get_quote_page_id ));
if (isset($result['content']) && !is_null($result['content']) &&!empty($result['content'])){
echo $result['content'];
}
}
else{
echo "Page not found";
}
well, when I display the page, instead to have the HTML code of the global content block I have :
{global_content name='captcha'} in plain text.
so ... I decide to replace this tag (if I find it) with the value of the content block, and my code become :
Code: Select all
<?php
include_once(dirname(__FILE__).'/../include.php');
include_once(dirname(__FILE__).'/../lib/config.functions.php');
include_once(dirname(__FILE__).'/../lib/adodb.functions.php');
require_once(dirname(__FILE__).'/../lib/classes/class.global.inc.php');
require_once(dirname(__FILE__).'/../lib/classes/class.content.inc.php');
require_once(dirname(__FILE__).'/../lib/classes/class.contentoperations.inc.php');
require_once(dirname(__FILE__).'/../lib/classes/class.globalcontentoperations.inc.php');
$gCms = new CmsObject();
$db =& $gCms->GetDb();
$sql = "SELECT `content_id` FROM `cms_content` WHERE `content_alias` LIKE ?";
$result = $db->GetRow($sql, array( 'get-quote' ));
if (isset($result['content_id']) && !is_null($result['content_id']) &&!empty($result['content_id'])){
$get_quote_page_id = $result['content_id'];
$sql = "SELECT `content` FROM `cms_content_props` WHERE `prop_name` LIKE ? AND `content_id` LIKE ?";
$result = $db->GetRow($sql, array( 'content_en', $get_quote_page_id ));
if (isset($result['content']) && !is_null($result['content']) &&!empty($result['content'])){
//echo '<__script__>document.write('.$result['content'].');</__script>';
############################# captcha ################################
$gco = new GlobalContentOperations();
$gc_content = $gco->LoadHtmlBlobByName('captcha');
# into this content there is one content block.
$result['content'] = str_replace("{global_content name='captcha'}", $gc_content['content'], $result['content']);
echo $result['content'];
}
}
?>
I want to know if there is a function into the CMS which allow the developer to get the HTML result of a global content block ?
If yes which one ? if no how can I do ?
Thanks a lot