Hi,
To try to explain a little bit better : ..
Here is my USER-DEFINED-TAG code :
the code name is 'show_all_content'...
I want to replace the {content} tag by my tag ...
Code: Select all
global $gCms;
$db =& $gCms->GetDb();
$alias = $gCms->variables['page'];
$query = "SELECT * FROM cms_content_props, cms_content WHERE
cms_content_props.content_id = cms_content.content_id AND
content_alias LIKE '$alias'";
$result = &$db->Execute($query);
$id = $result->fields['content_id'];
$parent_id = $result->fields['parent_id'];
// Child
if ($parent_id != -1)
{
$query2 = "SELECT * FROM cms_content_props, cms_content WHERE
cms_content_props.content_id = cms_content.content_id AND
cms_content.content_id=$id";
$result2 = &$db->Execute($query2);
echo "<h2>" . $result2->fields['content_name'] . "</h2>";
echo "{literal}" . $result2->fields['content'] ."{/literal}";
}
else // parent
{
// display the content of the parent
echo "<h2>" . $result->fields['content_name'] . "</h2>";
echo "{literal}" . $result->fields['content'] . "{/literal}";
// list the child
$query2 = "SELECT * FROM cms_content_props, cms_content WHERE
cms_content_props.content_id = cms_content.content_id AND
cms_content.parent_id=$id ORDER BY cms_content.item_order";
$result2 = &$db->Execute($query2);
while ($result2 && !$result2->EOF)
{
echo "<h2>" . $result2->fields['content_name'] . "</h2>";
echo $result2->fields['content'];
$result2->MoveNext();
}
}
So, when a main menu is selected, it show his content + all the content of the sub-menu ...
I a sub-menu is selected, only the content of the sub-menu is displayed.
The problem : when a content contains a {tag} ....