Pointer:
If you have done all steps up to and including step 5 and you are logged in, your homepage of the demo content looks like:
Look at the four gear wheels in purple!
If you then e.g. click at the gear wheel
another tab or window of your browser opens with:
So you can jump with just one click from any content for editing to the correct side of the panel.
Is that awesome?
HowTo
Remark:
- The following is like a cookbook! You may want to change some parts of the following, to fit your needs. Feel free!
- Hint: For the first try, donβt change anything and follow this description βstep by stepβ!
- For this HowTo I assume that we use a newly installed and unchanged Kirby version 2.1.0. Otherwise, you need to adjust the description correspondingly.
Step 1:
- Add a new file with the name βpagetitle.phpβ in the directory β/site/snippetsβ
- This new file should look like:
<?php if (!isset($theTag)) $theTag = 'h1'; // no tag for the page title via the snippet variable "theTag" assigned ?>
<?php if (!isset($thePage)) $thePage = $page; // no "$page" via the snippet variable "thePage" assigned ?>
<?php if (!isset($thePageTitle)) $thePageTitle = $thePage->title(); // no "$page->title()" via the snippet variable "thePageTitle" assigned ?>
<<?php echo $theTag; ?>><?php if (isset($thePageLink)) echo '<a href="' . $thePageLink . '">'; // the url of the link in the title is in "thePageLink" or the variable "thePageLink" is empty for no link ?><?php echo html($thePageTitle); ?><?php if (isset($thePageLink)) echo '</a>'; ?><?php if($user = $site->user() and $user->hasPanelAccess()): // user is logged in and has panel access ?>
<a href="<?php echo $site->url() ?>/panel/#/pages/show/<?php echo $thePage->uri() ?>/p:1" target="<?php echo c::get('HeinerEF.EditTarget', '_blank'); ?>" title="Edit page data (in new window / tab)" class="admineditlink"><sup class="fa fa-cog admincolor"></sup></a><?php endif; ?>
</<?php echo $theTag; ?>>
Step 2:
- Open all *.php files in the folder β/site/templatesβ and search for β
<h1><?php echo $page->title()->html() ?></h1>
β. - Replace all results with β
<?php snippet('pagetitle') ?>
β.
Hint to @jenstornell Donβt require title in the blueprint:
You can replace the written title by replacing the results e.g. with β<?php snippet('pagetitle', array('thePageTitle' => $page->page_title())); ?>
β.
Step 3:
- Open the file βprojects.phpβ in the folder β/site/snippetsβ and search for β
<h3><a href="<?php echo $project->url() ?>"><?php echo $project->title()->html() ?></a></h3>
β. - Replace it with β
<?php snippet('pagetitle', array('theTag' => 'h3', 'thePage' => $project, 'thePageLink' => $project->url())); ?>
β.
Step 4:
- Within your CSS file βassets/css/main.cssβ add these lines at the end of the file:
/* =================================================
* HowTo: Working with contextual links to the panel
* =================================================
*/
@font-face {
font-family: 'FontAwesome';
font-weight: normal;
font-style: normal;
src: url(../../panel/assets/fonts/fontawesome-webfont.woff) format('woff');
}
.fa {
display: inline-block;
font-family: FontAwesome;
font-feature-settings: normal;
font-kerning: auto;
font-language-override: normal;
font-size-adjust: none;
font-stretch: normal;
font-style: normal;
font-synthesis: weight style;
font-variant: normal;
font-weight: normal;
line-height: 1;
text-rendering: auto;
}
.fa-cog:before {
content: "\f013";
}
/* The following color is deliberately garish chosen to show the gear wheels significantly. Please adjust (later)! */
.admincolor {
color: #F0F;
}
Step 5:
- Log in at the panel and keep logged in.
- Go to your website in another browser window (being logged in).
- Click at a gear wheel! Then enjoy!
Next Steps:
- Go to another page of your website (being logged in) and there click at a gear wheel.
- You may want to look at your website as a guest (not logged in) and logged in as a user without panel access, if you have this type of user!
- Modify the file βpagetitle.phpβ in the directory β/site/snippetsβ to fit your needs.
- Modify and extend the CSS file and extend the file βconfig.phpβ in the directory β/site/configβ (in this post I show only the main elements, you need to test this idea).
- Add a login panel/page on the site itself and a link to it for a login without opening the panel. Details can be found on Kirby docs: Solutions > Authentication.
[last edited: 2015-07-12 12:50 / German time]
Good luck!