Custom Single Page and Custom Header/Footer blocks
Permalink
Could someone please help me with the missing steps for adding a custom page named "library"?
*******************************
How to add a Single Page
*******************************
Step 1: Route
open file: /public/application/bootstrap/app.php
add the following code at the bottom of the file
Route::register('/library', '\Application\Controller\SinglePage\Library::view');
Step 2:
create new file: /public/application/controllers/single_page/library.php
Step 3:
Add the following code within php tag
-------------------
namespace Application\Controller\SinglePage;
use PageController;
use Concrete\Core\Page\Theme\Theme;
class Library extends PageController
{
public function view()
{
$this->set('pagetitle', 'Library');
$elemental = Theme::getByHandle('elemental');
$this->setTheme($elemental);
$this->render('/library/view');
}
}
-------------------
Step 4: create a new file: /public/application/single_pages/library/view.php
Step 5: add the following sample code within php tag
defined('C5_EXECUTE') or die("Access Denied.");
<h1><?=t('Library')?></h1>
Step 6: Optional: log-in to back-end add the page in sitemap at appropriate location
**************************************
I am having issue with theme; it is not applying the default header and footer.
How do I inherit the site template?
Next items I don't know are
*********************************************
How to create a Block
*********************************************
Step 1: create file for block controller: /public/application/blocks/header.php
Step 2: add the ?? some sample code in file?
Step 3: create file for block view: ??
*********************************************
How to add a Block to a Single page
*********************************************
Step 1: In single page view function add the ?? following code
// Part 1
add some using statement?? to the single page
add/update __construct inputs??
// Part 2
$page = Page::getByID($pid);
$block = BlockType::getByHandle('some_block');
// ...define additional block attributes...
$page->addBlock('Area Name', $block);
Step 2: Open file /public/application/single_pages/library/view.php
Add the following sample code to display the block?
*****************
I spend great amount of time last week; and I just hope I can have a working single page and blocks working correctly hopefully today or by end of the week.
Any help is greatly appreciated.
*******************************
How to add a Single Page
*******************************
Step 1: Route
open file: /public/application/bootstrap/app.php
add the following code at the bottom of the file
Route::register('/library', '\Application\Controller\SinglePage\Library::view');
Step 2:
create new file: /public/application/controllers/single_page/library.php
Step 3:
Add the following code within php tag
-------------------
namespace Application\Controller\SinglePage;
use PageController;
use Concrete\Core\Page\Theme\Theme;
class Library extends PageController
{
public function view()
{
$this->set('pagetitle', 'Library');
$elemental = Theme::getByHandle('elemental');
$this->setTheme($elemental);
$this->render('/library/view');
}
}
-------------------
Step 4: create a new file: /public/application/single_pages/library/view.php
Step 5: add the following sample code within php tag
defined('C5_EXECUTE') or die("Access Denied.");
<h1><?=t('Library')?></h1>
Step 6: Optional: log-in to back-end add the page in sitemap at appropriate location
**************************************
I am having issue with theme; it is not applying the default header and footer.
How do I inherit the site template?
Next items I don't know are
*********************************************
How to create a Block
*********************************************
Step 1: create file for block controller: /public/application/blocks/header.php
Step 2: add the ?? some sample code in file?
Step 3: create file for block view: ??
*********************************************
How to add a Block to a Single page
*********************************************
Step 1: In single page view function add the ?? following code
// Part 1
add some using statement?? to the single page
add/update __construct inputs??
// Part 2
$page = Page::getByID($pid);
$block = BlockType::getByHandle('some_block');
// ...define additional block attributes...
$page->addBlock('Area Name', $block);
Step 2: Open file /public/application/single_pages/library/view.php
Add the following sample code to display the block?
*****************
I spend great amount of time last week; and I just hope I can have a working single page and blocks working correctly hopefully today or by end of the week.
Any help is greatly appreciated.