1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

Closes #638 - {BOOK_ID}, {CHAPTER_ID} and {BOOK_URL} shortcodes added to pages.

This commit is contained in:
Cameron
2014-06-16 15:05:45 -07:00
parent 150689482a
commit 4f264a8563

View File

@@ -328,9 +328,19 @@ class cpage_shortcodes extends e_shortcode
{ {
return vartrue($this->var['page_sef'],'page-no-sef'); return vartrue($this->var['page_sef'],'page-no-sef');
} }
// -------------------- Book - specific to the current page. ------------------------- // -------------------- Book - specific to the current page. -------------------------
function sc_book_id()
{
$frm = e107::getForm();
$row = $this->getBook();
return $row['chapter_id'];
}
function sc_book_name() function sc_book_name()
{ {
$tp = e107::getParser(); $tp = e107::getParser();
@@ -363,10 +373,25 @@ class cpage_shortcodes extends e_shortcode
return $tp->toHtml($row['chapter_meta_description'], true, 'BODY'); return $tp->toHtml($row['chapter_meta_description'], true, 'BODY');
} }
function sc_book_url()
{
$row = $this->getBook();
return e107::getUrl()->create('page/book/index', $row,'allow=chapter_id,chapter_sef,book_sef') ;
}
// -------------------- Chapter - specific to the current page. ------------------------- // -------------------- Chapter - specific to the current page. -------------------------
/**
* @example {CHAPTER_ID}
*/
function sc_chapter_id()
{
$row = $this->getChapter();
return $row['chapter_id'];
}
/** /**
* @example {CHAPTER_NAME} * @example {CHAPTER_NAME}
*/ */