rc255
March 16, 2022, 11:08am
1
Hi there, I’m desperately trying to apply ‘theme’ to single pages, specifically login.php, page_forbidden.php & page_not_found.php.
I have downloaded them from:
concrete > single_pages
and saved them into:
application > single_pages
I have altered the file in concrete > config > app.php to:
<?php
return array(
'theme_paths' => array(
'/login' => 'my_theme'
),
);
and uploaded that to application > config > app.php
This is now giving me an unstyled login page (do I do the same for page_forbidden & page_not_found ?)
But now I’m stuck… I can insert the bare code from login.php into my ‘styled template’ but what do I do from here?
If you can help me out and point me in the right direction, I’d be very grateful. Thanks in advance
Yeah, you are doing it right.
application/config/app.php
<?php
return [
'theme_paths' => [
'/login' => 'theme',
],
];
Now, you want to create/modify view.php template (which will display login page etc.):
application/themes/your_theme_folder/view.php
Important part is $innerContent variable, which will display login form (concrete/single_pages/login.php) - or any other content of single page.
Look at atomik theme view.php file. It also includes header and footer, so theme’s css/js will be loaded, menu/logo/footer etc. will be displayed.
concrete/themes/atomik/view.php
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$view->inc('elements/header.php');
?>
<div class="container">
<div class="row">
<div class="col-sm-12">
<?php
View::element('system_errors', [
'format' => 'block',
'error' => isset($error) ? $error : null,
'success' => isset($success) ? $success : null,
'message' => isset($message) ? $message : null,
]);
echo $innerContent;
?>
</div>
</div>
</div>
<?php
$view->inc('elements/footer.php');
If css styling is not enough and you want to modify code in php file you can copy:
concrete/single_pages/login.php
to:
application/single_pages/login.php
If you don’t want to share template across all single pages, you can also create file inside theme folder:
application/themes/your_theme_folder/page_not_found.php
Just remember about adding $innerContent and stuff (like in view.php)
1 Like
rc255
March 16, 2022, 1:11pm
3
Thanks once again Parasek, nailed it!