Navigation Menu

Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
trustmaster committed Jan 14, 2012
0 parents commit aa7abe6
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
32 changes: 32 additions & 0 deletions pagetextbyid/pagetextbyid.global.php
@@ -0,0 +1,32 @@
<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=global
[END_COT_EXT]
==================== */

defined('COT_CODE') or die('Wrong URL');

require_once cot_incfile('page', 'module');

/**
* Returns parsed page_text for a given page
* @param int $id Page ID
* @return string
*/
function pagetextbyid($id)
{
global $db, $db_pages, $cfg;
$res = $db->query("SELECT page_text, page_parser FROM $db_pages WHERE page_id = ?", array((int) $id));
if ($res->rowCount() > 0)
{
$row = $res->fetch();
return cot_parse($row['page_text'], $cfg['page']['markup'], $row['page_parser']);
}
else
{
return '';
}
}

?>
20 changes: 20 additions & 0 deletions pagetextbyid/pagetextbyid.setup.php
@@ -0,0 +1,20 @@
<?php
/* ====================
[BEGIN_COT_EXT]
Code=pagetextbyid
Name=Page Text by ID
Description=Use this plugin to fetch page text by id using global tags like {PHP|pagetextbyid(123)} where 123 is an ID of a page
Version=2.0
Date=2012-01-14
Author=Trustmaster
Copyright=Copyright (c) Vladimir Sibirov 2012
Auth_guests=R
Lock_guests=W12345A
Auth_members=R
Lock_members=
Requires_modules=page
[END_COT_EXT]
==================== */

defined('COT_CODE') or die('Wrong URL');
?>

0 comments on commit aa7abe6

Please sign in to comment.